Browse Source

qcacld-3.0: Use add_bss_resp structure while handling add bss resp

The add_bss_req struct is used while handling add bss resp,
and is stored in vdev priv mlme.

The resp path require the info which can be filled from vdev resp
and thus no need to store the add_bss_req. From response fill and
use the add_bss_resp in add bss response handling path

Change-Id: I7ec1189c7d399e181f451a442a2578964eb4e47d
CRs-Fixed: 2529289
Abhishek Singh 5 years ago
parent
commit
6e5c7a6f42

+ 0 - 2
components/mlme/core/inc/wlan_mlme_main.h

@@ -128,7 +128,6 @@ struct wlan_mlme_roam {
  * @peer_disconnect_ies: Disconnect IEs received in deauth/disassoc frames
  *			 from peer
  * @vdev_stop_type: vdev stop type request
- * @bss_params: Bss params to be used in add bss resp handler
  * @roam_off_state: Roam offload state
  */
 struct mlme_legacy_priv {
@@ -145,7 +144,6 @@ struct mlme_legacy_priv {
 	struct wlan_ies self_disconnect_ies;
 	struct wlan_ies peer_disconnect_ies;
 	uint32_t vdev_stop_type;
-	struct bss_params *bss_params;
 	struct wlan_mlme_roam mlme_roam;
 };
 

+ 0 - 26
components/mlme/core/inc/wlan_mlme_vdev_mgr_interface.h

@@ -232,30 +232,4 @@ QDF_STATUS mlme_set_vdev_stop_type(struct wlan_objmgr_vdev *vdev,
  */
 enum vdev_assoc_type  mlme_get_assoc_type(struct wlan_objmgr_vdev *vdev);
 
-/**
- * mlme_set_bss_params() - set bss params
- * @vdev: vdev pointer
- * @bss_params: bss params address to be set
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS mlme_set_bss_params(struct wlan_objmgr_vdev *vdev,
-			       struct bss_params *bss_params);
-
-/**
- * mlme_get_bss_params() - get bss params and clear it from vdev mlme
- * @vdev: vdev pointer
- *
- * Return: bss_params
- */
-struct bss_params *mlme_get_bss_params(struct wlan_objmgr_vdev *vdev);
-
-/**
- * mlme_clear_bss_params() - clear bss params from vdev mlme
- * @vdev: vdev pointer
- *
- * Return: None
- */
-void mlme_clear_bss_params(struct wlan_objmgr_vdev *vdev);
-
 #endif

+ 0 - 47
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -740,51 +740,6 @@ enum vdev_assoc_type  mlme_get_assoc_type(struct wlan_objmgr_vdev *vdev)
 	return mlme_priv->assoc_type;
 }
 
-QDF_STATUS mlme_set_bss_params(struct wlan_objmgr_vdev *vdev,
-			       struct bss_params *bss_params)
-{
-	struct mlme_legacy_priv *mlme_priv;
-
-	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
-	if (!mlme_priv) {
-		mlme_legacy_err("vdev legacy private object is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	qdf_mem_free(mlme_priv->bss_params);
-	mlme_priv->bss_params = bss_params;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-struct bss_params *mlme_get_bss_params(struct wlan_objmgr_vdev *vdev)
-{
-	struct mlme_legacy_priv *mlme_priv;
-	struct bss_params *bss_params;
-
-	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
-	if (!mlme_priv) {
-		mlme_legacy_err("vdev legacy private object is NULL");
-		return NULL;
-	}
-	bss_params = mlme_priv->bss_params;
-	mlme_priv->bss_params = NULL;
-
-	return bss_params;
-}
-
-void mlme_clear_bss_params(struct wlan_objmgr_vdev *vdev)
-{
-	struct mlme_legacy_priv *mlme_priv;
-
-	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
-	if (!mlme_priv) {
-		mlme_legacy_err("vdev legacy private object is NULL");
-		return;
-	}
-	mlme_priv->bss_params = NULL;
-}
-
 QDF_STATUS
 mlme_set_vdev_start_failed(struct wlan_objmgr_vdev *vdev, bool val)
 {
@@ -915,8 +870,6 @@ QDF_STATUS vdevmgr_mlme_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme)
 
 	mlme_free_self_disconnect_ies(vdev_mlme->vdev);
 	mlme_free_peer_disconnect_ies(vdev_mlme->vdev);
-	qdf_mem_free(vdev_mlme->ext_vdev_ptr->bss_params);
-	vdev_mlme->ext_vdev_ptr->bss_params = NULL;
 	qdf_mem_free(vdev_mlme->ext_vdev_ptr);
 	vdev_mlme->ext_vdev_ptr = NULL;
 

+ 0 - 1
core/mac/src/include/sir_params.h

@@ -213,7 +213,6 @@ struct sir_cfg_action_frm_tb_ppdu {
 #define SIR_HAL_DELETE_STA_REQ             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 3)
 #define SIR_HAL_DELETE_STA_RSP             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 4)
 #define SIR_HAL_ADD_BSS_REQ                (SIR_HAL_ITC_MSG_TYPES_BEGIN + 5)
-#define SIR_HAL_ADD_BSS_RSP                (SIR_HAL_ITC_MSG_TYPES_BEGIN + 6)
 #define SIR_HAL_DELETE_BSS_REQ             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 7)
 #define SIR_HAL_DELETE_BSS_RSP             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 8)
 /*

+ 3 - 3
core/mac/src/pe/include/lim_ft.h

@@ -67,7 +67,7 @@ void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx, uint32_t *msg);
 /**
  * lim_process_sta_mlm_add_bss_rsp_ft() - Handle ft add bss response
  * @mac: Global MAC context
- * @add_bss_params: Bss params including rsp data
+ * @add_bss_rsp: Bss params rsp data
  * @pe_session: PE Session
  *
  * Function to handle fast roaming add bss response in FT reassoc state,
@@ -76,7 +76,7 @@ void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx, uint32_t *msg);
  * Return: None
  */
 void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
-					struct bss_params *add_bss_params,
+					struct add_bss_rsp *add_bss_rsp,
 					struct pe_session *pe_session);
 void lim_process_mlm_reassoc_req(struct mac_context *mac_ctx,
 				 tLimMlmReassocReq *reassoc_req);
@@ -105,7 +105,7 @@ static inline void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx,
 {}
 static inline
 void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
-					struct bss_params *add_bss_params,
+					struct add_bss_rsp *add_bss_rsp,
 					struct pe_session *pe_session)
 {}
 static inline void lim_process_mlm_reassoc_req(struct mac_context *mac_ctx,

+ 0 - 2
core/mac/src/pe/lim/lim_api.c

@@ -2448,8 +2448,6 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 
 	curr_sta_ds->bssId = add_bss_params->bss_idx;
 	curr_sta_ds->staIndex = add_bss_params->staContext.staIdx;
-	rrm_cache_mgmt_tx_power(mac_ctx, add_bss_params->txMgmtPower,
-				ft_session_ptr);
 	mac_ctx->roam.reassocRespLen = roam_sync_ind_ptr->reassocRespLength;
 	mac_ctx->roam.pReassocResp =
 		qdf_mem_malloc(mac_ctx->roam.reassocRespLen);

+ 1 - 1
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -4038,10 +4038,10 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp
 	retCode = wma_send_peer_assoc_req(pAddBssParams);
 	if (QDF_IS_STATUS_ERROR(retCode)) {
 		SET_LIM_PROCESS_DEFD_MESGS(mac, true);
-		qdf_mem_free(pAddBssParams);
 		pe_err("wma_send_peer_assoc_req failed=%X",
 		       retCode);
 	}
+	qdf_mem_free(pAddBssParams);
 
 returnFailure:
 	/* Clean-up will be done by the caller... */

+ 2 - 2
core/mac/src/pe/lim/lim_ibss_peer_mgmt.c

@@ -1227,7 +1227,7 @@ void lim_ibss_del_bss_rsp_when_coalescing(struct mac_context *mac,
 }
 
 void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac,
-					  struct bss_params *bss_param,
+					  uint32_t op_chan_freq,
 					  struct pe_session *pe_session)
 {
 	uint8_t infoLen;
@@ -1245,7 +1245,7 @@ void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac,
 
 	qdf_mem_zero((void *)&newBssInfo, sizeof(newBssInfo));
 	qdf_mem_copy(newBssInfo.bssId.bytes, pHdr->bssId, QDF_MAC_ADDR_SIZE);
-	newBssInfo.freq = bss_param->op_chan_freq;
+	newBssInfo.freq = op_chan_freq;
 	qdf_mem_copy((uint8_t *) &newBssInfo.ssId,
 		     (uint8_t *) &pBeacon->ssId, pBeacon->ssId.length + 1);
 

+ 2 - 2
core/mac/src/pe/lim/lim_ibss_peer_mgmt.h

@@ -125,13 +125,13 @@ void lim_ibss_del_bss_rsp_when_coalescing(struct mac_context *mac,
 /**
  * lim_ibss_add_bss_rsp_when_coalescing()- Handle ADD BSS rsp of IBSS coalescing
  * @mac_ptr: Pointer to Global MAC structure
- * @bss_params: Bss params including rsp data
+ * @op_chan_freq: operating chan freq
  * @pe_session: PE session pointer
  *
  * Return: None
  */
 void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac,
-					  struct bss_params *bss_param,
+					  uint32_t op_chan_freq,
 					  struct pe_session *pe_session);
 void lim_ibss_decide_protection_on_delete(struct mac_context *mac, tpDphHashNode sta,
 					  tpUpdateBeaconParams pBeaconParams,

+ 1 - 5
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -551,8 +551,7 @@ static bool def_msg_decision(struct mac_context *mac_ctx,
 				mgmt_pkt_defer = false;
 		}
 
-		if ((lim_msg->type != WMA_ADD_BSS_RSP) &&
-		    (lim_msg->type != WMA_DELETE_BSS_RSP) &&
+		if ((lim_msg->type != WMA_DELETE_BSS_RSP) &&
 		    (lim_msg->type != WMA_DELETE_BSS_HO_FAIL_RSP) &&
 		    (lim_msg->type != WMA_ADD_STA_RSP) &&
 		    (lim_msg->type != WMA_DELETE_STA_RSP) &&
@@ -1919,9 +1918,6 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 	case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
 		lim_handle_update_olbc_cache(mac_ctx);
 		break;
-	case WMA_ADD_BSS_RSP:
-		lim_process_mlm_add_bss_rsp(mac_ctx, msg);
-		break;
 	case WMA_ADD_STA_RSP:
 		lim_process_add_sta_rsp(mac_ctx, msg);
 		break;

+ 10 - 17
core/mac/src/pe/lim/lim_process_mlm_host_roam.c

@@ -373,7 +373,7 @@ QDF_STATUS lim_sta_reassoc_error_handler(struct reassoc_params *param)
 }
 
 void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
-					struct bss_params *add_bss_params,
+					struct add_bss_rsp *add_bss_rsp,
 					struct pe_session *pe_session)
 {
 	tLimMlmReassocCnf mlmReassocCnf; /* keep sme */
@@ -384,8 +384,8 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
 
 	/* Sanity Checks */
 
-	if (!add_bss_params) {
-		pe_err("Invalid parameters");
+	if (!add_bss_rsp) {
+		pe_err("add_bss_rsp is NULL");
 		goto end;
 	}
 	if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE !=
@@ -393,14 +393,13 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
 		goto end;
 	}
 
-	sta = dph_add_hash_entry(mac, add_bss_params->bssId,
+	sta = dph_add_hash_entry(mac, pe_session->bssId,
 				 DPH_STA_HASH_INDEX_PEER,
 				 &pe_session->dph.dphHashTable);
 	if (!sta) {
 		/* Could not add hash table entry */
-		pe_err("could not add hash entry at DPH for");
-		lim_print_mac_addr(mac, add_bss_params->staContext.staMac,
-				   LOGE);
+		pe_err("could not add hash entry at DPH for %pM",
+		       pe_session->bssId);
 		goto end;
 	}
 	/* Prepare and send Reassociation request frame */
@@ -458,15 +457,12 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
 	pe_debug("Set the mlm state: %d session: %d",
 		       pe_session->limMlmState, pe_session->peSessionId);
 
-	pe_session->bss_idx = (uint8_t)add_bss_params->bss_idx;
+	pe_session->bss_idx = add_bss_rsp->vdev_id;
 
 	/* Success, handle below */
-	sta->bssId = add_bss_params->bss_idx;
+	sta->bssId = add_bss_rsp->vdev_id;
 	/* STA Index(genr by HAL) for the BSS entry is stored here */
-	sta->staIndex = add_bss_params->staContext.staIdx;
-
-	rrm_cache_mgmt_tx_power(mac, add_bss_params->txMgmtPower,
-				pe_session);
+	sta->staIndex = wma_peer_get_peet_id(pe_session->bssId);
 
 	pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams));
 	if (!pAddStaParams)
@@ -477,9 +473,6 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac,
 		     (uint8_t *)pe_session->self_mac_addr,
 		     sizeof(tSirMacAddr));
 
-	qdf_mem_copy((uint8_t *) pAddStaParams->bssId,
-		     pe_session->bssId, sizeof(tSirMacAddr));
-
 	pAddStaParams->staType = STA_ENTRY_SELF;
 	pAddStaParams->status = QDF_STATUS_SUCCESS;
 	pAddStaParams->respReqd = 1;
@@ -661,10 +654,10 @@ void lim_process_mlm_ft_reassoc_req(struct mac_context *mac,
 	status = wma_add_bss_lfr2_vdev_start(session->ftPEContext.pAddBssReq);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		SET_LIM_PROCESS_DEFD_MESGS(mac, true);
-		qdf_mem_free(session->ftPEContext.pAddBssReq);
 		pe_err("wma_add_bss_lfr2_vdev_start, reason: %X",
 		       status);
 	}
+	qdf_mem_free(session->ftPEContext.pAddBssReq);
 
 	session->ftPEContext.pAddBssReq = NULL;
 	return;

+ 47 - 144
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -1943,67 +1943,37 @@ end:
 	return;
 }
 
-/**
- * lim_process_ap_mlm_add_bss_rsp()
- * @mac: Pointer to Global MAC structure
- * @pAddBssParams: Bss params including rsp data
- *
- ***FUNCTION:
- * This function is called to process a WMA_ADD_BSS_RSP from HAL.
- * Upon receipt of this message from HAL, MLME -
- * > Validates the result of WMA_ADD_BSS_REQ
- * > Init other remaining LIM variables
- * > Init the AID pool, for that BSSID
- * > Init the Pre-AUTH list, for that BSSID
- * > Create LIM timers, specific to that BSSID
- * > Init DPH related parameters that are specific to that BSSID
- * > TODO - When do we do the actual change channel?
- *
- ***LOGIC:
- * SME sends eWNI_SME_START_BSS_REQ to LIM
- * LIM sends LIM_MLM_START_REQ to MLME
- * MLME sends WMA_ADD_BSS_REQ to HAL
- * HAL responds with WMA_ADD_BSS_RSP to MLME
- * MLME responds with LIM_MLM_START_CNF to LIM
- * LIM responds with eWNI_SME_START_BSS_RSP to SME
- *
- ***ASSUMPTIONS:
- * struct scheduler_msg.body is allocated by MLME during
- * lim_process_mlm_start_req
- * struct scheduler_msg.body will now be freed by this routine
- *
- * @return None
- */
 static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac,
-					   struct bss_params *pAddBssParams)
+					   struct add_bss_rsp *add_bss_rsp)
 {
 	tLimMlmStartCnf mlmStartCnf;
 	struct pe_session *pe_session;
 	uint8_t isWepEnabled = false;
 
-	if (!pAddBssParams) {
+	if (!add_bss_rsp) {
 		pe_err("Encountered NULL Pointer");
 		return;
 	}
 	/* TBD: free the memory before returning, do it for all places where lookup fails. */
-	pe_session = pe_find_session_by_session_id(mac,
-					   pAddBssParams->sessionId);
+	pe_session = pe_find_session_by_sme_session_id(mac,
+						       add_bss_rsp->vdev_id);
 	if (!pe_session) {
-		pe_err("session does not exist for given sessionId");
+		pe_err("session does not exist for vdev_id %d",
+		       add_bss_rsp->vdev_id);
 		return;
 	}
 	/* Update PE session Id */
-	mlmStartCnf.sessionId = pAddBssParams->sessionId;
-	if (QDF_STATUS_SUCCESS == pAddBssParams->status) {
+	mlmStartCnf.sessionId = pe_session->peSessionId;
+	if (QDF_IS_STATUS_SUCCESS(add_bss_rsp->status)) {
 		pe_debug("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS");
 		/* Set MLME state */
 		pe_session->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
-		pe_session->chainMask = pAddBssParams->chainMask;
-		pe_session->smpsMode = pAddBssParams->smpsMode;
+		pe_session->chainMask = add_bss_rsp->chain_mask;
+		pe_session->smpsMode = add_bss_rsp->smps_mode;
 		MTRACE(mac_trace
 			       (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId,
 			       pe_session->limMlmState));
-		if (eSIR_IBSS_MODE == pAddBssParams->bssType) {
+		if (eSIR_IBSS_MODE == pe_session->bssType) {
 			/** IBSS is 'active' when we receive
 			 * Beacon frames from other STAs that are part of same IBSS.
 			 * Mark internal state as inactive until then.
@@ -2012,11 +1982,11 @@ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac,
 			pe_session->statypeForBss = STA_ENTRY_PEER; /* to know session created for self/peer */
 			limResetHBPktCount(pe_session);
 		}
-		pe_session->bss_idx = (uint8_t)pAddBssParams->bss_idx;
+		pe_session->bss_idx = add_bss_rsp->vdev_id;
 
 		pe_session->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
 
-		if (eSIR_INFRA_AP_MODE == pAddBssParams->bssType)
+		if (eSIR_INFRA_AP_MODE == pe_session->bssType)
 			pe_session->limSystemRole = eLIM_AP_ROLE;
 		else
 			pe_session->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
@@ -2059,55 +2029,29 @@ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac,
 		    && (isWepEnabled))
 			mac->mlme_cfg->sap_cfg.assoc_sta_limit =
 			MAX_SUPPORTED_PEERS_WEP;
-		pe_session->staId = pAddBssParams->staContext.staIdx;
+		pe_session->staId = wma_peer_get_peet_id(pe_session->bssId);
 		mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
 	} else {
 		pe_err("WMA_ADD_BSS_REQ failed with status %d",
-			pAddBssParams->status);
+			add_bss_rsp->status);
 		mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
 	}
 
 	lim_send_start_bss_confirm(mac, &mlmStartCnf);
 }
 
-/**
- * lim_process_ibss_mlm_add_bss_rsp()
- * @mac: Pointer to Global MAC structure
- * @pAddBssParams: Bss params including rsp data
- *
- ***FUNCTION:
- * This function is called to process a WMA_ADD_BSS_RSP from HAL.
- * Upon receipt of this message from HAL, MLME -
- * > Validates the result of WMA_ADD_BSS_REQ
- * > Init other remaining LIM variables
- * > Init the AID pool, for that BSSID
- * > Init the Pre-AUTH list, for that BSSID
- * > Create LIM timers, specific to that BSSID
- * > Init DPH related parameters that are specific to that BSSID
- * > TODO - When do we do the actual change channel?
- *
- ***LOGIC:
- * SME sends eWNI_SME_START_BSS_REQ to LIM
- * LIM sends LIM_MLM_START_REQ to MLME
- * MLME sends WMA_ADD_BSS_REQ to HAL
- * HAL responds with WMA_ADD_BSS_RSP to MLME
- * MLME responds with LIM_MLM_START_CNF to LIM
- * LIM responds with eWNI_SME_START_BSS_RSP to SME
- *
- * @return None
- */
 static void
 lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac,
-				 struct bss_params *pAddBssParams,
+				 struct add_bss_rsp *add_bss_rsp,
 				 struct pe_session *pe_session)
 {
 	tLimMlmStartCnf mlmStartCnf;
 
-	if (!pAddBssParams) {
-		pe_err("Invalid body pointer in message");
+	if (!add_bss_rsp) {
+		pe_err("add_bss_rsp is NULL");
 		return;
 	}
-	if (QDF_STATUS_SUCCESS == pAddBssParams->status) {
+	if (QDF_IS_STATUS_SUCCESS(add_bss_rsp->status)) {
 		pe_debug("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS");
 
 		/* Set MLME state */
@@ -2121,7 +2065,7 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac,
 		 */
 		pe_session->limIbssActive = false;
 		limResetHBPktCount(pe_session);
-		pe_session->bss_idx = (uint8_t)pAddBssParams->bss_idx;
+		pe_session->bss_idx = add_bss_rsp->vdev_id;
 		pe_session->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
 		pe_session->statypeForBss = STA_ENTRY_SELF;
 		sch_edca_profile_update(mac, pe_session);
@@ -2130,17 +2074,19 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac,
 
 		/* Apply previously set configuration at HW */
 		lim_apply_configuration(mac, pe_session);
-		pe_session->staId = pAddBssParams->staContext.staIdx;
+		pe_session->staId =
+			wma_peer_get_peet_id(pe_session->self_mac_addr);
 		mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
 		/* If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM */
 		if (true == mac->lim.gLimIbssCoalescingHappened) {
-			lim_ibss_add_bss_rsp_when_coalescing(mac, pAddBssParams,
-							     pe_session);
+			lim_ibss_add_bss_rsp_when_coalescing(mac,
+						pe_session->curr_op_freq,
+						pe_session);
 			return;
 		}
 	} else {
 		pe_err("WMA_ADD_BSS_REQ failed with status %d",
-			pAddBssParams->status);
+			add_bss_rsp->status);
 		mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
 	}
 	/* Send this message to SME, when ADD_BSS is initiated by SME */
@@ -2185,7 +2131,7 @@ void lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx,
 		pe_err("Invalid body pointer in message");
 		goto joinFailure;
 	}
-	if (QDF_STATUS_SUCCESS == add_bss_params->status) {
+	if (QDF_IS_STATUS_SUCCESS(add_bss_params->status)) {
 		sta = dph_add_hash_entry(mac_ctx,
 				add_bss_params->staContext.staMac,
 				DPH_STA_HASH_INDEX_PEER,
@@ -2256,24 +2202,8 @@ joinFailure:
 
 }
 
-/**
- * lim_process_sta_mlm_add_bss_rsp() - Process ADD BSS response
- * @mac_ctx: Pointer to Global MAC structure
- * @add_bss_params: Bss params including rsp data
- *
- * This function is called to process a WMA_ADD_BSS_RSP from HAL.
- * Upon receipt of this message from HAL, MLME -
- * > Validates the result of WMA_ADD_BSS_REQ
- * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
- *
- * MLME had sent WMA_ADD_BSS_REQ to HAL
- * HAL responded with WMA_ADD_BSS_RSP to MLME
- * MLME now sends WMA_ADD_STA_REQ to HAL
- *
- * Return: None
- */
 static void lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-					    struct bss_params *add_bss_params,
+					    struct add_bss_rsp *add_bss_rsp,
 					    struct pe_session *session_entry)
 {
 	tLimMlmAssocCnf mlm_assoc_cnf;
@@ -2305,13 +2235,13 @@ static void lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 		}
 	}
 
-	if (QDF_STATUS_SUCCESS == add_bss_params->status) {
+	if (QDF_IS_STATUS_SUCCESS(add_bss_rsp->status)) {
 		if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE ==
 			session_entry->limMlmState) {
 			pe_debug("Mlm=%d %d", session_entry->limMlmState,
 				eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);
 			lim_process_sta_mlm_add_bss_rsp_ft(mac_ctx,
-							   add_bss_params,
+							   add_bss_rsp,
 							   session_entry);
 			return;
 		}
@@ -2336,22 +2266,21 @@ static void lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 				(tSirResultCodes) eSIR_SME_REFUSED;
 		} else {
 			session_entry->bss_idx =
-				(uint8_t)add_bss_params->bss_idx;
+				add_bss_rsp->vdev_id;
 			/* Success, handle below */
-			sta_ds->bssId = add_bss_params->bss_idx;
+			sta_ds->bssId = add_bss_rsp->vdev_id;
 			/*
 			 * STA Index(genr by HAL) for the BSS
 			 * entry is stored here
 			*/
-			sta_ds->staIndex = add_bss_params->staContext.staIdx;
+			sta_ds->staIndex =
+				wma_peer_get_peet_id(session_entry->bssId);
 			/* Downgrade the EDCA parameters if needed */
 			lim_set_active_edca_params(mac_ctx,
 				session_entry->gLimEdcaParams, session_entry);
 			lim_send_edca_params(mac_ctx,
 				session_entry->gLimEdcaParamsActive,
 				sta_ds->bssId, false);
-			rrm_cache_mgmt_tx_power(mac_ctx,
-				add_bss_params->txMgmtPower, session_entry);
 			if (lim_add_sta_self(mac_ctx, sta_idx, update_sta,
 				session_entry) != QDF_STATUS_SUCCESS) {
 				/* Add STA context at HW */
@@ -2386,34 +2315,15 @@ static void lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 	}
 }
 
-void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				 struct scheduler_msg *msg)
-{
-	if (!msg) {
-		pe_err("Encountered NULL Pointer");
-		return;
-	}
-	lim_handle_mlm_add_bss_rsp(mac_ctx, msg->bodyptr);
-	msg->bodyptr = NULL;
-}
-
-/*
- *LOGIC: Based on bss type and state, this API will route the message to
- *different functions.
- * 1) eSIR_IBSS_MODE: handled in lim_process_ibss_mlm_add_bss_rsp.
- * 2) eSIR_NDI_MODE: handled in lim_process_ndi_mlm_add_bss_rsp.
- * 3) SAP mode: handled in lim_process_ap_mlm_add_bss_rsp.
- * 4) STA mode: handled in lim_process_sta_mlm_add_bss_rsp.
- */
-void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				struct bss_params *add_bss_param)
+void lim_handle_add_bss_rsp(struct mac_context *mac_ctx,
+			    struct add_bss_rsp *add_bss_rsp)
 {
 	tLimMlmStartCnf mlm_start_cnf;
 	struct pe_session *session_entry;
 	enum bss_type bss_type;
 
-	if (!add_bss_param) {
-		pe_err("Encountered NULL Pointer");
+	if (!add_bss_rsp) {
+		pe_err("add_bss_rspis NULL");
 		return;
 	}
 
@@ -2426,11 +2336,11 @@ void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 	 */
 	SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true);
 	/* Validate SME/LIM/MLME state */
-	session_entry = pe_find_session_by_session_id(mac_ctx,
-			add_bss_param->sessionId);
+	session_entry = pe_find_session_by_sme_session_id(mac_ctx,
+							  add_bss_rsp->vdev_id);
 	if (!session_entry) {
-		pe_err("SessionId:%d Session Doesn't exist",
-			add_bss_param->sessionId);
+		pe_err("vdev id:%d Session Doesn't exist",
+		       add_bss_rsp->vdev_id);
 		goto err;
 	}
 
@@ -2438,12 +2348,10 @@ void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 	/* update PE session Id */
 	mlm_start_cnf.sessionId = session_entry->peSessionId;
 	if (eSIR_IBSS_MODE == bss_type) {
-		lim_process_ibss_mlm_add_bss_rsp(mac_ctx,
-						 add_bss_param,
+		lim_process_ibss_mlm_add_bss_rsp(mac_ctx, add_bss_rsp,
 						 session_entry);
 	} else if (eSIR_NDI_MODE == session_entry->bssType) {
-		lim_process_ndi_mlm_add_bss_rsp(mac_ctx,
-						add_bss_param,
+		lim_process_ndi_mlm_add_bss_rsp(mac_ctx, add_bss_rsp,
 						session_entry);
 	} else {
 		if (eLIM_SME_WT_START_BSS_STATE == session_entry->limSmeState) {
@@ -2459,11 +2367,10 @@ void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 				lim_send_start_bss_confirm(mac_ctx, &mlm_start_cnf);
 			}
 				lim_process_ap_mlm_add_bss_rsp(mac_ctx,
-							       add_bss_param);
+							       add_bss_rsp);
 		} else {
 			/* Called while processing assoc response */
-			lim_process_sta_mlm_add_bss_rsp(mac_ctx,
-							add_bss_param,
+			lim_process_sta_mlm_add_bss_rsp(mac_ctx, add_bss_rsp,
 							session_entry);
 		}
 	}
@@ -2478,11 +2385,7 @@ void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 	}
 #endif
 err:
-	/*
-	 * lim_handle_mlm_add_bss_rsp is entry to handle all types of add
-	 * bss response, only need free bss params buffer here
-	 */
-	qdf_mem_free(add_bss_param);
+	qdf_mem_free(add_bss_rsp);
 }
 
 void lim_process_mlm_update_hidden_ssid_rsp(struct mac_context *mac_ctx,

+ 6 - 19
core/mac/src/pe/lim/lim_types.h

@@ -732,30 +732,17 @@ QDF_STATUS lim_send_tpc_report_frame(struct mac_context *, tpSirMacTpcReqActionF
 #endif
 
 /**
- * lim_process_mlm_add_bss_rsp() - Processes ADD BSS Response
- * @mac_ctx: Pointer to Global MAC structure
- * @msg: The MsgQ header, which contains the response buffer
- *
- * This function is called to process a WMA_ADD_BSS_RSP from HAL.
- * Upon receipt of this message from HAL.
- *
- * Return None
- */
-void lim_process_mlm_add_bss_rsp(struct mac_context *mac,
-				 struct scheduler_msg *limMsgQ);
-
-/**
- * lim_handle_mlm_add_bss_rsp() - Handle add bss response
+ * lim_handle_add_bss_rsp() - Handle add bss response
  * @mac_ctx: mac context
- * @add_bss_param: add bss parameters
+ * @add_bss_rsp: add bss rsp
  *
- * This function is called to handle all types of add bss rsp from HAL.
- * It will free memory of add_bss_param in the end after rsp is handled.
+ * This function is called to handle all types of add bss rsp
+ * It will free memory of add_bss_rsp in the end after rsp is handled.
  *
  * Return: None
  */
-void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				struct bss_params *add_bss_param);
+void lim_handle_add_bss_rsp(struct mac_context *mac_ctx,
+			    struct add_bss_rsp *add_bss_rsp);
 
 void lim_process_mlm_add_sta_rsp(struct mac_context *mac,
 				struct scheduler_msg *limMsgQt,

+ 9 - 8
core/mac/src/pe/nan/nan_datapath.c

@@ -338,26 +338,27 @@ skip_event:
 }
 
 void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				     struct bss_params *add_bss_params,
+				     struct add_bss_rsp *add_bss_rsp,
 				     struct pe_session *session_entry)
 {
 	tLimMlmStartCnf mlm_start_cnf;
 
-	if (!add_bss_params) {
-		pe_err("Invalid body pointer in message");
+	if (!add_bss_rsp) {
+		pe_err("add_bss_rsp is NULL");
 		return;
 	}
-	pe_debug("Status %d", add_bss_params->status);
-	if (QDF_STATUS_SUCCESS == add_bss_params->status) {
+	pe_debug("Status %d", add_bss_rsp->status);
+	if (QDF_IS_STATUS_SUCCESS(add_bss_rsp->status)) {
 		pe_debug("WDA_ADD_BSS_RSP returned QDF_STATUS_SUCCESS");
 		session_entry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
 		MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE,
 			session_entry->peSessionId,
 			session_entry->limMlmState));
-		session_entry->bss_idx = (uint8_t)add_bss_params->bss_idx;
+		session_entry->bss_idx = add_bss_rsp->vdev_id;
 		session_entry->limSystemRole = eLIM_NDI_ROLE;
 		session_entry->statypeForBss = STA_ENTRY_SELF;
-		session_entry->staId = add_bss_params->staContext.staIdx;
+		session_entry->staId =
+			wma_peer_get_peet_id(session_entry->self_mac_addr);
 		/* Apply previously set configuration at HW */
 		lim_apply_configuration(mac_ctx, session_entry);
 		mlm_start_cnf.resultCode = eSIR_SME_SUCCESS;
@@ -366,7 +367,7 @@ void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx,
 		lim_init_peer_idxpool(mac_ctx, session_entry);
 	} else {
 		pe_err("WDA_ADD_BSS_REQ failed with status %d",
-			add_bss_params->status);
+			add_bss_rsp->status);
 		mlm_start_cnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
 	}
 	mlm_start_cnf.sessionId = session_entry->peSessionId;

+ 3 - 3
core/mac/src/pe/nan/nan_datapath.h

@@ -36,13 +36,13 @@ struct peer_nan_datapath_map;
 /**
  * lim_process_ndi_mlm_add_bss_rsp() - Process ADD_BSS response for NDI
  * @mac_ctx: Pointer to Global MAC structure
- * @add_bss_params: Bss params including rsp data
+ * @add_bss_rsp: Bss params including rsp data
  * @session_entry: PE session
  *
  * Return: None
  */
 void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				     struct bss_params *add_bss_params,
+				     struct add_bss_rsp *add_bss_rsp,
 				     struct pe_session *session_entry);
 /* Handler for DEL BSS resp for NDI interface */
 
@@ -78,7 +78,7 @@ void lim_ndp_delete_peers_by_addr_converged(uint8_t vdev_id,
 #else
 static inline
 void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx,
-				     struct bss_params *add_bss_params,
+				     struct add_bss_rsp *add_bss_rsp,
 				     struct pe_session *session_entry)
 {
 }

+ 0 - 1
core/mac/src/sys/legacy/src/utils/src/mac_trace.c

@@ -389,7 +389,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg)
 		CASE_RETURN_STRING(WMA_DELETE_STA_REQ);
 		CASE_RETURN_STRING(WMA_DELETE_STA_RSP);
 		CASE_RETURN_STRING(WMA_ADD_BSS_REQ);
-		CASE_RETURN_STRING(WMA_ADD_BSS_RSP);
 		CASE_RETURN_STRING(WMA_DELETE_BSS_REQ);
 		CASE_RETURN_STRING(WMA_DELETE_BSS_HO_FAIL_REQ);
 		CASE_RETURN_STRING(WMA_DELETE_BSS_RSP);

+ 2 - 0
core/wma/inc/wma.h

@@ -2561,6 +2561,8 @@ QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss);
  */
 void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss);
 
+uint8_t wma_peer_get_peet_id(uint8_t *mac);
+
 #ifdef WLAN_FEATURE_HOST_ROAM
 /**
  * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming

+ 14 - 1
core/wma/inc/wma_if.h

@@ -457,7 +457,6 @@ struct bss_params {
 	tSirMacSSid ssId;
 	uint8_t respReqd;
 	uint8_t sessionId;
-	int8_t txMgmtPower;
 	int8_t maxTxPower;
 
 	uint8_t extSetStaKeyParamValid;
@@ -498,6 +497,20 @@ struct bss_params {
 	bool no_ptk_4_way;
 };
 
+/**
+ * struct add_bss_rsp - params required for add bss response
+ * @vdev_id: vdev_id
+ * @status: QDF status
+ * @chain_mask: chain mask vdev start resp
+ * @smps_mode: smps mode in vdev start resp
+ */
+struct add_bss_rsp {
+	uint8_t vdev_id;
+	QDF_STATUS status;
+	uint32_t chain_mask;
+	uint8_t smps_mode;
+};
+
 /**
  * struct struct del_bss_resp - params required for del bss response
  * @status: QDF status

+ 18 - 5
core/wma/inc/wma_internal.h

@@ -1618,16 +1618,29 @@ QDF_STATUS wma_get_roam_scan_stats(WMA_HANDLE handle,
 				   struct sir_roam_scan_stats *req);
 
 /**
- * wma_remove_peer_on_add_bss_failure() - remove the CDP peers in case of
- *					  ADD BSS request failed
- * @add_bss_params: Pointer to the Add BSS request params
+ * wma_remove_bss_peer_on_vdev_start_failure() - remove the bss peers in case of
+ * vdev start request failure
+ * @wma: wma handle.
+ * @vdev_id: vdev id
  *
- * This API deletes the CDP peer created during ADD BSS in case of ADD BSS
+ * This API deletes the BSS peer created during ADD BSS in case of ADD BSS
  * request sent to the FW fails.
  *
  * Return: None;
  */
-void wma_remove_peer_on_add_bss_failure(struct bss_params *add_bss_params);
+void wma_remove_bss_peer_on_vdev_start_failure(tp_wma_handle wma,
+					       uint8_t vdev_id);
+
+/**
+ * wma_send_add_bss_resp() - send add bss failure
+ * @wma: wma handle.
+ * @vdev_id: vdev id
+ * @status: status
+ *
+ * Return: Success or Failure status
+ */
+void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
+			   QDF_STATUS status);
 
 /**
  * wma_roam_scan_stats_event_handler() - roam scan stats event handler

+ 0 - 1
core/wma/inc/wma_types.h

@@ -119,7 +119,6 @@
 #define WMA_DELETE_STA_REQ             SIR_HAL_DELETE_STA_REQ
 #define WMA_DELETE_STA_RSP             SIR_HAL_DELETE_STA_RSP
 #define WMA_ADD_BSS_REQ                SIR_HAL_ADD_BSS_REQ
-#define WMA_ADD_BSS_RSP                SIR_HAL_ADD_BSS_RSP
 #define WMA_DELETE_BSS_REQ             SIR_HAL_DELETE_BSS_REQ
 #define WMA_DELETE_BSS_HO_FAIL_REQ     SIR_HAL_DELETE_BSS_HO_FAIL_REQ
 #define WMA_DELETE_BSS_RSP             SIR_HAL_DELETE_BSS_RSP

+ 94 - 103
core/wma/src/wma_dev_if.c

@@ -166,7 +166,6 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	struct cdp_vdev *vdev;
 	struct wma_vdev_start_req req;
 	void *peer = NULL;
-	struct wlan_objmgr_vdev *vdev_obj;
 	uint8_t vdev_id, peer_id;
 	QDF_STATUS status;
 	tSetBssKeyParams key_info;
@@ -218,13 +217,6 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	/* start ibss vdev */
 
 	add_bss->operMode = BSS_OPERATIONAL_MODE_IBSS;
-	vdev_obj = wma->interfaces[vdev_id].vdev;
-	if (!vdev_obj) {
-		wma_err("vdev not found for id: %d", vdev_id);
-		goto send_fail_resp;
-	}
-	mlme_set_bss_params(vdev_obj, add_bss);
-
 	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
 
 	/*
@@ -276,10 +268,8 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	WMA_LOGD("%s: ssid = %s", __func__, req.ssid.ssId);
 
 	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS) {
-		mlme_clear_bss_params(vdev_obj);
+	if (status != QDF_STATUS_SUCCESS)
 		goto peer_cleanup;
-	}
 
 	/* Initialize protection mode to no protection */
 	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
@@ -294,8 +284,7 @@ peer_cleanup:
 	if (peer)
 		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
 send_fail_resp:
-	add_bss->status = QDF_STATUS_E_FAILURE;
-	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
+	wma_send_add_bss_resp(wma, add_bss->bss_idx, QDF_STATUS_E_FAILURE);
 }
 
 /**
@@ -1030,68 +1019,80 @@ send_rsp:
  * Return: none
  */
 static void wma_send_start_resp(tp_wma_handle wma,
-				struct bss_params *add_bss,
+				struct add_bss_rsp *add_bss_rsp,
 				struct vdev_start_response *rsp)
 {
 	struct wma_txrx_node *iface = &wma->interfaces[rsp->vdev_id];
 	QDF_STATUS status;
 
 	if (QDF_IS_STATUS_SUCCESS(rsp->status) &&
-	    QDF_IS_STATUS_SUCCESS(add_bss->status)) {
+	    QDF_IS_STATUS_SUCCESS(add_bss_rsp->status)) {
 		status =
 		  wlan_vdev_mlme_sm_deliver_evt(iface->vdev,
 						WLAN_VDEV_SM_EV_START_RESP,
-						sizeof(*add_bss), add_bss);
+						sizeof(*add_bss_rsp),
+						add_bss_rsp);
 		if (QDF_IS_STATUS_SUCCESS(status))
 			return;
 
-		add_bss->status = status;
+		add_bss_rsp->status = status;
 	}
 
 	/* Send vdev stop if vdev start was success */
-	if (QDF_IS_STATUS_ERROR(add_bss->status) &&
+	if (QDF_IS_STATUS_ERROR(add_bss_rsp->status) &&
 	    QDF_IS_STATUS_SUCCESS(rsp->status)) {
 		wlan_vdev_mlme_sm_deliver_evt(iface->vdev,
 					      WLAN_VDEV_SM_EV_DOWN,
-					      sizeof(*add_bss), add_bss);
+					      sizeof(*add_bss_rsp),
+					      add_bss_rsp);
 		return;
 	}
 
-	wma_remove_peer_on_add_bss_failure(add_bss);
+	wma_remove_bss_peer_on_vdev_start_failure(wma, rsp->vdev_id);
 
 	WMA_LOGD(FL("Sending add bss rsp to umac(vdev %d status %d)"),
-		 rsp->vdev_id, add_bss->status);
-	lim_handle_mlm_add_bss_rsp(wma->mac_context, add_bss);
+		 rsp->vdev_id, add_bss_rsp->status);
+	lim_handle_add_bss_rsp(wma->mac_context, add_bss_rsp);
 }
 
 /**
  * wma_vdev_start_rsp() - send vdev start response to upper layer
  * @wma: wma handle
- * @add_bss: add bss params
+ * @vdev: vdev
  * @resp_event: response params
  *
  * Return: none
  */
-static void wma_vdev_start_rsp(tp_wma_handle wma,
-			       struct bss_params *add_bss,
+static void wma_vdev_start_rsp(tp_wma_handle wma, struct wlan_objmgr_vdev *vdev,
 			       struct vdev_start_response *rsp)
 {
 	struct beacon_info *bcn;
+	enum QDF_OPMODE opmode;
+	struct add_bss_rsp *add_bss_rsp;
+
+	opmode = wlan_vdev_mlme_get_opmode(vdev);
+
+	add_bss_rsp = qdf_mem_malloc(sizeof(*add_bss_rsp));
+	if (!add_bss_rsp)
+		return;
+
+	add_bss_rsp->vdev_id = rsp->vdev_id;
+	add_bss_rsp->status = rsp->status;
+	add_bss_rsp->chain_mask = rsp->chain_mask;
+	add_bss_rsp->smps_mode  = host_map_smps_mode(rsp->smps_mode);
 
 #ifdef QCA_IBSS_SUPPORT
 	WMA_LOGD("%s: vdev start response received for %s mode", __func__,
-		 add_bss->operMode ==
-		 BSS_OPERATIONAL_MODE_IBSS ? "IBSS" : "non-IBSS");
+		 opmode == QDF_IBSS_MODE ? "IBSS" : "non-IBSS");
 #endif /* QCA_IBSS_SUPPORT */
 
-	if (rsp->status) {
-		add_bss->status = QDF_STATUS_E_FAILURE;
+	if (rsp->status)
 		goto send_fail_resp;
-	}
 
-	if ((add_bss->operMode == BSS_OPERATIONAL_MODE_AP)
+	if ((opmode == QDF_P2P_GO_MODE) ||
+	    (opmode == QDF_SAP_MODE)
 #ifdef QCA_IBSS_SUPPORT
-	    || (add_bss->operMode == BSS_OPERATIONAL_MODE_IBSS)
+	    || (opmode == QDF_IBSS_MODE)
 #endif /* QCA_IBSS_SUPPORT */
 	    ) {
 		wma->interfaces[rsp->vdev_id].beacon =
@@ -1099,14 +1100,14 @@ static void wma_vdev_start_rsp(tp_wma_handle wma,
 
 		bcn = wma->interfaces[rsp->vdev_id].beacon;
 		if (!bcn) {
-			add_bss->status = QDF_STATUS_E_NOMEM;
+			add_bss_rsp->status = QDF_STATUS_E_NOMEM;
 			goto send_fail_resp;
 		}
 		bcn->buf = qdf_nbuf_alloc(NULL, SIR_MAX_BEACON_SIZE, 0,
 					  sizeof(uint32_t), 0);
 		if (!bcn->buf) {
 			qdf_mem_free(bcn);
-			add_bss->status = QDF_STATUS_E_FAILURE;
+			add_bss_rsp->status = QDF_STATUS_E_FAILURE;
 			goto send_fail_resp;
 		}
 		bcn->seq_no = MIN_SW_SEQ;
@@ -1120,17 +1121,9 @@ static void wma_vdev_start_rsp(tp_wma_handle wma,
 		WMA_LOGD("%s: Allocated beacon struct %pK, template memory %pK",
 			 __func__, bcn, bcn->buf);
 	}
-	add_bss->status = QDF_STATUS_SUCCESS;
-	add_bss->bss_idx = rsp->vdev_id;
-	add_bss->chainMask = rsp->chain_mask;
-	if ((2 != rsp->cfgd_rx_streams) ||
-	    (2 != rsp->cfgd_tx_streams)) {
-		add_bss->nss = 1;
-	}
-	add_bss->smpsMode = host_map_smps_mode(rsp->smps_mode);
 
 send_fail_resp:
-	wma_send_start_resp(wma, add_bss, rsp);
+	wma_send_start_resp(wma, add_bss_rsp, rsp);
 }
 
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
@@ -1272,7 +1265,6 @@ QDF_STATUS wma_vdev_start_resp_handler(struct vdev_mlme_obj *vdev_mlme,
 #endif
 	QDF_STATUS status;
 	enum vdev_assoc_type assoc_type = VDEV_ASSOC;
-	struct bss_params *bss_params;
 	struct vdev_mlme_obj *mlme_obj;
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
@@ -1374,13 +1366,18 @@ QDF_STATUS wma_vdev_start_resp_handler(struct vdev_mlme_obj *vdev_mlme,
 		}
 		ucfg_ocb_config_channel(wma->pdev);
 	} else {
-		/* store it in struct mlme_legacy_priv *mlme_priv */
-		bss_params =
-			mlme_get_bss_params(vdev_mlme->vdev);
+		struct qdf_mac_addr bss_peer;
 
-		qdf_mem_copy(iface->bssid, bss_params->bssId,
+		status =
+			mlme_get_vdev_bss_peer_mac_addr(iface->vdev, &bss_peer);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			WMA_LOGE("%s: Failed to get bssid", __func__);
+			return QDF_STATUS_E_INVAL;
+		}
+
+		qdf_mem_copy(iface->bssid, bss_peer.bytes,
 			     QDF_MAC_ADDR_SIZE);
-		wma_vdev_start_rsp(wma, bss_params, rsp);
+		wma_vdev_start_rsp(wma, vdev_mlme->vdev, rsp);
 	}
 	if (iface->type == WMI_VDEV_TYPE_AP && wma_is_vdev_up(rsp->vdev_id))
 		wma_set_sap_keepalive(wma, rsp->vdev_id);
@@ -3122,22 +3119,9 @@ int wma_peer_assoc_conf_handler(void *handle, uint8_t *cmd_param_info,
 		wma_send_msg_high_priority(wma, WMA_ADD_STA_RSP,
 					   (void *)params, 0);
 	} else if (req_msg->msg_type == WMA_ADD_BSS_REQ) {
-		struct bss_params * params = (struct bss_params *) req_msg->user_data;
-
-		if (!params) {
-			WMA_LOGE(FL("add BSS params is NULL for vdev %d"),
-				 event->vdev_id);
-			status = -EINVAL;
-			goto free_req_msg;
-		}
-
-		/* peer assoc conf event means the cmd succeeds */
-		params->status = QDF_STATUS_SUCCESS;
-		WMA_LOGD(FL("Send ADD BSS RSP: opermode: %d update_bss: %d nw_type: %d bssid: %pM staIdx %d status %d"),
-			params->operMode,
-			params->updateBss, params->nwType, params->bssId,
-			params->staContext.staIdx, params->status);
-		lim_handle_mlm_add_bss_rsp(wma->mac_context, params);
+		WMA_LOGD(FL("Send ADD BSS RSP: vdev_id %d status %d"),
+			 event->vdev_id, QDF_STATUS_SUCCESS);
+		wma_send_add_bss_resp(wma, event->vdev_id, QDF_STATUS_SUCCESS);
 	} else {
 		WMA_LOGE(FL("Unhandled request message type: %d"),
 		req_msg->msg_type);
@@ -3292,16 +3276,17 @@ void wma_hold_req_timer(void *data)
 		wma_send_msg_high_priority(wma, WMA_ADD_STA_RSP,
 					   (void *)params, 0);
 	} else if (tgt_req->msg_type == WMA_ADD_BSS_REQ) {
-		struct bss_params * params = (struct bss_params *) tgt_req->user_data;
 
-		params->status = QDF_STATUS_E_TIMEOUT;
 		WMA_LOGA(FL("WMA_ADD_BSS_REQ timed out"));
-		WMA_LOGD(FL("Sending add bss rsp to umac (mac:%pM, status:%d)"),
-			params->self_mac_addr, params->status);
+		WMA_LOGD(FL("Sending add bss rsp to umac (vdev %d, status:%d)"),
+			 tgt_req->vdev_id, QDF_STATUS_E_TIMEOUT);
+
 		if (wma_crash_on_fw_timeout(wma->fw_timeout_crash))
 			wma_trigger_recovery_assert_on_fw_timeout(
 				WMA_ADD_BSS_REQ);
-		lim_handle_mlm_add_bss_rsp(wma->mac_context, params);
+
+		wma_send_add_bss_resp(wma, tgt_req->vdev_id,
+				      QDF_STATUS_E_TIMEOUT);
 	} else if ((tgt_req->msg_type == WMA_DELETE_STA_REQ) &&
 		(tgt_req->type == WMA_DELETE_STA_RSP_START)) {
 		tpDeleteStaParams params =
@@ -3603,7 +3588,6 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	struct cdp_vdev *vdev;
 	struct wma_vdev_start_req req;
 	void *peer;
-	struct wlan_objmgr_vdev *vdev_obj;
 	uint8_t vdev_id, peer_id;
 	QDF_STATUS status;
 	int8_t maxTxPower;
@@ -3611,7 +3595,6 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	struct wma_txrx_node *iface;
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-
 	if (!pdev) {
 		WMA_LOGE("%s: Failed to get pdev", __func__);
 		goto send_fail_resp;
@@ -3644,13 +3627,6 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	}
 
 	iface = &wma->interfaces[vdev_id];
-	vdev_obj = iface->vdev;
-	if (!vdev_obj) {
-		wma_err("vdev not found for id: %d", vdev_id);
-		goto send_fail_resp;
-	}
-	mlme_set_bss_params(vdev_obj, add_bss);
-
 	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
 
 	qdf_mem_zero(&req, sizeof(req));
@@ -3698,10 +3674,8 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	}
 
 	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS) {
-		mlme_clear_bss_params(vdev_obj);
+	if (status != QDF_STATUS_SUCCESS)
 		goto peer_cleanup;
-	}
 
 	wma_vdev_set_bss_params(wma, vdev_id,
 				add_bss->beaconInterval, add_bss->dtimPeriod,
@@ -3714,8 +3688,7 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
 peer_cleanup:
 	wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
 send_fail_resp:
-	add_bss->status = QDF_STATUS_E_FAILURE;
-	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
+	wma_send_add_bss_resp(wma, add_bss->bss_idx, QDF_STATUS_E_FAILURE);
 }
 
 static QDF_STATUS wma_update_iface_params(tp_wma_handle wma,
@@ -3863,17 +3836,28 @@ QDF_STATUS wma_set_cdp_vdev_pause_reason(tp_wma_handle wma, uint8_t vdev_id)
 }
 #endif
 
+void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
+			   QDF_STATUS status)
+{
+	struct add_bss_rsp *add_bss_rsp;
+
+	add_bss_rsp = qdf_mem_malloc(sizeof(*add_bss_rsp));
+	if (!add_bss_rsp)
+		return;
+
+	add_bss_rsp->vdev_id = vdev_id;
+	add_bss_rsp->status = status;
+	lim_handle_add_bss_rsp(wma->mac_context, add_bss_rsp);
+}
 
 #ifdef WLAN_FEATURE_HOST_ROAM
 QDF_STATUS wma_add_bss_lfr2_vdev_start(struct bss_params *add_bss)
 {
 	tp_wma_handle wma;
 	struct wma_vdev_start_req req;
-	struct wlan_objmgr_vdev *vdev_obj;
 	uint8_t vdev_id, peer_id;
 	void *peer = NULL;
 	QDF_STATUS status;
-	struct wma_txrx_node *iface;
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
 	if (!wma) {
@@ -3881,6 +3865,8 @@ QDF_STATUS wma_add_bss_lfr2_vdev_start(struct bss_params *add_bss)
 		return QDF_STATUS_E_INVAL;
 	}
 
+	vdev_id = add_bss->staContext.smesessionId;
+
 	status = wma_update_iface_params(wma, add_bss);
 	if (QDF_IS_STATUS_ERROR(status))
 		goto send_fail_resp;
@@ -3891,15 +3877,6 @@ QDF_STATUS wma_add_bss_lfr2_vdev_start(struct bss_params *add_bss)
 			 add_bss->bssId);
 		goto send_fail_resp;
 	}
-
-	vdev_id = add_bss->staContext.smesessionId;
-	iface = &wma->interfaces[vdev_id];
-	vdev_obj = iface->vdev;
-	if (!vdev_obj) {
-		wma_err("vdev not found for id: %d", vdev_id);
-		goto send_fail_resp;
-	}
-	mlme_set_bss_params(vdev_obj, add_bss);
 	add_bss->staContext.staIdx = peer_id;
 
 	qdf_mem_zero(&req, sizeof(req));
@@ -3936,15 +3913,12 @@ QDF_STATUS wma_add_bss_lfr2_vdev_start(struct bss_params *add_bss)
 	status = wma_vdev_start(wma, &req, false);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		wma_err("failed, status: %d", status);
-		mlme_clear_bss_params(vdev_obj);
 		goto peer_cleanup;
 	}
 
 	status = wma_set_cdp_vdev_pause_reason(wma, vdev_id);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		mlme_clear_bss_params(vdev_obj);
+	if (QDF_IS_STATUS_ERROR(status))
 		goto peer_cleanup;
-	}
 
 	/* ADD_BSS_RESP will be deferred to completion of VDEV_START */
 	return QDF_STATUS_SUCCESS;
@@ -3954,8 +3928,7 @@ peer_cleanup:
 		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
 
 send_fail_resp:
-	add_bss->status = QDF_STATUS_E_FAILURE;
-	lim_handle_mlm_add_bss_rsp(wma->mac_context, add_bss);
+	wma_send_add_bss_resp(wma, vdev_id, QDF_STATUS_E_FAILURE);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -4086,7 +4059,7 @@ send_bss_resp:
 		goto send_resp;
 
 	msg = wma_fill_hold_req(wma, vdev_id, WMA_ADD_BSS_REQ,
-				WMA_PEER_ASSOC_CNF_START, add_bss,
+				WMA_PEER_ASSOC_CNF_START, NULL,
 				WMA_PEER_ASSOC_TIMEOUT);
 	if (!msg) {
 		WMA_LOGE(FL("Failed to allocate request for vdev_id %d"),
@@ -4094,13 +4067,14 @@ send_bss_resp:
 		wma_remove_req(wma, vdev_id, WMA_PEER_ASSOC_CNF_START);
 		goto peer_cleanup;
 	}
+
 	return QDF_STATUS_SUCCESS;
 
 peer_cleanup:
 	if (peer)
 		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
 send_resp:
-	lim_handle_mlm_add_bss_rsp(wma->mac_context, add_bss);
+	wma_send_add_bss_resp(wma, vdev_id, QDF_STATUS_E_FAILURE);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -5545,6 +5519,23 @@ QDF_STATUS wma_set_wlm_latency_level(void *wma_ptr,
 	return ret;
 }
 
+uint8_t wma_peer_get_peet_id(uint8_t *peer_mac)
+{
+	uint8_t peer_id = 0;
+	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	struct cdp_pdev *pdev;
+
+	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	if (!pdev) {
+		WMA_LOGE("%s: Failed to get pdev", __func__);
+		return peer_id;
+	}
+
+	cdp_peer_find_by_addr(soc, pdev, peer_mac, &peer_id);
+
+	return peer_id;
+}
+
 QDF_STATUS wma_add_bss_peer_sta(uint8_t *self_mac, uint8_t *bssid,
 				bool roam_synch)
 {

+ 1 - 0
core/wma/src/wma_main.c

@@ -8462,6 +8462,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 		break;
 	case WMA_ADD_BSS_REQ:
 		wma_add_bss(wma_handle, (struct bss_params *) msg->bodyptr);
+		qdf_mem_free(msg->bodyptr);
 		break;
 	case WMA_ADD_STA_REQ:
 		wma_add_sta(wma_handle, (tpAddStaParams) msg->bodyptr);

+ 2 - 13
core/wma/src/wma_nan_datapath.c

@@ -49,7 +49,6 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	struct cdp_vdev *vdev;
 	struct wma_vdev_start_req req;
 	void *peer = NULL;
-	struct wlan_objmgr_vdev *vdev_obj;
 	uint8_t vdev_id, peer_id;
 	QDF_STATUS status;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
@@ -84,13 +83,6 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
 		goto send_fail_resp;
 	}
 
-	vdev_obj = wma->interfaces[vdev_id].vdev;
-	if (!vdev_obj) {
-		wma_err("vdev not found for id: %d", vdev_id);
-		goto send_fail_resp;
-	}
-	mlme_set_bss_params(vdev_obj, add_bss);
-
 	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
 
 	/*
@@ -107,10 +99,8 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	req.oper_mode = add_bss->operMode;
 
 	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS) {
-		mlme_clear_bss_params(vdev_obj);
+	if (status != QDF_STATUS_SUCCESS)
 		goto send_fail_resp;
-	}
 
 	/* Initialize protection mode to no protection */
 	wma_vdev_set_param(wma->wmi_handle, vdev_id,
@@ -119,8 +109,7 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
 	return;
 
 send_fail_resp:
-	add_bss->status = QDF_STATUS_E_FAILURE;
-	wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
+	wma_send_add_bss_resp(wma, add_bss->bss_idx, QDF_STATUS_E_FAILURE);
 }
 
 /**

+ 27 - 23
core/wma/src/wma_utils.c

@@ -3932,15 +3932,26 @@ QDF_STATUS wma_get_roam_scan_stats(WMA_HANDLE handle,
 	return QDF_STATUS_SUCCESS;
 }
 
-void wma_remove_peer_on_add_bss_failure(struct bss_params *add_bss_params)
+void wma_remove_bss_peer_on_vdev_start_failure(tp_wma_handle wma,
+					       uint8_t vdev_id)
 {
-	tp_wma_handle wma;
 	struct cdp_pdev *pdev;
 	void *peer = NULL;
 	uint8_t peer_id;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	QDF_STATUS status;
+	struct qdf_mac_addr bss_peer;
+	struct wma_txrx_node *iface;
+
+	iface = &wma->interfaces[vdev_id];
+
+	status = mlme_get_vdev_bss_peer_mac_addr(iface->vdev, &bss_peer);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMA_LOGE("%s: Failed to get bssid", __func__);
+		return;
+	}
 
-	WMA_LOGE("%s: ADD BSS failure %d", __func__, add_bss_params->status);
+	WMA_LOGE("%s: ADD BSS failure for vdev %d", __func__, vdev_id);
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	if (!pdev) {
@@ -3948,21 +3959,15 @@ void wma_remove_peer_on_add_bss_failure(struct bss_params *add_bss_params)
 		return;
 	}
 
-	peer = cdp_peer_find_by_addr(soc, pdev, add_bss_params->bssId,
+	peer = cdp_peer_find_by_addr(soc, pdev, bss_peer.bytes,
 				     &peer_id);
 	if (!peer) {
 		WMA_LOGE("%s Failed to find peer %pM",
-			 __func__, add_bss_params->bssId);
+			 __func__, bss_peer.bytes);
 		return;
 	}
 
-	wma = cds_get_context(QDF_MODULE_ID_WMA);
-	if (!wma) {
-		WMA_LOGE("%s wma handle is NULL", __func__);
-		return;
-	}
-	wma_remove_peer(wma, add_bss_params->bssId, add_bss_params->bss_idx,
-			peer, false);
+	wma_remove_peer(wma, bss_peer.bytes, vdev_id, peer, false);
 }
 
 QDF_STATUS wma_sta_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
@@ -4020,11 +4025,11 @@ bool wma_get_channel_switch_in_progress(struct wma_txrx_node *iface)
 }
 
 static QDF_STATUS wma_vdev_send_start_resp(tp_wma_handle wma,
-					   struct bss_params *add_bss)
+					  struct add_bss_rsp *add_bss_rsp)
 {
 	WMA_LOGD(FL("Sending add bss rsp to umac(vdev %d status %d)"),
-		 add_bss->bss_idx, add_bss->status);
-	lim_handle_mlm_add_bss_rsp(wma->mac_context, add_bss);
+		 add_bss_rsp->vdev_id, add_bss_rsp->status);
+	lim_handle_add_bss_rsp(wma->mac_context, add_bss_rsp);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -4048,8 +4053,7 @@ QDF_STATUS wma_sta_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 		lim_process_switch_channel_rsp(wma->mac_context, data);
 		break;
 	case VDEV_FT_REASSOC:
-		wma_send_msg_high_priority(wma, WMA_ADD_BSS_RSP,
-					   data, 0);
+		lim_handle_add_bss_rsp(wma->mac_context, data);
 		break;
 	default:
 		WMA_LOGE(FL("assoc_type %d is invalid"), assoc_type);
@@ -4103,7 +4107,7 @@ QDF_STATUS wma_ap_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 						       vdev_id);
 		ap_mlme_set_hidden_ssid_restart_in_progress(vdev, false);
 	} else {
-		status = wma_vdev_send_start_resp(wma, (struct bss_params *)data);
+		status = wma_vdev_send_start_resp(wma, data);
 	}
 
 	return status;
@@ -4190,7 +4194,7 @@ QDF_STATUS wma_ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
 					    uint16_t data_len, void *data)
 {
 	tp_wma_handle wma;
-	struct bss_params *bss_params = (struct bss_params *)data;
+	struct add_bss_rsp *add_bss_rsp = data;
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
 	if (!wma) {
@@ -4198,13 +4202,13 @@ QDF_STATUS wma_ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	if (wma_send_vdev_stop_to_fw(wma, bss_params->bss_idx))
+	if (wma_send_vdev_stop_to_fw(wma, add_bss_rsp->vdev_id))
 		WMA_LOGE(FL("Failed to send vdev stop for vdev id %d"),
-			 bss_params->bss_idx);
+			 add_bss_rsp->vdev_id);
 
-	wma_remove_peer_on_add_bss_failure(bss_params);
+	wma_remove_bss_peer_on_vdev_start_failure(wma, add_bss_rsp->vdev_id);
 
-	return wma_vdev_send_start_resp(wma, bss_params);
+	return wma_vdev_send_start_resp(wma, add_bss_rsp);
 }
 
 QDF_STATUS wma_mon_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,