浏览代码

qcacld-3.0: Refactor ap vdev start

1. When AP/IBSS/NAN vdev start, fill parameters into
vdev mlme directly.
2. LIM call wma API directly instead of post msg.
3. Add pre/post vdev start handlers
4. Remove following functions:
	wma_add_bss
	wma_add_bss_ap_mode
	wma_add_bss_ibss_mode
	wma_add_bss_ndi_mode
	mlm_add_sta
5. Add lim_set_ch_phy_mode to set phy mode for all vdev start
cases.

Change-Id: I0dc32e399dc9b49c9bbca16fbc4bd0f44eab284d
CRs-Fixed: 2533714
Jianmin Zhu 5 年之前
父节点
当前提交
58e929c24c

+ 84 - 199
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -40,6 +40,9 @@
 #include "wlan_reg_services_api.h"
 #include "lim_process_fils.h"
 #include "wlan_mlme_public_struct.h"
+#include "../../core/src/vdev_mgr_ops.h"
+#include "wlan_pmo_ucfg_api.h"
+#include "wlan_objmgr_vdev_obj.h"
 
 static void lim_process_mlm_auth_req(struct mac_context *, uint32_t *);
 static void lim_process_mlm_assoc_req(struct mac_context *, uint32_t *);
@@ -163,103 +166,6 @@ void lim_process_mlm_req_messages(struct mac_context *mac_ctx,
 	} /* switch (msg->type) */
 }
 
-/**
- * mlm_add_sta() - MLM add sta
- * @mac_ctx: global MAC context
- * @sta_param: Add sta params
- * @bssid: BSSID
- * @ht_capable: HT capability
- * @session_entry: PE session entry
- *
- * This function is called to update station parameters
- *
- * Return: None
- */
-static void mlm_add_sta(struct mac_context *mac_ctx, tpAddStaParams sta_param,
-		uint8_t *bssid, uint8_t ht_capable, struct pe_session *session_entry)
-{
-	uint32_t val;
-	uint32_t self_dot11mode = mac_ctx->mlme_cfg->dot11_mode.dot11_mode;
-
-	sta_param->staType = STA_ENTRY_SELF; /* Identifying self */
-
-	qdf_mem_copy(sta_param->bssId, bssid, sizeof(tSirMacAddr));
-	qdf_mem_copy(sta_param->staMac, session_entry->self_mac_addr,
-		     sizeof(tSirMacAddr));
-
-	/* Configuration related parameters to be changed to support BT-AMP */
-
-	val = mac_ctx->mlme_cfg->sap_cfg.listen_interval;
-	sta_param->listenInterval = (uint16_t) val;
-
-	sta_param->assocId = 0;      /* Is SMAC OK with this? */
-	sta_param->wmmEnabled = 0;
-	sta_param->uAPSD = 0;
-	sta_param->maxSPLen = 0;
-	sta_param->maxAmpduSize = 0; /* 0: 8k, 1: 16k,2: 32k,3: 64k, 4:128k */
-
-	/* For Self STA get the LDPC capability from config.ini */
-	sta_param->htLdpcCapable =
-		(session_entry->txLdpcIniFeatureEnabled & 0x01);
-	sta_param->vhtLdpcCapable =
-		((session_entry->txLdpcIniFeatureEnabled >> 1) & 0x01);
-
-	if (IS_DOT11_MODE_HT(session_entry->dot11mode)) {
-		sta_param->htCapable = ht_capable;
-		sta_param->ch_width =
-			lim_get_ht_capability(mac_ctx,
-				eHT_SUPPORTED_CHANNEL_WIDTH_SET, session_entry);
-		sta_param->mimoPS =
-			(tSirMacHTMIMOPowerSaveState)lim_get_ht_capability(
-				mac_ctx, eHT_MIMO_POWER_SAVE, session_entry);
-		sta_param->maxAmpduDensity =
-			lim_get_ht_capability(mac_ctx, eHT_MPDU_DENSITY,
-					      session_entry);
-		sta_param->fShortGI20Mhz =
-			lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_20MHZ,
-					      session_entry);
-		sta_param->fShortGI40Mhz =
-			lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_40MHZ,
-					      session_entry);
-	}
-	if (session_entry->vhtCapability) {
-		sta_param->vhtCapable = true;
-		sta_param->vhtTxBFCapable =
-				session_entry->vht_config.su_beam_formee;
-		sta_param->vhtTxMUBformeeCapable =
-				session_entry->vht_config.mu_beam_formee;
-		sta_param->enable_su_tx_bformer =
-				session_entry->vht_config.su_beam_former;
-	}
-
-	if (lim_is_session_he_capable(session_entry))
-		lim_add_self_he_cap(sta_param, session_entry);
-
-	/*
-	 * Since this is Self-STA, need to populate Self MAX_AMPDU_SIZE
-	 * capabilities
-	 */
-	if (IS_DOT11_MODE_VHT(self_dot11mode)) {
-		sta_param->maxAmpduSize =
-		mac_ctx->mlme_cfg->vht_caps.vht_cap_info.ampdu_len_exponent;
-	}
-	sta_param->enableVhtpAid = session_entry->enableVhtpAid;
-	sta_param->enableAmpduPs = session_entry->enableAmpduPs;
-	sta_param->enableHtSmps = session_entry->enableHtSmps;
-	sta_param->htSmpsconfig = session_entry->htSmpsvalue;
-	sta_param->send_smps_action = session_entry->send_smps_action;
-
-	lim_populate_own_rate_set(mac_ctx, &sta_param->supportedRates, NULL,
-				  false, session_entry, NULL, NULL);
-
-	pe_debug("ChnlWidth: %d, MimoPS: %d, SGI20: %d, SGI40%d",
-		 sta_param->ch_width, sta_param->mimoPS,
-		 sta_param->fShortGI20Mhz, sta_param->fShortGI40Mhz);
-
-	if (QDF_P2P_GO_MODE == session_entry->opmode)
-		sta_param->p2pCapableSta = 1;
-}
-
 /**
  * lim_mlm_add_bss() - HAL interface for WMA_ADD_BSS_REQ
  * @mac_ctx: global MAC context
@@ -274,132 +180,111 @@ tSirResultCodes
 lim_mlm_add_bss(struct mac_context *mac_ctx,
 		tLimMlmStartReq *mlm_start_req, struct pe_session *session)
 {
-	struct scheduler_msg msg_buf = {0};
+	struct vdev_mlme_obj *mlme_obj;
+	struct wlan_channel *des_chan;
+	struct wlan_objmgr_vdev *vdev = session->vdev;
+	uint8_t vdev_id = session->vdev_id;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	struct bss_params *addbss_param = NULL;
-	uint32_t retcode;
-	bool is_ch_dfs = false;
-	uint32_t chan_num;
-
-	/* Package WMA_ADD_BSS_REQ message parameters */
-	addbss_param = qdf_mem_malloc(sizeof(struct bss_params));
-	if (!addbss_param)
-		return eSIR_SME_RESOURCES_UNAVAILABLE;
-
-	/* Fill in struct bss_params members */
-	qdf_mem_copy(addbss_param->bssId, mlm_start_req->bssId,
-		     sizeof(tSirMacAddr));
 
-	/* Fill in struct bss_params self_mac_addr */
-	qdf_mem_copy(addbss_param->self_mac_addr,
-		     session->self_mac_addr, sizeof(tSirMacAddr));
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!mlme_obj) {
+		pe_err("vdev component object is NULL");
+		return eSIR_SME_INVALID_PARAMETERS;
+	}
 
-	addbss_param->shortSlotTimeSupported = session->shortSlotTimeSupported;
-	addbss_param->beaconInterval = mlm_start_req->beaconPeriod;
-	addbss_param->dtimPeriod = mlm_start_req->dtimPeriod;
-	addbss_param->wps_state = mlm_start_req->wps_state;
+	qdf_mem_copy(mlme_obj->mgmt.generic.bssid, mlm_start_req->bssId,
+		     QDF_MAC_ADDR_SIZE);
+	mlme_obj->proto.generic.slot_time = session->shortSlotTimeSupported;
+	mlme_obj->proto.generic.beacon_interval = mlm_start_req->beaconPeriod;
+	mlme_obj->proto.generic.dtim_period = mlm_start_req->dtimPeriod;
 
-	addbss_param->nwType = mlm_start_req->nwType;
-	addbss_param->htCapable = mlm_start_req->htCapable;
-	addbss_param->vhtCapable = session->vhtCapability;
+	mlme_obj->proto.ht_info.allow_ht = mlm_start_req->htCapable;
+	mlme_obj->proto.vht_info.allow_vht = session->vhtCapability;
 	if (lim_is_session_he_capable(session)) {
-		lim_update_bss_he_capable(mac_ctx, addbss_param);
-		lim_decide_he_op(mac_ctx, addbss_param, session);
+		lim_decide_he_op(mac_ctx, &mlme_obj->proto.he_ops_info.he_ops,
+				 session);
 		lim_update_usr_he_cap(mac_ctx, session);
 	}
 
-	addbss_param->ch_width = session->ch_width;
-	addbss_param->chan_freq_seg0 =
-		wlan_reg_chan_to_freq(mac_ctx->pdev,
-				      session->ch_center_freq_seg0);
-	addbss_param->chan_freq_seg1 =
-		wlan_reg_chan_to_freq(mac_ctx->pdev,
-				      session->ch_center_freq_seg1);
-
-	addbss_param->op_chan_freq = mlm_start_req->oper_ch_freq;
-	chan_num = wlan_reg_freq_to_chan(mac_ctx->pdev,
-					 addbss_param->op_chan_freq);
-#ifdef WLAN_FEATURE_11W
-	addbss_param->rmfEnabled = session->limRmfEnabled;
-#endif
-
-	addbss_param->vdev_id = session->smeSessionId;
+	des_chan = vdev->vdev_mlme.des_chan;
+	des_chan->ch_freq = mlm_start_req->oper_ch_freq;
+	des_chan->ch_width = session->ch_width;
+	des_chan->ch_freq_seg1 = session->ch_center_freq_seg0;
+	des_chan->ch_freq_seg2 = session->ch_center_freq_seg1;
+	pe_debug("ch_freq_seg1: %d, ch_freq_seg2: %d",
+		 des_chan->ch_freq_seg1, des_chan->ch_freq_seg2);
 
 	/* Send the SSID to HAL to enable SSID matching for IBSS */
-	addbss_param->ssId.length = mlm_start_req->ssId.length;
-	if (addbss_param->ssId.length > WLAN_SSID_MAX_LEN) {
-		pe_err("Invalid ssid length %d, max length allowed %d",
-		       addbss_param->ssId.length,
-		       WLAN_SSID_MAX_LEN);
-		qdf_mem_free(addbss_param);
-		return eSIR_SME_INVALID_PARAMETERS;
-	}
-	qdf_mem_copy(addbss_param->ssId.ssId,
-		     mlm_start_req->ssId.ssId, addbss_param->ssId.length);
-	addbss_param->bHiddenSSIDEn = mlm_start_req->ssidHidden;
-	pe_debug("TRYING TO HIDE SSID %d", addbss_param->bHiddenSSIDEn);
-	addbss_param->maxTxPower = session->maxTxPower;
-
-	mlm_add_sta(mac_ctx, &addbss_param->staContext,
-		    addbss_param->bssId, addbss_param->htCapable,
-		    session);
+	wlan_vdev_mlme_set_ssid(vdev, mlm_start_req->ssId.ssId,
+				mlm_start_req->ssId.length);
+	mlme_obj->mgmt.ap.hidden_ssid = session->ssidHidden;
+	pe_debug("TRYING TO HIDE SSID %d", mlme_obj->mgmt.ap.hidden_ssid);
+	mlme_obj->mgmt.generic.maxregpower = session->maxTxPower;
+
 	/* Set a new state for MLME */
 	session->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE;
 	MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId,
 			 session->limMlmState));
 
-	/* pass on the session persona to hal */
-	addbss_param->halPersona = session->opmode;
-
-	if (session->ch_width == CH_WIDTH_160MHZ) {
-		is_ch_dfs = true;
-	} else if (session->ch_width == CH_WIDTH_80P80MHZ) {
-		if (wlan_reg_get_channel_state(mac_ctx->pdev, chan_num) ==
-				CHANNEL_STATE_DFS ||
-				wlan_reg_get_channel_state(mac_ctx->pdev,
-					session->ch_center_freq_seg1 -
-					SIR_80MHZ_START_CENTER_CH_DIFF) ==
-				CHANNEL_STATE_DFS)
-			is_ch_dfs = true;
+	status = lim_set_ch_phy_mode(vdev, session->dot11mode);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto send_fail_resp;
+
+	if (session->nss == 2) {
+		mlme_obj->mgmt.chainmask_info.num_rx_chain = 2;
+		mlme_obj->mgmt.chainmask_info.num_tx_chain = 2;
 	} else {
-		if (wlan_reg_get_channel_state(mac_ctx->pdev, chan_num) ==
-				CHANNEL_STATE_DFS)
-			is_ch_dfs = true;
+		mlme_obj->mgmt.chainmask_info.num_rx_chain = 1;
+		mlme_obj->mgmt.chainmask_info.num_tx_chain = 1;
 	}
-
-	addbss_param->bSpectrumMgtEnabled =
-				session->spectrumMgtEnabled || is_ch_dfs;
-	addbss_param->extSetStaKeyParamValid = 0;
-
-	addbss_param->dot11_mode = session->dot11mode;
-	addbss_param->nss = session->nss;
-	addbss_param->cac_duration_ms = mlm_start_req->cac_duration_ms;
-	addbss_param->dfs_regdomain = mlm_start_req->dfs_regdomain;
-	addbss_param->beacon_tx_rate = session->beacon_tx_rate;
+	mlme_obj->mgmt.ap.cac_duration_ms = session->cac_duration_ms;
+	mlme_obj->mgmt.rate_info.bcn_tx_rate = session->beacon_tx_rate;
 	pe_debug("dot11_mode:%d nss value:%d",
-			addbss_param->dot11_mode, addbss_param->nss);
+			session->dot11mode, session->nss);
 
 	if (cds_is_5_mhz_enabled()) {
-		addbss_param->ch_width = CH_WIDTH_5MHZ;
-		addbss_param->staContext.ch_width = CH_WIDTH_5MHZ;
+		mlme_obj->mgmt.rate_info.quarter_rate = 1;
 	} else if (cds_is_10_mhz_enabled()) {
-		addbss_param->ch_width = CH_WIDTH_10MHZ;
-		addbss_param->staContext.ch_width = CH_WIDTH_10MHZ;
+		mlme_obj->mgmt.rate_info.half_rate = 1;
 	}
 
-	msg_buf.type = WMA_ADD_BSS_REQ;
-	msg_buf.reserved = 0;
-	msg_buf.bodyptr = addbss_param;
-	msg_buf.bodyval = 0;
-	MTRACE(mac_trace_msg_tx(mac_ctx, session->peSessionId, msg_buf.type));
-
-	pe_debug("Sending WMA_ADD_BSS_REQ...");
-	retcode = wma_post_ctrl_msg(mac_ctx, &msg_buf);
-	if (QDF_STATUS_SUCCESS != retcode) {
-		pe_err("Posting ADD_BSS_REQ to HAL failed, reason=%X",
-			retcode);
-		qdf_mem_free(addbss_param);
-		return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+	 addbss_param = qdf_mem_malloc(sizeof(struct bss_params));
+	if (!addbss_param) {
+		pe_err("malloc failed");
+		goto send_fail_resp;
 	}
+	addbss_param->vhtCapable = mlm_start_req->htCapable;
+	addbss_param->htCapable = session->vhtCapability;
+	addbss_param->ch_width = session->ch_width;
+	addbss_param->rmfEnabled = session->limRmfEnabled;
+	addbss_param->staContext.fShortGI20Mhz =
+		lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_20MHZ, session);
+	addbss_param->staContext.fShortGI40Mhz =
+		lim_get_ht_capability(mac_ctx, eHT_SHORT_GI_40MHZ, session);
+	status = wma_pre_vdev_start_setup(vdev_id, addbss_param);
+	qdf_mem_free(addbss_param);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto send_fail_resp;
+
+	if (session->wps_state == SAP_WPS_DISABLED)
+		ucfg_pmo_disable_wakeup_event(wma->psoc, vdev_id,
+					      WOW_PROBE_REQ_WPS_IE_EVENT);
+	status = wma_vdev_pre_start(vdev_id, false);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto peer_cleanup;
+	status = vdev_mgr_start_send(mlme_obj, false);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto peer_cleanup;
+	wma_post_vdev_start_setup(vdev_id);
+
+	return eSIR_SME_SUCCESS;
+
+peer_cleanup:
+	wma_remove_bss_peer_on_vdev_start_failure(wma, vdev_id);
+send_fail_resp:
+	wma_send_add_bss_resp(wma, vdev_id, QDF_STATUS_E_FAILURE);
 
 	return eSIR_SME_SUCCESS;
 }

+ 9 - 7
core/mac/src/pe/lim/lim_send_messages.c

@@ -166,9 +166,11 @@ QDF_STATUS lim_send_switch_chnl_params(struct mac_context *mac,
 	pe_debug("ch_freq_seg1: %d, ch_freq_seg2: %d",
 		 des_chan->ch_freq_seg1, des_chan->ch_freq_seg2);
 
-	mlme_obj->mgmt.generic.phy_mode = pe_session->dot11mode;
-	mlme_obj->mgmt.ap.cac_duration_ms = cac_duration_ms;
+	status = lim_set_ch_phy_mode(vdev, pe_session->dot11mode);
+	if (QDF_IS_STATUS_ERROR(status))
+		goto send_resp;
 
+	mlme_obj->mgmt.ap.cac_duration_ms = cac_duration_ms;
 	mlme_obj->proto.generic.beacon_interval = 100;
 	mlme_obj->proto.generic.dtim_period = 1;
 	mlme_obj->mgmt.generic.maxregpower = maxTxPower;
@@ -182,12 +184,12 @@ QDF_STATUS lim_send_switch_chnl_params(struct mac_context *mac,
 		mlme_obj->mgmt.chainmask_info.num_rx_chain = 1;
 		mlme_obj->mgmt.chainmask_info.num_tx_chain = 1;
 	}
-	if (lim_is_session_he_capable(pe_session))
-		mlme_obj->proto.he_ops_info.he_ops = true;
 
-	pe_debug("dot11mode: %d, he_capable: %d nss value: %d",
-		 pe_session->dot11mode, mlme_obj->proto.he_ops_info.he_ops,
-		 pe_session->nss);
+	mlme_obj->proto.ht_info.allow_ht = pe_session->htCapability;
+	mlme_obj->proto.vht_info.allow_vht = pe_session->vhtCapability;
+
+	pe_debug("dot11mode: %d, nss value: %d",
+		 pe_session->dot11mode, pe_session->nss);
 
 	pe_debug("ch width %d, ch id %d, maxTxPower %d",
 		 ch_width, chnlNumber, maxTxPower);

+ 85 - 16
core/mac/src/pe/lim/lim_utils.c

@@ -6784,13 +6784,13 @@ void lim_update_usr_he_cap(struct mac_context *mac_ctx, struct pe_session *sessi
 		he_cap->su_beamformer, he_cap->su_beamformee, he_cap->mu_beamformer);
 }
 
-void lim_decide_he_op(struct mac_context *mac_ctx, struct bss_params *add_bss,
+void lim_decide_he_op(struct mac_context *mac_ctx, uint32_t *mlme_he_ops,
 		      struct pe_session *session)
 {
 	uint32_t val;
 	uint8_t color;
 	struct he_ops_network_endian *he_ops_from_ie;
-	tDot11fIEhe_op *he_ops = &add_bss->he_op;
+	tDot11fIEhe_op he_ops;
 	struct add_ie_params *add_ie = &session->add_ie_params;
 	uint8_t extracted_buff[DOT11F_IE_HE_OP_MAX_LEN + 2];
 	QDF_STATUS status;
@@ -6809,34 +6809,36 @@ void lim_decide_he_op(struct mac_context *mac_ctx, struct bss_params *add_bss,
 					&extracted_buff[HE_OP_OUI_SIZE + 2];
 
 	if (he_ops_from_ie->bss_color) {
-		he_ops->bss_color = he_ops_from_ie->bss_color;
+		he_ops.bss_color = he_ops_from_ie->bss_color;
 	} else {
 		qdf_get_random_bytes(&color, sizeof(color));
 		/* make sure color is within 1-63*/
-		he_ops->bss_color = (color % WNI_CFG_HE_OPS_BSS_COLOR_MAX) + 1;
+		he_ops.bss_color = (color % WNI_CFG_HE_OPS_BSS_COLOR_MAX) + 1;
 	}
-	he_ops->default_pe = he_ops_from_ie->default_pe;
-	he_ops->twt_required = he_ops_from_ie->twt_required;
-	he_ops->txop_rts_threshold = he_ops_from_ie->txop_rts_threshold;
-	he_ops->partial_bss_col = he_ops_from_ie->partial_bss_col;
-	he_ops->bss_col_disabled = he_ops_from_ie->bss_col_disabled;
+	he_ops.default_pe = he_ops_from_ie->default_pe;
+	he_ops.twt_required = he_ops_from_ie->twt_required;
+	he_ops.txop_rts_threshold = he_ops_from_ie->txop_rts_threshold;
+	he_ops.partial_bss_col = he_ops_from_ie->partial_bss_col;
+	he_ops.bss_col_disabled = he_ops_from_ie->bss_col_disabled;
 
 	val = mac_ctx->mlme_cfg->he_caps.he_ops_basic_mcs_nss;
 
-	*((uint16_t *)he_ops->basic_mcs_nss) = (uint16_t)val;
+	*((uint16_t *)he_ops.basic_mcs_nss) = (uint16_t)val;
 
-	qdf_mem_copy(&session->he_op, he_ops, sizeof(*he_ops));
+	qdf_mem_copy(&session->he_op, &he_ops, sizeof(tDot11fIEhe_op));
 
 	pe_debug("HE Op: bss_color: 0x%0x, default_pe_duration: 0x%0x",
-		he_ops->bss_color, he_ops->default_pe);
+		he_ops.bss_color, he_ops.default_pe);
 	pe_debug("He Op: twt_required: 0x%0x, txop_rts_threshold: 0x%0x",
-		 he_ops->twt_required, he_ops->txop_rts_threshold);
+		 he_ops.twt_required, he_ops.txop_rts_threshold);
 	pe_debug("HE Op: partial_bss_color: 0x%0x",
-		 he_ops->partial_bss_col);
+		 he_ops.partial_bss_col);
 	pe_debug("HE Op: BSS color disabled: 0x%0x",
-		he_ops->bss_col_disabled);
+		he_ops.bss_col_disabled);
 	pe_debug("HE Op: Basic MCS NSS: 0x%04x",
-		*((uint16_t *)he_ops->basic_mcs_nss));
+		*((uint16_t *)he_ops.basic_mcs_nss));
+
+	wma_update_vdev_he_ops(mlme_he_ops, &he_ops);
 }
 
 void lim_copy_bss_he_cap(struct pe_session *session,
@@ -8449,3 +8451,70 @@ bool lim_is_sha384_akm(enum ani_akm_type akm)
 		return false;
 	}
 }
+
+QDF_STATUS lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode)
+{
+	struct vdev_mlme_obj *mlme_obj;
+	struct wlan_channel *des_chan;
+	uint32_t chan_mode;
+	enum phy_ch_width ch_width;
+	struct mac_context *mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	uint16_t bw_val;
+
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!mlme_obj) {
+		wma_err("vdev component object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	des_chan = vdev->vdev_mlme.des_chan;
+	des_chan->ch_ieee = wlan_reg_freq_to_chan(mac_ctx->pdev,
+						  des_chan->ch_freq);
+	des_chan->ch_cfreq1 = des_chan->ch_freq;
+	ch_width = des_chan->ch_width;
+	bw_val = wlan_reg_get_bw_value(ch_width);
+	if (bw_val > 20) {
+		if (des_chan->ch_freq_seg1) {
+			des_chan->ch_cfreq1 =
+				wlan_chan_to_freq(des_chan->ch_freq_seg1);
+		} else {
+			pe_err("Invalid cntr_freq for bw %d, drop to 20",
+			       bw_val);
+			ch_width = CH_WIDTH_20MHZ;
+			bw_val = 20;
+		}
+	}
+	if (bw_val > 80) {
+		if (des_chan->ch_freq_seg2) {
+			des_chan->ch_cfreq2 =
+				wlan_chan_to_freq(des_chan->ch_freq_seg2);
+		} else {
+			pe_err("Invalid cntr_freq for bw %d, drop to 80",
+			       bw_val);
+			des_chan->ch_cfreq2 = 0;
+			ch_width = CH_WIDTH_80MHZ;
+		}
+	} else {
+		des_chan->ch_cfreq2 = 0;
+	}
+	chan_mode = wma_chan_phy_mode(des_chan->ch_freq, ch_width,
+				      dot11mode);
+
+	if (chan_mode == MODE_UNKNOWN) {
+		pe_err("Invalid phy mode!");
+		return QDF_STATUS_E_FAILURE;
+	}
+	if (!des_chan->ch_cfreq1) {
+		pe_err("Invalid center freq1");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if ((ch_width == CH_WIDTH_160MHZ ||
+	     ch_width == CH_WIDTH_80P80MHZ) && !des_chan->ch_cfreq2) {
+		pe_err("Invalid center freq2 for 160MHz");
+		return QDF_STATUS_E_FAILURE;
+	}
+	mlme_obj->mgmt.generic.phy_mode = chan_mode;
+	des_chan->ch_phymode = chan_mode;
+
+	return QDF_STATUS_SUCCESS;
+}

+ 13 - 4
core/mac/src/pe/lim/lim_utils.h

@@ -1085,14 +1085,14 @@ void lim_update_usr_he_cap(struct mac_context *mac_ctx, struct pe_session *sessi
 /**
  * lim_decide_he_op() - Determine HE operation elements
  * @mac_ctx: global mac context
- * @he_ops: pointer to HE operation IE
+ * @he_ops: mlme he ops
  * @session: PE session entry
  *
  * Parse the HE Operation IE and populate the fields to be
  * sent to FW as part of add bss.
  */
-void lim_decide_he_op(struct mac_context *mac_ctx, struct bss_params *add_bss,
-		struct pe_session *session);
+void lim_decide_he_op(struct mac_context *mac_ctx, uint32_t *mlme_he_ops,
+		      struct pe_session *session);
 
 /**
  * lim_update_sta_he_capable(): Update he_capable in add sta params
@@ -1244,7 +1244,7 @@ static inline void lim_update_usr_he_cap(struct mac_context *mac_ctx,
 }
 
 static inline void lim_decide_he_op(struct mac_context *mac_ctx,
-			struct bss_params *add_bss, struct pe_session *session)
+			uint32_t *mlme_he_ops, struct pe_session *session)
 {
 }
 
@@ -1800,4 +1800,13 @@ void lim_flush_bssid(struct mac_context *mac_ctx, uint8_t *bssid);
  */
 bool lim_is_sha384_akm(enum ani_akm_type akm);
 
+/**
+ * lim_set_ch_phy_mode() - set channel phy mode
+ * @vdev: pointer to vdev
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode);
+
 #endif /* __LIM_UTILS_H */

+ 47 - 10
core/wma/inc/wma.h

@@ -2612,14 +2612,6 @@ QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss);
 QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
 				uint32_t *chainmask_5g);
 
-/**
- * wma_set_channel() - API to set or switch channel
- * @req: channel switch request
- *
- * Return: None
- */
-void wma_set_channel(struct wma_vdev_start_req *req);
-
 /**
  * wma_handle_channel_switch_resp() - handle channel switch resp
  * @wma: wma handle
@@ -2639,7 +2631,7 @@ QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
 QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id);
 
 /**
- * wma_pre_chan_switch_setup() - handler after channel switch vdev start
+ * wma_post_chan_switch_setup() - handler after channel switch vdev start
  * @vdev_id: vdev id
  *
  * Return: QDF_STATUS
@@ -2647,11 +2639,56 @@ QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id);
 QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id);
 
 /**
- * wma_pre_chan_switch_setup() - handler vdev start
+ * wma_vdev_pre_start() - prepare vdev start
  * @vdev_id: vdev id
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart);
 
+/**
+ * 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 BSS peer created during ADD BSS in case of ADD BSS
+ * request sent to the FW fails.
+ *
+ * Return: None;
+ */
+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: None
+ */
+void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
+			   QDF_STATUS status);
+
+/**
+ * wma_post_vdev_start_setup() - wma post vdev start handler
+ * @wma: wma handle.
+ * @vdev_id: vdev id
+ *
+ * Return: Success or Failure status
+ */
+QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id);
+
+/**
+ * wma_pre_vdev_start_setup() - wma pre vdev start handler
+ * @wma: wma handle.
+ * @vdev_id: vdev id
+ * @addbss_param: bss param
+ *
+ * Return: Success or Failure status
+ */
+QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id,
+				    struct bss_params *add_bss);
+
 #endif

+ 10 - 10
core/wma/inc/wma_he.h

@@ -127,13 +127,12 @@ void wma_populate_peer_he_cap(struct peer_assoc_params *peer,
 
 /**
  * wma_update_vdev_he_ops() - update he ops in vdev start request
- * @req: pointer to vdev start request
- * @add_bss: pointer to ADD BSS params
+ * @he_ops: target he ops
+ * @he_op: source he ops
  *
  * Return: None
  */
-void wma_update_vdev_he_ops(struct wma_vdev_start_req *req,
-		struct bss_params *add_bss);
+void wma_update_vdev_he_ops(uint32_t *he_ops, tDot11fIEhe_op *he_op);
 
 /**
  * wma_copy_vdev_start_he_ops() - copy HE ops from vdev start req to vdev start
@@ -149,12 +148,12 @@ void wma_copy_vdev_start_he_ops(struct vdev_start_params *params,
  * wma_vdev_set_he_bss_params() - set HE OPs in vdev start
  * @wma: pointer to wma handle
  * @vdev_id: VDEV id
- * @req: pointer to vdev start request
+ * @he_info: pointer to he info
  *
  * Return: None
  */
 void wma_vdev_set_he_bss_params(tp_wma_handle wma, uint8_t vdev_id,
-				struct wma_vdev_start_req *req);
+				struct vdev_mlme_he_ops_info *he_info);
 
 /**
  * wma_vdev_set_he_config() - set HE Config in vdev start
@@ -263,8 +262,8 @@ static inline void wma_populate_peer_he_cap(struct peer_assoc_params *peer,
 {
 }
 
-static inline void wma_update_vdev_he_ops(struct wma_vdev_start_req *req,
-			struct bss_params *add_bss)
+static inline
+void wma_update_vdev_he_ops(uint32_t *he_ops, tDot11fIEhe_op *he_op)
 {
 }
 
@@ -279,8 +278,9 @@ static inline  QDF_STATUS wma_update_he_ops_ie(tp_wma_handle wma,
 	return QDF_STATUS_SUCCESS;
 }
 
-static inline void wma_vdev_set_he_bss_params(tp_wma_handle wma,
-				uint8_t vdev_id, struct wma_vdev_start_req *req)
+static inline
+void wma_vdev_set_he_bss_params(tp_wma_handle wma, uint8_t vdev_id,
+				struct vdev_mlme_he_ops_info *he_info)
 {
 }
 

+ 0 - 25
core/wma/inc/wma_internal.h

@@ -1669,31 +1669,6 @@ int wma_twt_en_complete_event_handler(void *handle,
 QDF_STATUS wma_get_roam_scan_stats(WMA_HANDLE handle,
 				   struct sir_roam_scan_stats *req);
 
-/**
- * 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 BSS peer created during ADD BSS in case of ADD BSS
- * request sent to the FW fails.
- *
- * Return: None;
- */
-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
  * @handle: wma handle

+ 87 - 302
core/wma/src/wma_dev_if.c

@@ -71,7 +71,7 @@
 #include <cdp_txrx_handle.h>
 #include "wlan_pmo_ucfg_api.h"
 #include "wlan_reg_services_api.h"
-
+#include <include/wlan_vdev_mlme.h>
 #include "wma_he.h"
 #include "wlan_roam_debug.h"
 #include "wlan_ocb_ucfg_api.h"
@@ -152,138 +152,6 @@ bool wma_is_vdev_in_ibss_mode(tp_wma_handle wma, uint8_t vdev_id)
 	return false;
 }
 
-/**
- * wma_add_bss_ibss_mode() -  process add bss request in IBSS mode
- * @wma: wma handle
- * @add_bss: add bss parameters
- *
- * Return: none
- */
-static void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
-{
-	struct cdp_pdev *pdev;
-	struct cdp_vdev *vdev;
-	struct wma_vdev_start_req req;
-	void *peer = NULL;
-	uint8_t vdev_id, peer_id;
-	QDF_STATUS status;
-	tSetBssKeyParams key_info;
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	vdev = wma_find_vdev_by_addr(wma, add_bss->self_mac_addr, &vdev_id);
-	if (!vdev) {
-		WMA_LOGE("%s: vdev not found for vdev id %d.",
-			 __func__, vdev_id);
-		goto send_fail_resp;
-	}
-	WMA_LOGD("%s: add_bss->sessionId = %d", __func__, vdev_id);
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-
-	if (!pdev) {
-		WMA_LOGE("%s: Failed to get pdev", __func__);
-		goto send_fail_resp;
-	}
-	wma_set_bss_rate_flags(wma, vdev_id, add_bss);
-
-	/* create ibss bss peer */
-	status = wma_create_peer(wma, pdev, vdev, add_bss->self_mac_addr,
-				 WMI_PEER_TYPE_DEFAULT, vdev_id,
-				 false);
-	if (status != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("%s: Failed to create peer", __func__);
-		goto send_fail_resp;
-	}
-	WMA_LOGA("IBSS BSS peer created with mac %pM",
-		 add_bss->self_mac_addr);
-
-	peer = cdp_peer_find_by_addr(soc, pdev,
-				     add_bss->self_mac_addr,
-				     &peer_id);
-	if (!peer) {
-		WMA_LOGE("%s Failed to find peer %pM", __func__,
-			 add_bss->self_mac_addr);
-		goto send_fail_resp;
-	}
-
-	/* clear leftover ibss keys on bss peer */
-
-	WMA_LOGD("%s: ibss bss key clearing", __func__);
-	qdf_mem_zero(&key_info, sizeof(key_info));
-	key_info.vdev_id = vdev_id;
-	key_info.numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
-	qdf_mem_copy(&wma->ibsskey_info, &key_info, sizeof(tSetBssKeyParams));
-
-	/* start ibss vdev */
-
-	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
-
-	/*
-	 * If IBSS Power Save is supported by firmware
-	 * set the IBSS power save params to firmware.
-	 */
-	if (wmi_service_enabled(wma->wmi_handle,
-				wmi_service_ibss_pwrsave)) {
-		status = wma_set_ibss_pwrsave_params(wma, vdev_id);
-		if (status != QDF_STATUS_SUCCESS) {
-			WMA_LOGE("%s: Failed to Set IBSS Power Save Params to firmware",
-				 __func__);
-			goto peer_cleanup;
-		}
-	}
-
-	qdf_mem_zero(&req, sizeof(req));
-	req.vdev_id = vdev_id;
-	req.op_chan_freq = add_bss->op_chan_freq;
-	req.chan_width = add_bss->ch_width;
-	req.chan_freq_seg0 = add_bss->chan_freq_seg0;
-	req.chan_freq_seg1 = add_bss->chan_freq_seg1;
-	req.vht_capable = add_bss->vhtCapable;
-#if defined WLAN_FEATURE_VOWIF
-	req.max_txpow = add_bss->maxTxPower;
-#else
-	req.max_txpow = 0;
-#endif /* WLAN_FEATURE_VOWIF */
-	req.beacon_intval = add_bss->beaconInterval;
-	req.dtim_period = add_bss->dtimPeriod;
-	req.hidden_ssid = add_bss->bHiddenSSIDEn;
-	req.is_dfs = add_bss->bSpectrumMgtEnabled;
-	req.ssid.length = add_bss->ssId.length;
-	if (req.ssid.length > 0)
-		qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId,
-			     add_bss->ssId.length);
-
-	if (add_bss->nss == 2) {
-		req.preferred_rx_streams = 2;
-		req.preferred_tx_streams = 2;
-	} else {
-		req.preferred_rx_streams = 1;
-		req.preferred_tx_streams = 1;
-	}
-
-	WMA_LOGD("%s: op_chan_freq %d chan_width %d", __func__,
-		 req.op_chan_freq, req.chan_width);
-	WMA_LOGD("%s: ssid = %s", __func__, req.ssid.ssId);
-
-	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS)
-		goto peer_cleanup;
-
-	/* Initialize protection mode to no protection */
-	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
-				    WMI_VDEV_PARAM_PROTECTION_MODE,
-				    IEEE80211_PROT_NONE);
-	if (QDF_IS_STATUS_ERROR(status))
-		WMA_LOGE("Failed to initialize protection mode");
-
-	return;
-
-peer_cleanup:
-	if (peer)
-		wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
-send_fail_resp:
-	wma_send_add_bss_resp(wma, add_bss->vdev_id, QDF_STATUS_E_FAILURE);
-}
-
 /**
  * wma_send_peer_atim_window_len() - send peer atim window length
  * @wma: wma handle
@@ -319,11 +187,6 @@ wma_send_peer_atim_window_len(tp_wma_handle wma, tpAddStaParams add_sta)
 	}
 }
 #else
-static inline
-void wma_add_bss_ibss_mode(tp_wma_handle wma, struct bss_params *add_bss)
-{
-}
-
 static inline void
 wma_send_peer_atim_window_len(tp_wma_handle wma, tpAddStaParams add_sta)
 {
@@ -3083,11 +2946,8 @@ QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart)
 {
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	struct wma_txrx_node *intr = wma->interfaces;
-	struct mac_context *mac_ctx = NULL;
-	uint16_t bw_val;
+	struct mac_context *mac_ctx =  cds_get_context(QDF_MODULE_ID_PE);
 	struct wma_txrx_node *iface = &wma->interfaces[vdev_id];
-	uint32_t chan_mode;
-	enum phy_ch_width ch_width;
 	struct wlan_mlme_nss_chains *ini_cfg;
 	struct vdev_mlme_obj *mlme_obj;
 	struct wlan_objmgr_vdev *vdev = intr[vdev_id].vdev;
@@ -3106,59 +2966,7 @@ QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart)
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
-	if (!mac_ctx) {
-		WMA_LOGE("%s: vdev start failed as mac_ctx is NULL", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	des_chan->ch_cfreq1 = des_chan->ch_freq;
-	ch_width = des_chan->ch_width;
-	bw_val = wlan_reg_get_bw_value(ch_width);
-	if (bw_val > 20) {
-		if (des_chan->ch_freq_seg1) {
-			des_chan->ch_cfreq1 =
-				wlan_chan_to_freq(des_chan->ch_freq_seg1);
-		} else {
-			wma_err("Invalid cntr_freq for bw %d, drop to 20",
-				bw_val);
-			ch_width = CH_WIDTH_20MHZ;
-			bw_val = 20;
-		}
-	}
-	if (bw_val > 80) {
-		if (des_chan->ch_freq_seg2) {
-			des_chan->ch_cfreq2 =
-				wlan_chan_to_freq(des_chan->ch_freq_seg2);
-		} else {
-			wma_err("Invalid cntr_freq for bw %d, drop to 80",
-				bw_val);
-			des_chan->ch_cfreq2 = 0;
-			ch_width = CH_WIDTH_80MHZ;
-		}
-	} else {
-		des_chan->ch_cfreq2 = 0;
-	}
-	chan_mode = wma_chan_phy_mode(des_chan->ch_freq, ch_width,
-				      mlme_obj->mgmt.generic.phy_mode);
-
-	if (chan_mode == MODE_UNKNOWN) {
-		WMA_LOGE("%s: invalid phy mode!", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-	if (!des_chan->ch_cfreq1) {
-		WMA_LOGE("%s: invalid center freq1", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if ((ch_width == CH_WIDTH_160MHZ ||
-	     ch_width == CH_WIDTH_80P80MHZ) && !des_chan->ch_cfreq2) {
-		WMA_LOGE("%s: invalid center freq2 for 160MHz", __func__);
-		return QDF_STATUS_E_FAILURE;
-	}
-	mlme_obj->mgmt.generic.phy_mode = chan_mode;
-
-	intr[vdev_id].chanmode = chan_mode;
+	intr[vdev_id].chanmode = mlme_obj->mgmt.generic.phy_mode;
 	intr[vdev_id].config.gtx_info.gtxRTMask[0] =
 		CFG_TGT_DEFAULT_GTX_HT_MASK;
 	intr[vdev_id].config.gtx_info.gtxRTMask[1] =
@@ -3178,7 +2986,7 @@ QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart)
 	intr[vdev_id].config.gtx_info.gtxBWMask =
 		CFG_TGT_DEFAULT_GTX_BW_MASK;
 	intr[vdev_id].mhz = des_chan->ch_freq;
-	intr[vdev_id].chan_width = ch_width;
+	intr[vdev_id].chan_width = des_chan->ch_width;
 	intr[vdev_id].ch_freq = des_chan->ch_freq;
 
 	/*
@@ -3743,119 +3551,121 @@ wma_set_peer_pmf_status(tp_wma_handle wma, uint8_t *peer_mac,
 }
 #endif /* WLAN_FEATURE_11W */
 
-/**
- * wma_add_bss_ap_mode() - process add bss request in ap mode
- * @wma: wma handle
- * @add_bss: add bss parameters
- *
- * Return: none
- */
-static void wma_add_bss_ap_mode(tp_wma_handle wma, struct bss_params *add_bss)
+QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id,
+				    struct bss_params *add_bss)
 {
 	struct cdp_pdev *pdev;
 	struct cdp_vdev *vdev;
-	struct wma_vdev_start_req req;
 	void *peer;
-	uint8_t vdev_id, peer_id;
+	uint8_t peer_id;
 	QDF_STATUS status;
-	int8_t maxTxPower;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wma_txrx_node *iface;
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+	struct vdev_mlme_obj *mlme_obj;
+	uint8_t *mac_addr;
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	if (!pdev) {
-		WMA_LOGE("%s: Failed to get pdev", __func__);
-		goto send_fail_resp;
+		wma_err("Failed to get pdev");
+		return QDF_STATUS_E_FAILURE;
 	}
+	iface = &wma->interfaces[vdev_id];
 
-	vdev = wma_find_vdev_by_addr(wma, add_bss->bssId, &vdev_id);
-	if (!vdev) {
-		wma_err("Failed to get vdev handle:"QDF_MAC_ADDR_STR,
-			QDF_MAC_ADDR_ARRAY(add_bss->bssId));
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
+	if (!mlme_obj) {
+		wma_err("vdev component object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
 
-		goto send_fail_resp;
+	vdev = iface->handle;
+	if (!vdev) {
+		wma_err("Failed to get vdev handle: %d", vdev_id);
+		return QDF_STATUS_E_FAILURE;
 	}
-	if (SAP_WPS_DISABLED == add_bss->wps_state)
-		ucfg_pmo_disable_wakeup_event(wma->psoc, vdev_id,
-					      WOW_PROBE_REQ_WPS_IE_EVENT);
+
 	wma_set_bss_rate_flags(wma, vdev_id, add_bss);
-	status = wma_create_peer(wma, pdev, vdev, add_bss->bssId,
+	if (wlan_vdev_mlme_get_opmode(iface->vdev) == QDF_NDI_MODE ||
+	    wlan_vdev_mlme_get_opmode(iface->vdev) == QDF_IBSS_MODE)
+		mac_addr = mlme_obj->mgmt.generic.bssid;
+	else
+		mac_addr = wlan_vdev_mlme_get_macaddr(iface->vdev);
+
+	status = wma_create_peer(wma, pdev, vdev, mac_addr,
 				 WMI_PEER_TYPE_DEFAULT, vdev_id, false);
 	if (status != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("%s: Failed to create peer", __func__);
-		goto send_fail_resp;
+		wma_err("Failed to create peer");
+		return status;
 	}
 
-	peer = cdp_peer_find_by_addr(soc, pdev,
-			add_bss->bssId, &peer_id);
+	peer = cdp_peer_find_by_addr(soc, pdev, mac_addr, &peer_id);
 	if (!peer) {
-		WMA_LOGE("%s Failed to find peer %pM", __func__,
-			 add_bss->bssId);
-		goto send_fail_resp;
+		wma_err("Failed to find peer %pM", mac_addr);
+		return QDF_STATUS_E_FAILURE;
 	}
 
-	iface = &wma->interfaces[vdev_id];
-	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
-
-	qdf_mem_zero(&req, sizeof(req));
-	req.vdev_id = vdev_id;
-	req.op_chan_freq = add_bss->op_chan_freq;
-	req.chan_width = add_bss->ch_width;
-	req.dot11_mode = add_bss->dot11_mode;
-
-	if (add_bss->ch_width == CH_WIDTH_10MHZ)
-		req.is_half_rate = 1;
-	else if (add_bss->ch_width == CH_WIDTH_5MHZ)
-		req.is_quarter_rate = 1;
-
-	req.chan_freq_seg0 = add_bss->chan_freq_seg0;
-	req.chan_freq_seg1 = add_bss->chan_freq_seg1;
-	req.vht_capable = add_bss->vhtCapable;
-	wma_update_vdev_he_ops(&req, add_bss);
-
-	req.max_txpow = add_bss->maxTxPower;
-	maxTxPower = add_bss->maxTxPower;
 	iface->rmfEnabled = add_bss->rmfEnabled;
 	if (add_bss->rmfEnabled)
 		wma_set_mgmt_frame_protection(wma);
 
-	req.dot11_mode = add_bss->dot11_mode;
-	req.beacon_intval = add_bss->beaconInterval;
-	req.dtim_period = add_bss->dtimPeriod;
-	req.beacon_tx_rate = add_bss->beacon_tx_rate;
-	req.hidden_ssid = add_bss->bHiddenSSIDEn;
-	req.is_dfs = add_bss->bSpectrumMgtEnabled;
-	req.ssid.length = add_bss->ssId.length;
-	req.cac_duration_ms = add_bss->cac_duration_ms;
-	req.dfs_regdomain = add_bss->dfs_regdomain;
-	if (req.ssid.length > 0)
-		qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId,
-			     add_bss->ssId.length);
-
-	if (add_bss->nss == 2) {
-		req.preferred_rx_streams = 2;
-		req.preferred_tx_streams = 2;
-	} else {
-		req.preferred_rx_streams = 1;
-		req.preferred_tx_streams = 1;
+	if (wlan_vdev_mlme_get_opmode(iface->vdev) == QDF_IBSS_MODE) {
+		tSetBssKeyParams key_info;
+		/* clear leftover ibss keys on bss peer */
+		wma_debug("ibss bss key clearing");
+		qdf_mem_zero(&key_info, sizeof(key_info));
+		key_info.vdev_id = vdev_id;
+		key_info.numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+		qdf_mem_copy(&wma->ibsskey_info, &key_info,
+			     sizeof(tSetBssKeyParams));
+		/*
+		 * If IBSS Power Save is supported by firmware
+		 * set the IBSS power save params to firmware.
+		 */
+		if (wmi_service_enabled(wma->wmi_handle,
+					wmi_service_ibss_pwrsave)) {
+			status = wma_set_ibss_pwrsave_params(wma, vdev_id);
+		}
 	}
+	return status;
+}
 
-	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS)
-		goto peer_cleanup;
+QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id)
+{
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+	struct wma_txrx_node *intr = &wma->interfaces[vdev_id];
+	struct vdev_mlme_obj *mlme_obj;
+	struct wlan_objmgr_vdev *vdev = intr->vdev;
+
+	if (!vdev) {
+		wma_err("vdev is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	if (wlan_vdev_mlme_get_opmode(vdev) == QDF_NDI_MODE ||
+	    wlan_vdev_mlme_get_opmode(vdev) == QDF_IBSS_MODE) {
+		/* Initialize protection mode to no protection */
+		wma_vdev_set_param(wma->wmi_handle, vdev_id,
+				   WMI_VDEV_PARAM_PROTECTION_MODE,
+				   IEEE80211_PROT_NONE);
+		return status;
+	}
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!mlme_obj) {
+		wma_err("vdev component object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	wma_vdev_set_bss_params(wma, vdev_id,
-				add_bss->beaconInterval, add_bss->dtimPeriod,
-				add_bss->shortSlotTimeSupported,
-				add_bss->llbCoexist, maxTxPower);
+				mlme_obj->proto.generic.beacon_interval,
+				mlme_obj->proto.generic.dtim_period,
+				mlme_obj->proto.generic.slot_time,
+				mlme_obj->proto.generic.protection_mode,
+				mlme_obj->mgmt.generic.maxpower);
 
-	wma_vdev_set_he_bss_params(wma, vdev_id, &req);
-	return;
+	wma_vdev_set_he_bss_params(wma, vdev_id,
+				   &mlme_obj->proto.he_ops_info);
 
-peer_cleanup:
-	wma_remove_peer(wma, add_bss->bssId, vdev_id, peer, false);
-send_fail_resp:
-	wma_send_add_bss_resp(wma, add_bss->vdev_id, QDF_STATUS_E_FAILURE);
+	return status;
 }
 
 static QDF_STATUS wma_update_iface_params(tp_wma_handle wma,
@@ -4245,31 +4055,6 @@ send_resp:
 	return QDF_STATUS_SUCCESS;
 }
 
-void wma_add_bss(tp_wma_handle wma, struct bss_params *params)
-{
-	WMA_LOGD("%s: add_bss_param.halPersona = %d",
-		 __func__, params->halPersona);
-
-	switch (params->halPersona) {
-
-	case QDF_SAP_MODE:
-	case QDF_P2P_GO_MODE:
-		wma_add_bss_ap_mode(wma, params);
-		break;
-
-	case QDF_IBSS_MODE:
-		wma_add_bss_ibss_mode(wma, params);
-		break;
-
-	case QDF_NDI_MODE:
-		wma_add_bss_ndi_mode(wma, params);
-		break;
-
-	default:
-		break;
-	}
-}
-
 /**
  * wma_add_sta_req_ap_mode() - process add sta request in ap mode
  * @wma: wma handle

+ 10 - 19
core/wma/src/wma_he.c

@@ -1279,22 +1279,14 @@ void wma_populate_peer_he_cap(struct peer_assoc_params *peer,
 	return;
 }
 
-void wma_update_vdev_he_ops(struct wma_vdev_start_req *req,
-		struct bss_params *add_bss)
+void wma_update_vdev_he_ops(uint32_t *he_ops, tDot11fIEhe_op *he_op)
 {
-	uint32_t he_ops = 0;
-	tDot11fIEhe_op *he_op = &add_bss->he_op;
-
-	req->he_capable = add_bss->he_capable;
-
-	WMI_HEOPS_COLOR_SET(he_ops, he_op->bss_color);
-	WMI_HEOPS_DEFPE_SET(he_ops, he_op->default_pe);
-	WMI_HEOPS_TWT_SET(he_ops, he_op->twt_required);
-	WMI_HEOPS_RTSTHLD_SET(he_ops, he_op->txop_rts_threshold);
-	WMI_HEOPS_PARTBSSCOLOR_SET(he_ops, he_op->partial_bss_col);
-	WMI_HEOPS_BSSCOLORDISABLE_SET(he_ops, he_op->bss_col_disabled);
-
-	req->he_ops = he_ops;
+	WMI_HEOPS_COLOR_SET(*he_ops, he_op->bss_color);
+	WMI_HEOPS_DEFPE_SET(*he_ops, he_op->default_pe);
+	WMI_HEOPS_TWT_SET(*he_ops, he_op->twt_required);
+	WMI_HEOPS_RTSTHLD_SET(*he_ops, he_op->txop_rts_threshold);
+	WMI_HEOPS_PARTBSSCOLOR_SET(*he_ops, he_op->partial_bss_col);
+	WMI_HEOPS_BSSCOLORDISABLE_SET(*he_ops, he_op->bss_col_disabled);
 }
 
 void wma_copy_vdev_start_he_ops(struct vdev_start_params *params,
@@ -1304,15 +1296,14 @@ void wma_copy_vdev_start_he_ops(struct vdev_start_params *params,
 }
 
 void wma_vdev_set_he_bss_params(tp_wma_handle wma, uint8_t vdev_id,
-				struct wma_vdev_start_req *req)
+				struct vdev_mlme_he_ops_info *he_info)
 {
 	QDF_STATUS ret;
 
-	if (!req->he_capable)
+	if (!he_info->he_ops)
 		return;
-
 	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
-			WMI_VDEV_PARAM_HEOPS_0_31, req->he_ops);
+			WMI_VDEV_PARAM_HEOPS_0_31, he_info->he_ops);
 
 	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE(FL("Failed to set HE OPs"));

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

@@ -8460,10 +8460,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 					(tSirUpdateChanList *) msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		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);
 		break;

+ 0 - 77
core/wma/src/wma_nan_datapath.c

@@ -34,83 +34,6 @@
 #include "cdp_txrx_misc.h"
 #include <cdp_txrx_handle.h>
 
-/**
- * wma_add_bss_ndi_mode() - Process BSS creation request while adding NaN
- * Data interface
- * @wma: wma handle
- * @add_bss: Parameters for ADD_BSS command
- *
- * Sends VDEV_START command to firmware
- * Return: None
- */
-void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss)
-{
-	struct cdp_pdev *pdev;
-	struct cdp_vdev *vdev;
-	struct wma_vdev_start_req req;
-	void *peer = NULL;
-	uint8_t vdev_id, peer_id;
-	QDF_STATUS status;
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	WMA_LOGD("%s: enter", __func__);
-	vdev = wma_find_vdev_by_addr(wma, add_bss->bssId, &vdev_id);
-	if (!vdev) {
-		WMA_LOGE("%s: Failed to find vdev", __func__);
-		goto send_fail_resp;
-	}
-	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
-
-	if (!pdev) {
-		WMA_LOGE("%s: Failed to get pdev", __func__);
-		goto send_fail_resp;
-	}
-
-	wma_set_bss_rate_flags(wma, vdev_id, add_bss);
-
-	status = wma_create_peer(wma, pdev, vdev, add_bss->self_mac_addr,
-				 WMI_PEER_TYPE_DEFAULT, vdev_id, false);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		WMA_LOGE("%s: Failed to create peer", __func__);
-		goto send_fail_resp;
-	}
-
-	peer = cdp_peer_find_by_addr(soc, pdev, add_bss->self_mac_addr,
-				     &peer_id);
-	if (!peer) {
-		WMA_LOGE("%s Failed to find peer %pM", __func__,
-			 add_bss->self_mac_addr);
-		goto send_fail_resp;
-	}
-
-	add_bss->staContext.staIdx = cdp_peer_get_local_peer_id(soc, peer);
-
-	/*
-	 * beacon_intval, dtim_period, hidden_ssid, is_dfs, ssid
-	 * will be ignored for NDI device.
-	 */
-	qdf_mem_zero(&req, sizeof(req));
-	req.vdev_id = vdev_id;
-	req.op_chan_freq = add_bss->op_chan_freq;
-	req.chan_freq_seg0 = add_bss->chan_freq_seg0;
-	req.chan_freq_seg1 = add_bss->chan_freq_seg1;
-	req.vht_capable = add_bss->vhtCapable;
-	req.max_txpow = add_bss->maxTxPower;
-
-	status = wma_vdev_start(wma, &req, false);
-	if (status != QDF_STATUS_SUCCESS)
-		goto send_fail_resp;
-
-	/* Initialize protection mode to no protection */
-	wma_vdev_set_param(wma->wmi_handle, vdev_id,
-		WMI_VDEV_PARAM_PROTECTION_MODE, IEEE80211_PROT_NONE);
-
-	return;
-
-send_fail_resp:
-	wma_send_add_bss_resp(wma, add_bss->vdev_id, QDF_STATUS_E_FAILURE);
-}
-
 /**
  * wma_add_sta_ndi_mode() - Process ADD_STA for NaN Data path
  * @wma: wma handle

+ 0 - 8
core/wma/src/wma_nan_datapath.h

@@ -61,8 +61,6 @@ static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
 	tgt_cfg->nan_datapath_enabled = wma_handle->nan_datapath_enabled;
 }
 
-void wma_add_bss_ndi_mode(tp_wma_handle wma, struct bss_params *add_bss);
-
 void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
 					tpDeleteStaParams del_sta);
 
@@ -91,12 +89,6 @@ static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
 	return;
 }
 
-static inline void wma_add_bss_ndi_mode(tp_wma_handle wma,
-					struct bss_params *add_bss)
-{
-	return;
-}
-
 static inline void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
 					tpDeleteStaParams del_sta)
 {