Browse Source

qcacld-3.0: Remove CSR_ROAM_SESSION_MAX

As part of the effort to use a single definition for the maximum number
of vdevs, replace CSR_ROAM_SESSION_MAX with WLAN_MAX_VDEVS.

Change-Id: I71f9c02acec23314f65ac9d5ee3401ed7b4af580
CRs-Fixed: 2393166
Dustin Brown 6 years ago
parent
commit
ad06be6199

+ 1 - 2
core/hdd/src/wlan_hdd_dsc.c

@@ -16,7 +16,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "sme_api.h"
 #include "qdf_lock.h"
 #include "qdf_status.h"
 #include "qdf_types.h"
@@ -323,7 +322,7 @@ struct hdd_vdev_sync {
 	bool in_use;
 };
 
-static struct hdd_vdev_sync __hdd_vdev_sync_arr[CSR_ROAM_SESSION_MAX];
+static struct hdd_vdev_sync __hdd_vdev_sync_arr[WLAN_MAX_VDEVS];
 static qdf_spinlock_t __hdd_vdev_sync_lock;
 
 #define hdd_vdev_sync_lock_create() qdf_spinlock_create(&__hdd_vdev_sync_lock)

+ 7 - 8
core/hdd/src/wlan_hdd_main.c

@@ -1088,7 +1088,7 @@ int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func)
 		return -EINVAL;
 	}
 
-	if (session_id >= CSR_ROAM_SESSION_MAX) {
+	if (session_id >= WLAN_MAX_VDEVS) {
 		hdd_err("bad session Id:%u (via %s)", session_id, func);
 		return -EINVAL;
 	}
@@ -1956,11 +1956,10 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
 	qdf_mem_copy(&hdd_ctx->hw_bd_info, &cfg->hw_bd_info,
 		     sizeof(cfg->hw_bd_info));
 
-	if (cfg->max_intf_count > CSR_ROAM_SESSION_MAX) {
+	if (cfg->max_intf_count > WLAN_MAX_VDEVS) {
 		hdd_err("fw max vdevs (%u) > host max vdevs (%u); using %u",
-			cfg->max_intf_count, CSR_ROAM_SESSION_MAX,
-			CSR_ROAM_SESSION_MAX);
-		hdd_ctx->max_intf_count = CSR_ROAM_SESSION_MAX;
+			cfg->max_intf_count, WLAN_MAX_VDEVS, WLAN_MAX_VDEVS);
+		hdd_ctx->max_intf_count = WLAN_MAX_VDEVS;
 	} else {
 		hdd_ctx->max_intf_count = cfg->max_intf_count;
 	}
@@ -8226,7 +8225,7 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx)
 	uint32_t comb_log_str_size;
 	struct hdd_adapter *adapter = NULL;
 
-	comb_log_str_size = (ADAP_NETIFQ_LOG_LEN * CSR_ROAM_SESSION_MAX) + 1;
+	comb_log_str_size = (ADAP_NETIFQ_LOG_LEN * WLAN_MAX_VDEVS) + 1;
 	comb_log_str = qdf_mem_malloc(comb_log_str_size);
 	if (!comb_log_str)
 		return;
@@ -9009,7 +9008,7 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
 	}
 
 	if (SME_SESSION_ID_ANY == frame_ind->sessionId) {
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+		for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 			adapter =
 				hdd_get_adapter_by_sme_session_id(hdd_ctx, i);
 			if (adapter)
@@ -9187,7 +9186,7 @@ static int hdd_context_init(struct hdd_context *hdd_ctx)
 	int ret;
 
 	hdd_ctx->ioctl_scan_mode = eSIR_ACTIVE_SCAN;
-	hdd_ctx->max_intf_count = CSR_ROAM_SESSION_MAX;
+	hdd_ctx->max_intf_count = WLAN_MAX_VDEVS;
 
 	init_completion(&hdd_ctx->mc_sus_event_var);
 	init_completion(&hdd_ctx->ready_to_suspend);

+ 9 - 12
core/sme/inc/csr_internal.h

@@ -45,16 +45,13 @@
 /* session ID invalid */
 #define CSR_SESSION_ID_INVALID    0xFF
 /* No of sessions to be supported, and a session is for Infra, IBSS or BT-AMP */
-#define CSR_ROAM_SESSION_MAX      SIR_MAX_SUPPORTED_BSS
 #define CSR_IS_SESSION_VALID(mac, sessionId) \
-	(((sessionId) < CSR_ROAM_SESSION_MAX) && \
-	 ((mac)->roam.roamSession[(sessionId)].sessionActive))
+	((sessionId) < WLAN_MAX_VDEVS && \
+	 (mac)->roam.roamSession[(sessionId)].sessionActive)
 
 #define CSR_GET_SESSION(mac, sessionId) \
-	( \
-	  (sessionId < CSR_ROAM_SESSION_MAX) ? \
-	  (&(mac)->roam.roamSession[(sessionId)]) : NULL \
-	)
+	(sessionId < WLAN_MAX_VDEVS ? \
+	 &(mac)->roam.roamSession[(sessionId)] : NULL)
 
 #define CSR_IS_SESSION_ANY(sessionId) (sessionId == SME_SESSION_ID_ANY)
 #define CSR_MAX_NUM_COUNTRY_CODE  100
@@ -456,8 +453,8 @@ struct csr_scanstruct {
 	bool fDropScanCmd;      /* true means we don't accept scan commands */
 
 	/* This includes all channels on which candidate APs are found */
-	struct csr_channel occupiedChannels[CSR_ROAM_SESSION_MAX];
-	int8_t roam_candidate_count[CSR_ROAM_SESSION_MAX];
+	struct csr_channel occupiedChannels[WLAN_MAX_VDEVS];
+	int8_t roam_candidate_count[WLAN_MAX_VDEVS];
 	int8_t inScanResultBestAPRssi;
 	bool fcc_constraint;
 	wlan_scan_requester requester_id;
@@ -697,8 +694,8 @@ struct csr_roam_session {
 struct csr_roamstruct {
 	uint32_t nextRoamId;
 	struct csr_config configParam;
-	enum csr_roam_state curState[CSR_ROAM_SESSION_MAX];
-	enum csr_roam_substate curSubState[CSR_ROAM_SESSION_MAX];
+	enum csr_roam_state curState[WLAN_MAX_VDEVS];
+	enum csr_roam_substate curSubState[WLAN_MAX_VDEVS];
 	/*
 	 * This may or may not have the up-to-date valid channel list. It is
 	 * used to get CFG_VALID_CHANNEL_LIST and not alloc mem all time
@@ -719,7 +716,7 @@ struct csr_roamstruct {
 	struct csr_timer_info WaitForKeyTimerInfo;
 	struct csr_roam_session *roamSession;
 	uint32_t transactionId;  /* Current transaction ID for internal use. */
-	tCsrNeighborRoamControlInfo neighborRoamInfo[CSR_ROAM_SESSION_MAX];
+	tCsrNeighborRoamControlInfo neighborRoamInfo[WLAN_MAX_VDEVS];
 	uint8_t isFastRoamIniFeatureEnabled;
 #ifdef FEATURE_WLAN_ESE
 	uint8_t isEseIniFeatureEnabled;

+ 0 - 1
core/sme/inc/sme_power_save_api.h

@@ -33,7 +33,6 @@ QDF_STATUS sme_ps_uapsd_enable(mac_handle_t mac_handle, uint32_t session_id);
 
 QDF_STATUS sme_ps_uapsd_disable(mac_handle_t mac_handle, uint32_t session_id);
 
-/* Condition check if driver is ready to enter in PS */
 QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
 				   uint32_t session_id);
 

+ 21 - 21
core/sme/src/common/sme_api.c

@@ -654,7 +654,7 @@ static void sme_state_info_dump(char **buf_ptr, uint16_t *size)
 			"\n active command sessionid %d", active_session_id);
 	}
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		if (CSR_IS_SESSION_VALID(mac, session_id)) {
 			connect_state =
 				mac->roam.roamSession[session_id].connectState;
@@ -1717,7 +1717,7 @@ QDF_STATUS sme_set_ese_roam_scan_channel_list(mac_handle_t mac_handle,
 	uint8_t newChannelList[128] = { 0 };
 	uint8_t i = 0, j = 0;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -5251,7 +5251,7 @@ static void sme_disconnect_connected_sessions(struct mac_context *mac_ctx)
 	uint8_t session_id, found = false;
 	uint8_t curr_ch;
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		if (!csr_is_session_client_and_connected(mac_ctx, session_id))
 			continue;
 		found = false;
@@ -5784,7 +5784,7 @@ QDF_STATUS sme_update_roam_rssi_diff(mac_handle_t mac_handle, uint8_t sessionId,
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -5821,7 +5821,7 @@ QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id,
 	tpCsrNeighborRoamControlInfo neighbor_roam_info =
 			&mac->roam.neighborRoamInfo[session_id];
 
-	if (session_id >= CSR_ROAM_SESSION_MAX) {
+	if (session_id >= WLAN_MAX_VDEVS) {
 		sme_err("Invalid sme session id: %d", session_id);
 		return QDF_STATUS_E_INVAL;
 	}
@@ -5976,7 +5976,7 @@ QDF_STATUS sme_update_wes_mode(mac_handle_t mac_handle, bool isWESModeEnabled,
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6019,7 +6019,7 @@ QDF_STATUS sme_set_roam_scan_control(mac_handle_t mac_handle, uint8_t sessionId,
 	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
 			 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6527,7 +6527,7 @@ QDF_STATUS sme_set_neighbor_scan_refresh_period(mac_handle_t mac_handle,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6613,7 +6613,7 @@ QDF_STATUS sme_update_empty_scan_refresh_period(mac_handle_t mac_handle,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6667,7 +6667,7 @@ QDF_STATUS sme_set_neighbor_scan_min_chan_time(mac_handle_t mac_handle,
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6716,7 +6716,7 @@ QDF_STATUS sme_set_neighbor_scan_max_chan_time(mac_handle_t mac_handle,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6761,7 +6761,7 @@ uint16_t sme_get_neighbor_scan_min_chan_time(mac_handle_t mac_handle,
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return 0;
@@ -6783,7 +6783,7 @@ uint32_t sme_get_neighbor_roam_state(mac_handle_t mac_handle, uint8_t sessionId)
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return 0;
@@ -6914,7 +6914,7 @@ uint16_t sme_get_neighbor_scan_max_chan_time(mac_handle_t mac_handle,
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return 0;
@@ -6945,7 +6945,7 @@ QDF_STATUS sme_set_neighbor_scan_period(mac_handle_t mac_handle,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -6991,7 +6991,7 @@ uint16_t sme_get_neighbor_scan_period(mac_handle_t mac_handle,
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return 0;
@@ -7040,7 +7040,7 @@ QDF_STATUS sme_change_roam_scan_channel_list(mac_handle_t mac_handle,
 	uint8_t i = 0, j = 0;
 	tCsrChannelInfo *chan_info;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -7116,7 +7116,7 @@ QDF_STATUS sme_get_roam_scan_channel_list(mac_handle_t mac_handle,
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -9173,7 +9173,7 @@ QDF_STATUS sme_update_dfs_scan_mode(mac_handle_t mac_handle, uint8_t sessionId,
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid sme session id: %d"), sessionId);
 		return QDF_STATUS_E_INVAL;
@@ -10825,7 +10825,7 @@ bool sme_is_any_session_in_middle_of_roaming(mac_handle_t mac_handle)
 	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
 	uint8_t session_id;
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		if (CSR_IS_SESSION_VALID(mac_ctx, session_id) &&
 		    csr_neighbor_middle_of_roaming(mac_ctx, session_id))
 			return true;
@@ -10988,7 +10988,7 @@ QDF_STATUS sme_update_nss(mac_handle_t mac_handle, uint8_t nss)
 		/* get the HT capability info*/
 		ht_cap_info = &mac_ctx->mlme_cfg->ht_caps.ht_cap_info;
 
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+		for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 			if (CSR_IS_SESSION_VALID(mac_ctx, i)) {
 				csr_session = &mac_ctx->roam.roamSession[i];
 				csr_session->htConfig.ht_tx_stbc =

+ 10 - 10
core/sme/src/common/sme_power_save.c

@@ -323,20 +323,20 @@ QDF_STATUS sme_ps_process_command(struct mac_context *mac_ctx, uint32_t session_
  * sme_enable_sta_ps_check(): Checks if it is ok to enable power save or not.
  * @mac_ctx: global mac context
  * @session_id: session id
- * @command: power save cmd of type enum sme_ps_cmd
  *
- *Pre Condition for enabling sta mode power save
- *1) Sta Mode Ps should be enabled in ini file.
- *2) Session should be in infra mode and in connected state.
+ * Pre Condition for enabling sta mode power save
+ * 1) Sta Mode Ps should be enabled in ini file.
+ * 2) Session should be in infra mode and in connected state.
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx, uint32_t session_id)
+QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
+				   uint32_t session_id)
 {
 	struct wlan_mlme_powersave *powersave_params;
 
-	QDF_BUG(session_id < CSR_ROAM_SESSION_MAX);
-	if (session_id >= CSR_ROAM_SESSION_MAX)
+	QDF_BUG(session_id < WLAN_MAX_VDEVS);
+	if (session_id >= WLAN_MAX_VDEVS)
 		return QDF_STATUS_E_INVAL;
 
 	/* Check if Sta Ps is enabled. */
@@ -408,8 +408,8 @@ QDF_STATUS sme_ps_timer_flush_sync(mac_handle_t mac_handle, uint8_t session_id)
 	struct sEnablePsParams *req;
 	t_wma_handle *wma;
 
-	QDF_BUG(session_id < CSR_ROAM_SESSION_MAX);
-	if (session_id >= CSR_ROAM_SESSION_MAX)
+	QDF_BUG(session_id < WLAN_MAX_VDEVS);
+	if (session_id >= WLAN_MAX_VDEVS)
 		return QDF_STATUS_E_INVAL;
 
 	status = sme_enable_sta_ps_check(mac_ctx, session_id);
@@ -868,7 +868,7 @@ QDF_STATUS sme_ps_close(mac_handle_t mac_handle)
 {
 	uint32_t i;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+	for (i = 0; i < WLAN_MAX_VDEVS; i++)
 		sme_ps_close_per_session(mac_handle, i);
 
 	return QDF_STATUS_SUCCESS;

+ 21 - 22
core/sme/src/csr/csr_api_roam.c

@@ -509,10 +509,9 @@ static struct csr_roam_session *csr_roam_roam_session;
 static QDF_STATUS csr_roam_init_globals(struct mac_context *mac)
 {
 	uint32_t buf_size;
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	QDF_STATUS status;
 
-	buf_size = CSR_ROAM_SESSION_MAX
-		   * sizeof(struct csr_roam_session);
+	buf_size = WLAN_MAX_VDEVS * sizeof(struct csr_roam_session);
 
 	csr_roam_roam_session = qdf_mem_malloc(buf_size);
 	if (csr_roam_roam_session) {
@@ -533,7 +532,7 @@ static inline void csr_roam_free_globals(void)
 }
 
 #else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
-static struct csr_roam_session csr_roam_roam_session[CSR_ROAM_SESSION_MAX];
+static struct csr_roam_session csr_roam_roam_session[WLAN_MAX_VDEVS];
 
 /* Initialize global variables */
 static QDF_STATUS csr_roam_init_globals(struct mac_context *mac)
@@ -554,7 +553,7 @@ static void csr_roam_de_init_globals(struct mac_context *mac)
 {
 	uint8_t i;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (mac->roam.roamSession[i].pCurRoamProfile)
 			csr_release_profile(mac,
 					    mac->roam.roamSession[i].
@@ -604,7 +603,7 @@ QDF_STATUS csr_open(struct mac_context *mac)
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			break;
 
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+		for (i = 0; i < WLAN_MAX_VDEVS; i++)
 			csr_roam_state_change(mac, eCSR_ROAMING_STATE_STOP, i);
 
 		init_config_param(mac);
@@ -1223,7 +1222,7 @@ QDF_STATUS csr_start(struct mac_context *mac)
 	uint32_t i;
 
 	do {
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+		for (i = 0; i < WLAN_MAX_VDEVS; i++)
 			csr_roam_state_change(mac, eCSR_ROAMING_STATE_IDLE, i);
 
 		status = csr_roam_start(mac);
@@ -1231,7 +1230,7 @@ QDF_STATUS csr_start(struct mac_context *mac)
 			break;
 
 		mac->roam.sPendingCommands = 0;
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++)
+		for (i = 0; i < WLAN_MAX_VDEVS; i++)
 			status = csr_neighbor_roam_init(mac, i);
 		csr_init_tl_stats(mac);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
@@ -1258,19 +1257,19 @@ QDF_STATUS csr_stop(struct mac_context *mac)
 	 * sure memory and vdev ref are freed.
 	 */
 	csr_purge_pdev_all_ser_cmd_list(mac);
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
 		csr_roam_close_session(mac, sessionId, true);
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
 		csr_neighbor_roam_close(mac, sessionId);
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
 		if (CSR_IS_SESSION_VALID(mac, sessionId))
 			csr_scan_flush_result(mac);
 
 	/* Reset the domain back to the deault */
 	mac->scan.domainIdCurrent = mac->scan.domainIdDefault;
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++) {
 		csr_roam_state_change(mac, eCSR_ROAMING_STATE_STOP, sessionId);
 		csr_roam_substate_change(mac, eCSR_ROAM_SUBSTATE_NONE,
 					 sessionId);
@@ -1371,7 +1370,7 @@ static QDF_STATUS csr_roam_open(struct mac_context *mac)
 	struct csr_roam_session *pSession;
 
 	do {
-		for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+		for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 			pSession = CSR_GET_SESSION(mac, i);
 			pSession->roamingTimerInfo.mac = mac;
 			pSession->roamingTimerInfo.session_id =
@@ -1409,7 +1408,7 @@ static QDF_STATUS csr_roam_close(struct mac_context *mac)
 	 * sure memory and vdev ref are freed.
 	 */
 	csr_purge_pdev_all_ser_cmd_list(mac);
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
 		csr_roam_close_session(mac, sessionId, true);
 
 	qdf_mc_timer_stop(&mac->roam.hTimerWaitForKey);
@@ -1580,7 +1579,7 @@ static void csr_release_command_set_hw_mode(struct mac_context *mac,
 void csr_roam_substate_change(struct mac_context *mac,
 		enum csr_roam_substate NewSubstate, uint32_t sessionId)
 {
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		sme_err("Invalid no of concurrent sessions %d",
 			  sessionId);
 		return;
@@ -2908,7 +2907,7 @@ static QDF_STATUS csr_init11d_info(struct mac_context *mac, tCsr11dinfo *ps11din
 	 * Otherwise they will be applied later
 	 */
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		for (index = 0; index < CSR_ROAM_SESSION_MAX; index++) {
+		for (index = 0; index < WLAN_MAX_VDEVS; index++) {
 			if ((CSR_IS_SESSION_VALID(mac, index))
 			    && CSR_IS_ROAM_STOP(mac, index)) {
 				applyConfig = false;
@@ -8954,7 +8953,7 @@ static void csr_roam_roaming_state_reassoc_rsp_processor(struct mac_context *mac
 	uint32_t roamId = 0;
 	struct csr_roam_session *csr_session;
 
-	if (pSmeJoinRsp->sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (pSmeJoinRsp->sessionId >= WLAN_MAX_VDEVS) {
 		sme_err("Invalid session ID received %d",
 			 pSmeJoinRsp->sessionId);
 		return;
@@ -11908,7 +11907,7 @@ void csr_roam_wait_for_key_time_out_handler(void *pv)
 	spin_lock(&mac->roam.roam_state_lock);
 	if (CSR_IS_WAIT_FOR_KEY(mac, session_id)) {
 		/* Change the substate so command queue is unblocked. */
-		if (CSR_ROAM_SESSION_MAX > session_id)
+		if (session_id < WLAN_MAX_VDEVS)
 			mac->roam.curSubState[session_id] =
 						eCSR_ROAM_SUBSTATE_NONE;
 		spin_unlock(&mac->roam.roam_state_lock);
@@ -16431,7 +16430,7 @@ QDF_STATUS csr_roam_get_session_id_from_bssid(struct mac_context *mac,
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	uint32_t i;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (CSR_IS_SESSION_VALID(mac, i)) {
 			if (qdf_is_macaddr_equal(bssid,
 				    &mac->roam.roamSession[i].connectedProfile.
@@ -16455,7 +16454,7 @@ static uint32_t csr_find_ibss_session(struct mac_context *mac)
 	uint32_t i, nRet = CSR_SESSION_ID_INVALID;
 	struct csr_roam_session *pSession;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (CSR_IS_SESSION_VALID(mac, i)) {
 			pSession = CSR_GET_SESSION(mac, i);
 			if (pSession->pCurRoamProfile
@@ -18578,7 +18577,7 @@ uint8_t csr_get_roam_enabled_sta_sessionid(struct mac_context *mac_ctx)
 	tpCsrNeighborRoamControlInfo roam_info;
 	uint8_t i;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		session = CSR_GET_SESSION(mac_ctx, i);
 		if (!session || !CSR_IS_SESSION_VALID(mac_ctx, i))
 			continue;
@@ -20128,7 +20127,7 @@ csr_find_session_by_type(struct mac_context *mac_ctx, enum QDF_OPMODE type)
 	uint32_t i, session_id = CSR_SESSION_ID_INVALID;
 	struct csr_roam_session *session_ptr;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (!CSR_IS_SESSION_VALID(mac_ctx, i))
 			continue;
 

+ 1 - 1
core/sme/src/csr/csr_api_scan.c

@@ -449,7 +449,7 @@ static bool csr_scan_flush_denied(struct mac_context *mac)
 {
 	uint8_t sessionId;
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++) {
 		if (CSR_IS_SESSION_VALID(mac, sessionId)) {
 			if (csr_neighbor_middle_of_roaming(mac, sessionId))
 				return 1;

+ 1 - 1
core/sme/src/csr/csr_neighbor_roam.c

@@ -1168,7 +1168,7 @@ static QDF_STATUS csr_neighbor_roam_init11r_assoc_info(struct mac_context *mac)
 	tpCsrNeighborRoamControlInfo pNeighborRoamInfo = NULL;
 	tpCsr11rAssocNeighborInfo pFTRoamInfo = NULL;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		pNeighborRoamInfo = &mac->roam.neighborRoamInfo[i];
 		pFTRoamInfo = &pNeighborRoamInfo->FTRoamInfo;
 

+ 1 - 1
core/sme/src/csr/csr_roam_preauth.c

@@ -145,7 +145,7 @@ void csr_neighbor_roam_purge_preauth_failed_list(struct mac_context *mac_ctx)
 	tpCsrNeighborRoamControlInfo neigh_roam_info = NULL;
 	tpCsrPreauthFailListInfo fail_list;
 
-	for (j = 0; j < CSR_ROAM_SESSION_MAX; j++) {
+	for (j = 0; j < WLAN_MAX_VDEVS; j++) {
 		neigh_roam_info = &mac_ctx->roam.neighborRoamInfo[j];
 		fail_list = &neigh_roam_info->FTRoamInfo.preAuthFailList;
 		num_mac_addr = fail_list->numMACAddress;

+ 17 - 19
core/sme/src/csr/csr_util.c

@@ -573,8 +573,8 @@ bool csr_is_bss_id_equal(tSirBssDescription *pSirBssDesc1,
 static bool csr_is_conn_state(struct mac_context *mac_ctx, uint32_t session_id,
 			      eCsrConnectState state)
 {
-	QDF_BUG(session_id < CSR_ROAM_SESSION_MAX);
-	if (session_id >= CSR_ROAM_SESSION_MAX)
+	QDF_BUG(session_id < WLAN_MAX_VDEVS);
+	if (session_id >= WLAN_MAX_VDEVS)
 		return false;
 
 	return mac_ctx->roam.roamSession[session_id].connectState == state;
@@ -663,19 +663,17 @@ static bool csr_is_conn_state_ap(struct mac_context *mac, uint32_t sessionId)
 bool csr_is_any_session_in_connect_state(struct mac_context *mac)
 {
 	uint32_t i;
-	bool fRc = false;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (CSR_IS_SESSION_VALID(mac, i) &&
-		    (csr_is_conn_state_infra(mac, i)
-		     || csr_is_conn_state_ibss(mac, i)
-		     || csr_is_conn_state_ap(mac, i))) {
-			fRc = true;
-			break;
+		    (csr_is_conn_state_infra(mac, i) ||
+		     csr_is_conn_state_ibss(mac, i) ||
+		     csr_is_conn_state_ap(mac, i))) {
+			return true;
 		}
 	}
 
-	return fRc;
+	return false;
 }
 
 uint8_t csr_get_infra_operation_channel(struct mac_context *mac, uint8_t sessionId)
@@ -726,7 +724,7 @@ uint8_t csr_get_concurrent_operation_channel(struct mac_context *mac_ctx)
 	uint8_t i = 0;
 	enum QDF_OPMODE persona;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (!CSR_IS_SESSION_VALID(mac_ctx, i))
 			continue;
 		session = CSR_GET_SESSION(mac_ctx, i);
@@ -1000,7 +998,7 @@ uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac_ctx,
 	sme_debug("sap_ch:%d sap_phymode:%d sap_cch:%d sap_hbw:%d chb:%d",
 		sap_ch, sap_phymode, sap_cch, sap_hbw, chb);
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (!CSR_IS_SESSION_VALID(mac_ctx, i))
 			continue;
 
@@ -1106,7 +1104,7 @@ bool csr_is_all_session_disconnected(struct mac_context *mac)
 	uint32_t i;
 	bool fRc = true;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (CSR_IS_SESSION_VALID(mac, i)
 		    && !csr_is_conn_state_disconnected(mac, i)) {
 			fRc = false;
@@ -1122,7 +1120,7 @@ uint8_t csr_get_connected_infra(struct mac_context *mac_ctx)
 	uint32_t i;
 	uint8_t connected_session = CSR_SESSION_ID_INVALID;
 
-	for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) {
+	for (i = 0; i < WLAN_MAX_VDEVS; i++) {
 		if (CSR_IS_SESSION_VALID(mac_ctx, i)
 		    && csr_is_conn_state_connected_infra(mac_ctx, i)) {
 			connected_session = i;
@@ -1141,7 +1139,7 @@ bool csr_is_concurrent_session_running(struct mac_context *mac)
 
 	bool fRc = false;
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++) {
 		if (CSR_IS_SESSION_VALID(mac, sessionId)) {
 			connectState =
 				mac->roam.roamSession[sessionId].connectState;
@@ -1167,7 +1165,7 @@ bool csr_is_infra_ap_started(struct mac_context *mac)
 	uint32_t sessionId;
 	bool fRc = false;
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++) {
 		if (CSR_IS_SESSION_VALID(mac, sessionId) &&
 				(csr_is_conn_state_connected_infra_ap(mac,
 					sessionId))) {
@@ -2154,7 +2152,7 @@ static QDF_STATUS csr_update_mcc_p2p_beacon_interval(struct mac_context *mac_ctx
 	if (!mac_ctx->roam.configParam.fenableMCCMode)
 		return QDF_STATUS_E_FAILURE;
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		/*
 		 * If GO in MCC support different beacon interval,
 		 * change the BI of the P2P-GO
@@ -2472,7 +2470,7 @@ QDF_STATUS csr_validate_mcc_beacon_interval(struct mac_context *mac_ctx,
 	if (!mac_ctx->roam.configParam.fenableMCCMode)
 		return QDF_STATUS_E_FAILURE;
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		if (cur_session_id == session_id)
 			continue;
 
@@ -6173,7 +6171,7 @@ bool csr_is_mcc_channel(struct mac_context *mac_ctx, uint8_t channel)
 	if (channel == 0)
 		return false;
 
-	for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) {
+	for (session_id = 0; session_id < WLAN_MAX_VDEVS; session_id++) {
 		if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
 			session = CSR_GET_SESSION(mac_ctx, session_id);
 			if (NULL == session->pCurRoamProfile)

+ 8 - 8
core/sme/src/qos/sme_qos.c

@@ -68,7 +68,7 @@
 #define SME_QOS_SEARCH_KEY_INDEX_4       8      /* ac + direction */
 #define SME_QOS_SEARCH_KEY_INDEX_5       0x10   /* ac + tspec_mask */
 /* special value for searching any Session Id */
-#define SME_QOS_SEARCH_SESSION_ID_ANY    CSR_ROAM_SESSION_MAX
+#define SME_QOS_SEARCH_SESSION_ID_ANY    WLAN_MAX_VDEVS
 #define SME_QOS_ACCESS_POLICY_EDCA       1
 #define SME_QOS_MAX_TID                  255
 #define SME_QOS_TSPEC_IE_LENGTH          61
@@ -465,7 +465,7 @@ static inline QDF_STATUS sme_qos_allocate_control_block_buffer(void)
 {
 	uint32_t buf_size;
 
-	buf_size = CSR_ROAM_SESSION_MAX * sizeof(struct sme_qos_sessioninfo);
+	buf_size = WLAN_MAX_VDEVS * sizeof(struct sme_qos_sessioninfo);
 	sme_qos_cb.sessionInfo = qdf_mem_malloc(buf_size);
 	if (!sme_qos_cb.sessionInfo)
 		return QDF_STATUS_E_NOMEM;
@@ -492,7 +492,7 @@ static inline void sme_qos_free_control_block_buffer(void)
 
 #else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
 
-struct sme_qos_sessioninfo sessionInfo[CSR_ROAM_SESSION_MAX];
+struct sme_qos_sessioninfo sessionInfo[WLAN_MAX_VDEVS];
 struct sme_qos_wmmtspecinfo def_QoSInfo[SME_QOS_EDCA_AC_MAX];
 
 static inline QDF_STATUS sme_qos_allocate_control_block_buffer(void)
@@ -553,7 +553,7 @@ QDF_STATUS sme_qos_open(struct mac_context *mac)
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; ++sessionId) {
 		pSession = &sme_qos_cb.sessionInfo[sessionId];
 		pSession->sessionId = sessionId;
 		/* initialize the session's per-AC information */
@@ -596,7 +596,7 @@ QDF_STATUS sme_qos_close(struct mac_context *mac)
 	/* close the flow list */
 	csr_ll_close(&sme_qos_cb.flow_list);
 	/* shut down all of the sessions */
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; ++sessionId) {
 		pSession = &sme_qos_cb.sessionInfo[sessionId];
 		if (pSession == NULL)
 			continue;
@@ -3843,7 +3843,7 @@ static QDF_STATUS sme_qos_add_ts_req(struct mac_context *mac,
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
 		  "%s: %d: invoked on session %d for AC %d",
 		  __func__, __LINE__, sessionId, ac);
-	if (sessionId >= CSR_ROAM_SESSION_MAX) {
+	if (sessionId >= WLAN_MAX_VDEVS) {
 		/* err msg */
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  "%s: %d: sessionId(%d) is invalid",
@@ -4554,7 +4554,7 @@ static QDF_STATUS sme_qos_process_reassoc_success_ev(struct mac_context *mac_ctx
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
 		  FL("invoked on session %d"), sessionid);
 
-	if (CSR_ROAM_SESSION_MAX <= sessionid) {
+	if (sessionid >= WLAN_MAX_VDEVS) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("invoked on session %d"), sessionid);
 		return status;
@@ -7026,7 +7026,7 @@ static bool sme_qos_is_uapsd_active(void)
 	struct sme_qos_sessioninfo *pSession;
 	uint8_t sessionId;
 
-	for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; ++sessionId) {
+	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; ++sessionId) {
 		pSession = &sme_qos_cb.sessionInfo[sessionId];
 		if ((pSession->sessionActive) && (pSession->apsdMask))
 			return true;