Browse Source

qcacld-3.0: Cleanup SAP flow in CSR

Remove redundant structures in CSR for SAP functionality
and add a new flow to post SAP requests from SAP module to
LIM.

Change-Id: If3339cf138140ea148bbd263960907fb3a01de43
CRs-Fixed: 3123072
Surya Prakash Sivaraj 3 years ago
parent
commit
08bdec292e

+ 14 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -22178,7 +22178,12 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
 	QDF_STATUS status;
 	mac_handle_t mac_handle;
 	struct qdf_mac_addr bssid;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	struct csr_roam_profile roam_profile;
+#else
+	struct channel_change_req *req;
+#endif
 	struct ch_params ch_params = {0};
 	int ret;
 	enum channel_state chan_freq_state;
@@ -22232,10 +22237,13 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
 	}
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	ch_info = &sta_ctx->ch_info;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	roam_profile.ChannelInfo.freq_list = &ch_info->freq;
 	roam_profile.ChannelInfo.numOfChannels = 1;
 	roam_profile.phyMode = ch_info->phy_mode;
 	roam_profile.ch_params.ch_width = ch_width;
+#endif
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(chandef->chan->center_freq) &&
 	    chandef->width == NL80211_CHAN_WIDTH_40 &&
 	    chandef->center_freq1) {
@@ -22246,8 +22254,11 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
 	}
 	hdd_debug("set mon ch:width=%d, freq %d sec_ch_2g_freq=%d",
 		  chandef->width, chandef->chan->center_freq, sec_ch_2g_freq);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	hdd_select_cbmode(adapter, chandef->chan->center_freq, sec_ch_2g_freq,
 			  &roam_profile.ch_params);
+#endif
 	qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
 		     QDF_MAC_ADDR_SIZE);
 
@@ -22273,11 +22284,13 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
 		return qdf_status_to_os_return(status);
 	}
 	adapter->monitor_mode_vdev_up_in_progress = true;
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	status = sme_roam_channel_change_req(mac_handle, bssid,
 					     adapter->vdev_id,
 					     &roam_profile.ch_params,
 					     &roam_profile);
+#endif
 	if (status) {
 		hdd_err_rl("Failed to set sme_RoamChannel for monitor mode status: %d",
 			   status);

+ 9 - 1
core/hdd/src/wlan_hdd_main.c

@@ -8689,7 +8689,10 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
 	struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info;
 	QDF_STATUS status;
 	struct qdf_mac_addr bssid;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	struct csr_roam_profile roam_profile;
+#endif
 	struct ch_params ch_params;
 	enum phy_ch_width max_fw_bw;
 	enum phy_ch_width ch_width;
@@ -8732,12 +8735,15 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
 	}
 
 	hdd_debug("Set monitor mode frequency %d", freq);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	qdf_mem_zero(&roam_profile, sizeof(roam_profile));
 	roam_profile.ChannelInfo.freq_list = &ch_info->freq;
 	roam_profile.ChannelInfo.numOfChannels = 1;
 	roam_profile.phyMode = ch_info->phy_mode;
 	roam_profile.ch_params.ch_width = bandwidth;
 	hdd_select_cbmode(adapter, freq, 0, &roam_profile.ch_params);
+#endif
 	qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
 		     QDF_MAC_ADDR_SIZE);
 
@@ -8766,11 +8772,13 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
 		return qdf_status_to_os_return(status);
 	}
 	adapter->monitor_mode_vdev_up_in_progress = true;
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	status = sme_roam_channel_change_req(hdd_ctx->mac_handle,
 					     bssid, adapter->vdev_id,
 					     &roam_profile.ch_params,
 					     &roam_profile);
+#endif
 	if (status) {
 		hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode",
 			status);

+ 14 - 6
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -332,16 +332,22 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter)
 {
 	QDF_STATUS status;
 	uint32_t roam_id;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	struct csr_roam_profile *roam_profile;
+#endif
 	mac_handle_t mac_handle;
-	uint8_t wmm_mode = 0;
 	struct hdd_context *hdd_ctx;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
+	uint8_t wmm_mode = 0;
 	uint8_t value = 0;
-
+#endif
 	hdd_enter();
-
-	roam_profile = hdd_roam_profile(adapter);
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
+	roam_profile = hdd_roam_profile(adapter);
 
 	status = ucfg_mlme_get_wmm_mode(hdd_ctx->psoc, &wmm_mode);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
@@ -382,6 +388,7 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter)
 	mac_handle = hdd_adapter_get_mac_handle(adapter);
 	status = sme_bss_start(mac_handle, adapter->vdev_id,
 			       roam_profile, &roam_id);
+#endif
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("NDI sme_RoamConnect session %d failed with status %d -> NotConnected",
 			adapter->vdev_id, status);
@@ -391,11 +398,12 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter)
 	} else {
 		hdd_info("sme_RoamConnect issued successfully for NDI");
 	}
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	qdf_mem_free(roam_profile->ChannelInfo.freq_list);
 	roam_profile->ChannelInfo.freq_list = NULL;
 	roam_profile->ChannelInfo.numOfChannels = 0;
-
+#endif
 	hdd_exit();
 
 	return 0;

+ 95 - 1
core/mac/inc/sir_api.h

@@ -688,6 +688,7 @@ struct add_ie_params {
 	uint8_t *probeRespBCNData_buff;
 };
 
+#ifndef SAP_CP_CLEANUP
 /* / Definition for kick starting BSS */
 /* / ---> MAC */
 /**
@@ -732,7 +733,7 @@ struct start_bss_req {
 	uint32_t dfs_regdomain;
 
 };
-
+#endif
 #define GET_IE_LEN_IN_BSS(lenInBss) (lenInBss + sizeof(lenInBss) - \
 			    ((uintptr_t)OFFSET_OF(struct bss_description,\
 						  ieFields)))
@@ -807,6 +808,10 @@ struct start_bss_rsp {
 	uint16_t messageType;   /* eWNI_SME_START_BSS_RSP */
 	uint16_t length;
 	uint8_t sessionId;
+/* To be removed after SAP CSR cleanup changes */
+#ifdef SAP_CP_CLEANUP
+	uint32_t cmd_id;
+#endif
 	tSirResultCodes status_code;
 	enum bss_type bssType;    /* Add new type for WDS mode */
 	uint16_t beaconInterval;        /* Beacon Interval for both type */
@@ -2250,6 +2255,7 @@ typedef struct sSirSmeDfsChannelList {
 	uint8_t channels[SIR_DFS_MAX_20M_SUB_CH];
 } tSirSmeDfsChannelList, *tpSirSmeDfsChannelList;
 
+#ifndef SAP_CP_CLEANUP
 typedef struct sSirChanChangeRequest {
 	uint16_t messageType;
 	uint16_t messageLen;
@@ -2266,6 +2272,7 @@ typedef struct sSirChanChangeRequest {
 	uint32_t cac_duration_ms;
 	uint32_t dfs_regdomain;
 } tSirChanChangeRequest, *tpSirChanChangeRequest;
+#endif
 
 typedef struct sSirChanChangeResponse {
 	uint8_t sessionId;
@@ -5237,4 +5244,91 @@ struct sir_update_session_txq_edca_param {
 	uint8_t vdev_id;
 	tSirMacEdcaParamRecord txq_edca_params;
 };
+
+#ifdef SAP_CP_CLEANUP
+/* struct channel_change_req - Change channel
+ * request for SAP
+ * @vdev_id: vdev id
+ * @target_chan_freq: New channel frequency
+ * @sec_ch_offset: second channel offset
+ * @center_freq_seg0: channel center freq 0
+ * @center_freq_seg1: channel center freq 1
+ * @dot11mode: dot11 mode
+ * @nw_type: nw type
+ * @cac_duration_ms:  cac duration in ms
+ * @dfs_regdomain: dfs regdomain
+ * @opr_rates: operational rates
+ * @ext_rates: extended rates
+ */
+struct channel_change_req {
+	uint8_t vdev_id;
+	uint32_t target_chan_freq;
+	uint8_t sec_ch_offset;
+	enum phy_ch_width ch_width;
+	uint8_t center_freq_seg0;
+	uint8_t center_freq_seg1;
+	uint32_t dot11mode;
+	tSirNwType nw_type;
+	uint32_t cac_duration_ms;
+	uint32_t dfs_regdomain;
+	tSirMacRateSet opr_rates;
+	tSirMacRateSet ext_rates;
+};
+
+/* struct start_bss_config - Start BSS
+ * request configurations
+ * @vdev_id: vdev id
+ * @cmd_id: serialization command id
+ * @ssid: ssid
+ * @dtim_period: dtim period
+ * @hidden_ssid: hidden ssid parameter
+ * @privacy: ssid privacy
+ * @auth_type: authentication type
+ * @rsnie: RSN IE of the AP
+ * @add_ie_params: additional IEs
+ * @oper_ch_freq: operating frequency
+ * @channel_width: channel width
+ * @center_freq_seg0: channel center freq 0
+ * @center_freq_seg1: channel center freq 1
+ * @sec_ch_offset: secondary channel offset
+ * @wps_state: wps config
+ * @dot11mode: dot11 mode
+ * @nw_type: nw type
+ * @opr_rates: operational rates
+ * @ext_rates: extended rates
+ * @beacon_tx_rate: Tx rate for beacon
+ * @cac_duration_ms: cac duration in ms
+ * @dfs_regdomain: dfs regdomain
+ */
+struct start_bss_config {
+	uint8_t vdev_id;
+	uint32_t cmd_id;
+	tSirMacSSid ssid;
+	uint16_t bcn_int;
+	uint32_t dtim_period;
+	uint8_t hidden_ssid;
+
+	uint8_t privacy;
+	tAniAuthType auth_type;
+	tSirRSNie rsn_ie;
+	struct add_ie_params add_ie_params;
+
+	uint32_t oper_ch_freq;
+	uint8_t channel_width;
+	uint8_t center_freq_seg0;
+	uint8_t center_freq_seg1;
+	uint8_t sec_ch_offset;
+
+	uint8_t wps_state;
+	uint8_t dot11mode;
+	tSirNwType nw_type;
+
+	tSirMacRateSet opr_rates;
+	tSirMacRateSet ext_rates;
+	uint16_t beacon_tx_rate;
+	uint32_t cac_duration_ms;
+	uint32_t dfs_regdomain;
+};
+#endif
+
 #endif /* __SIR_API_H */

+ 4 - 0
core/mac/src/pe/include/lim_session.h

@@ -230,7 +230,11 @@ struct pe_session {
 	tLimSystemRole limSystemRole;
 	enum bss_type bssType;
 	tSirNwType nwType;
+#ifndef SAP_CP_CLEANUP
 	struct start_bss_req *pLimStartBssReq; /* handle to start bss req */
+#else
+	struct start_bss_config *lim_start_bss_req;
+#endif
 	struct join_req *lim_join_req;    /* handle to sme join req */
 	struct join_req *pLimReAssocReq; /* handle to sme reassoc req */
 	tpLimMlmJoinReq pLimMlmJoinReq; /* handle to MLM join Req */

+ 23 - 3
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -445,10 +445,17 @@ static bool __lim_process_sme_sys_ready_ind(struct mac_context *mac,
  *
  * Return: None.
  */
+#ifndef SAP_CP_CLEANUP
 static void
 lim_configure_ap_start_bss_session(struct mac_context *mac_ctx,
 				   struct pe_session *session,
 				   struct start_bss_req *sme_start_bss_req)
+#else
+static void
+lim_configure_ap_start_bss_session(struct mac_context *mac_ctx,
+				   struct pe_session *session,
+				   struct start_bss_config *sme_start_bss_req)
+#endif
 {
 	bool sap_uapsd;
 	uint16_t ht_cap = cfg_default(CFG_AP_PROTECTION_MODE);
@@ -759,7 +766,12 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 	uint32_t val = 0;
 	tSirMacChanNum channel_number;
 	tLimMlmStartReq *mlm_start_req = NULL;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	struct start_bss_req *sme_start_bss_req = NULL;
+#else
+	struct start_bss_config *sme_start_bss_req = NULL;
+#endif
 	tSirResultCodes ret_code = eSIR_SME_SUCCESS;
 	uint8_t session_id;
 	struct pe_session *session = NULL;
@@ -8072,7 +8084,12 @@ static void lim_change_channel(
 static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx,
 		uint32_t *msg_buf)
 {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	tpSirChanChangeRequest ch_change_req;
+#else
+	struct channel_change_req *ch_change_req;
+#endif
 	struct pe_session *session_entry;
 	uint8_t session_id;      /* PE session_id */
 	int8_t max_tx_pwr;
@@ -8083,19 +8100,22 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx,
 		pe_err("msg_buf is NULL");
 		return;
 	}
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	ch_change_req = (tpSirChanChangeRequest)msg_buf;
-
+#endif
 	target_freq = ch_change_req->target_chan_freq;
 
 	max_tx_pwr = wlan_reg_get_channel_reg_power_for_freq(
 				mac_ctx->pdev, target_freq);
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	if ((ch_change_req->messageType != eWNI_SME_CHANNEL_CHANGE_REQ) ||
 			(max_tx_pwr == WMA_MAX_TXPOWER_INVALID)) {
 		pe_err("Invalid Request/max_tx_pwr");
 		return;
 	}
-
+#endif
 	session_entry = pe_find_session_by_bssid(mac_ctx,
 			ch_change_req->bssid, &session_id);
 	if (!session_entry) {

+ 9 - 1
core/mac/src/pe/lim/lim_sme_req_utils.c

@@ -275,13 +275,21 @@ lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(struct mac_context *mac_ctx,
 	return true;
 }
 
+#ifndef SAP_CP_CLEANUP
 bool lim_is_sme_start_bss_req_valid(struct mac_context *mac_ctx,
 				    struct start_bss_req *start_bss_req,
 				    enum bss_type bss_type)
+#else
+bool lim_is_sme_start_bss_req_valid(struct mac_context *mac_ctx,
+				    struct start_bss_config *start_bss_req,
+				    enum bss_type bss_type)
+#endif
 {
 	uint8_t i = 0;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	tSirMacRateSet *opr_rates = &start_bss_req->operationalRateSet;
-
+#endif
 	switch (bss_type) {
 	case eSIR_INFRASTRUCTURE_MODE:
 		/**

+ 6 - 1
core/mac/src/pe/lim/lim_sme_req_utils.h

@@ -46,10 +46,15 @@
  * Return: true when received SME_START_BSS_REQ is formatted correctly false
  *         otherwise
  */
+#ifndef SAP_CP_CLEANUP
 bool lim_is_sme_start_bss_req_valid(struct mac_context *mac_ctx,
 				    struct start_bss_req *start_bss_req,
 				    enum bss_type bss_type);
-
+#else
+bool lim_is_sme_start_bss_req_valid(struct mac_context *mac_ctx,
+				    struct start_bss_config *start_bss_req,
+				    enum bss_type bss_type);
+#endif
 uint8_t lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(struct mac_context *,
 							    tpSirRSNie, struct pe_session *);
 

+ 38 - 0
core/sap/src/sap_fsm.c

@@ -1459,7 +1459,10 @@ QDF_STATUS sap_clear_session_param(mac_handle_t mac_handle,
 	mac_ctx->sap.sapCtxList[sapctx->sessionId].sapPersona =
 		QDF_MAX_NO_OF_MODE;
 	sap_clear_global_dfs_param(mac_handle, sapctx);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_free_roam_profile(&sapctx->csr_roamProfile);
+#endif
 	sap_err("Set sapCtxList null for session %d", sapctx->sessionId);
 	qdf_mem_zero(sapctx, sizeof(*sapctx));
 	sapctx->sessionId = WLAN_UMAC_VDEV_ID_MAX;
@@ -1592,7 +1595,10 @@ static QDF_STATUS sap_goto_stopping(struct sap_context *sap_ctx)
 	}
 
 	sap_update_mcs_rate(sap_ctx, false);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_free_roam_profile(&sap_ctx->csr_roamProfile);
+#endif
 	status = sme_roam_stop_bss(MAC_HANDLE(mac_ctx), sap_ctx->sessionId);
 	if (status != QDF_STATUS_SUCCESS) {
 		sap_err("Calling sme_roam_stop_bss status = %d", status);
@@ -2840,11 +2846,17 @@ static void sap_validate_chanmode_and_chwidth(struct mac_context *mac_ctx,
 	if (WLAN_REG_IS_5GHZ_CH_FREQ(sap_ctx->chan_freq) &&
 	    (sap_ctx->phyMode == eCSR_DOT11_MODE_11g ||
 	     sap_ctx->phyMode == eCSR_DOT11_MODE_11g_ONLY)) {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 		sap_ctx->csr_roamProfile.phyMode = eCSR_DOT11_MODE_11a;
+#endif
 		sap_ctx->phyMode = eCSR_DOT11_MODE_11a;
 	} else if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_ctx->chan_freq) &&
 		   (sap_ctx->phyMode == eCSR_DOT11_MODE_11a)) {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 		sap_ctx->csr_roamProfile.phyMode = eCSR_DOT11_MODE_11g;
+#endif
 		sap_ctx->phyMode = eCSR_DOT11_MODE_11g;
 	}
 
@@ -2941,6 +2953,8 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx,
 		  "SAP_INIT", "SAP_STARTING", sap_ctx->phyMode,
 		  sap_ctx->ch_params.ch_width);
 	/* Specify the channel */
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_ctx->csr_roamProfile.ChannelInfo.numOfChannels =
 					1;
 	sap_ctx->csr_roamProfile.ChannelInfo.freq_list =
@@ -2957,6 +2971,7 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx,
 			      !!sap_ctx->csr_roamProfile.cac_duration_ms);
 	sap_ctx->csr_roamProfile.beacon_tx_rate =
 			sap_ctx->beacon_tx_rate;
+#endif
 	sap_debug("notify hostapd about chan freq selection: %d",
 		  sap_ctx->chan_freq);
 	sap_signal_hdd_event(sap_ctx, NULL,
@@ -2970,9 +2985,12 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx,
 
 	sap_debug("session: %d", sap_ctx->sessionId);
 
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	qdf_status = sme_bss_start(mac_handle, sap_ctx->sessionId,
 				   &sap_ctx->csr_roamProfile,
 				   &sap_ctx->csr_roamId);
+#endif
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 		sap_err("Failed to issue sme_roam_connect");
 
@@ -3593,6 +3611,7 @@ QDF_STATUS sap_fsm(struct sap_context *sap_ctx, struct sap_sm_event *sap_event)
 	return qdf_status;
 }
 
+#ifndef SAP_CP_CLEANUP
 eSapStatus
 sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType,
 			  struct csr_roam_profile *profile)
@@ -3745,6 +3764,7 @@ void sap_free_roam_profile(struct csr_roam_profile *profile)
 		profile->pRSNReqIE = NULL;
 	}
 }
+#endif
 
 void sap_sort_mac_list(struct qdf_mac_addr *macList, uint16_t size)
 {
@@ -4577,3 +4597,21 @@ bool sap_is_conc_sap_doing_scc_dfs(mac_handle_t mac_handle,
 
 	return false;
 }
+
+#ifdef SAP_CP_CLEANUP
+/**
+ * sap_build_start_bss_config() - Fill the start bss request for SAP
+ * @sap_bss_cfg: start bss config
+ * @config: sap config
+ *
+ * This function fills the start bss request for SAP
+ *
+ * Return: None
+ */
+void
+sap_build_start_bss_config(struct start_bss_config *sap_bss_cfg,
+			   struct sap_config *config)
+{
+	return;
+}
+#endif

+ 12 - 1
core/sap/src/sap_internal.h

@@ -139,9 +139,12 @@ struct sap_context {
 
 	/* Include the associations MAC addresses */
 	uint8_t self_mac_addr[CDS_MAC_ADDRESS_LEN];
-
+#ifndef SAP_CP_CLEANUP
 	/* Include the SME(CSR) context here */
 	struct csr_roam_profile csr_roamProfile;
+#else
+	struct start_bss_config sap_bss_cfg;
+#endif
 	uint32_t csr_roamId;
 
 	/* SAP event Callback to hdd */
@@ -325,12 +328,14 @@ sap_signal_hdd_event(struct sap_context *sap_ctx,
 
 QDF_STATUS sap_fsm(struct sap_context *sap_ctx, struct sap_sm_event *sap_event);
 
+#ifndef SAP_CP_CLEANUP
 eSapStatus
 sapconvert_to_csr_profile(struct sap_config *config,
 			  eCsrRoamBssType bssType,
 			  struct csr_roam_profile *profile);
 
 void sap_free_roam_profile(struct csr_roam_profile *profile);
+#endif
 
 QDF_STATUS
 sap_is_peer_mac_allowed(struct sap_context *sap_ctx, uint8_t *peerMac);
@@ -503,4 +508,10 @@ bool
 sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context,
 			   qdf_freq_t channel_freq,
 			   ePhyChanBondState bond_state);
+
+#ifdef SAP_CP_CLEANUP
+void
+sap_build_start_bss_config(struct start_bss_config *sap_bss_cfg,
+			   struct sap_config *config);
+#endif
 #endif

+ 51 - 11
core/sap/src/sap_module.c

@@ -306,7 +306,8 @@ QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
 		sap_err("Invalid SAP pointer");
 		return QDF_STATUS_E_FAULT;
 	}
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	/* Now configure the roaming profile links. To SSID and bssid.*/
 	/* We have room for two SSIDs. */
 	sap_ctx->csr_roamProfile.SSIDs.numOfSSIDs = 1;   /* This is true for now. */
@@ -316,9 +317,10 @@ QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
 		sap_ctx->SSIDList[0].ssidHidden;
 
 	sap_ctx->csr_roamProfile.BSSIDs.numOfBSSIDs = 1; /* This is true for now. */
-	sap_ctx->csa_reason = CSA_REASON_UNKNOWN;
 	sap_ctx->csr_roamProfile.BSSIDs.bssid = &sap_ctx->bssid;
 	sap_ctx->csr_roamProfile.csrPersona = mode;
+#endif
+	sap_ctx->csa_reason = CSA_REASON_UNKNOWN;
 	qdf_mem_copy(sap_ctx->self_mac_addr, addr, QDF_MAC_ADDR_SIZE);
 
 	mac = sap_get_mac_context();
@@ -376,7 +378,10 @@ QDF_STATUS sap_deinit_ctx(struct sap_context *sap_ctx)
 		sap_ctx->freq_list = NULL;
 		sap_ctx->num_of_channel = 0;
 	}
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_free_roam_profile(&sap_ctx->csr_roamProfile);
+#endif
 	if (sap_ctx->sessionId != WLAN_UMAC_VDEV_ID_MAX) {
 		/* empty queues/lists/pkts if any */
 		sap_clear_session_param(MAC_HANDLE(mac), sap_ctx,
@@ -534,7 +539,8 @@ wlansap_set_scan_acs_channel_params(struct sap_config *config,
 	psap_ctx->acs_cfg = &config->acs_cfg;
 	psap_ctx->ch_width_orig = config->acs_cfg.ch_width;
 	psap_ctx->sec_ch_freq = config->sec_ch_freq;
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	/*
 	 * Set the BSSID to your "self MAC Addr" read
 	 * the mac address from Configuation ITEM received
@@ -545,6 +551,7 @@ wlansap_set_scan_acs_channel_params(struct sap_config *config,
 	/* Save a copy to SAP context */
 	qdf_mem_copy(psap_ctx->csr_roamProfile.BSSIDs.bssid,
 		config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE);
+#endif
 	qdf_mem_copy(psap_ctx->self_mac_addr,
 		config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE);
 
@@ -757,6 +764,8 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 	sap_ctx->phyMode = config->SapHw_mode;
 	sap_ctx->csa_reason = CSA_REASON_UNKNOWN;
 
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	/* Set the BSSID to your "self MAC Addr" read the mac address
 		from Configuation ITEM received from HDD */
 	sap_ctx->csr_roamProfile.BSSIDs.numOfBSSIDs = 1;
@@ -766,13 +775,13 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 	/* Save a copy to SAP context */
 	qdf_mem_copy(sap_ctx->csr_roamProfile.BSSIDs.bssid,
 		     config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE);
-	qdf_mem_copy(sap_ctx->self_mac_addr,
-		     config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE);
 
 	/* copy the configuration items to csrProfile */
 	sapconvert_to_csr_profile(config, eCSR_BSS_TYPE_INFRA_AP,
 			       &sap_ctx->csr_roamProfile);
-
+#endif
+	qdf_mem_copy(sap_ctx->self_mac_addr,
+		     config->self_macaddr.bytes, QDF_MAC_ADDR_SIZE);
 	/*
 	 * Set the DFS Test Mode setting
 	 * Set beacon channel count before chanel switch
@@ -835,9 +844,11 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 	/* Handle event */
 	qdf_status = sap_fsm(sap_ctx, &sap_event);
 fail:
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	if (QDF_IS_STATUS_ERROR(qdf_status))
 		sap_free_roam_profile(&sap_ctx->csr_roamProfile);
-
+#endif
 	return qdf_status;
 } /* wlansap_start_bss */
 
@@ -1746,6 +1757,24 @@ void wlansap_get_sec_channel(uint8_t sec_ch_offset,
 	}
 }
 
+#ifdef SAP_CP_CLEANUP
+/**
+ * wlansap_fill_channel_change_request() - Fills the channel change request
+ * @sap_ctx: sap context
+ * @req: pointer to change channel request
+ *
+ * This function fills the channel change request for SAP
+ *
+ * Return: None
+ */
+static void
+wlansap_fill_channel_change_request(struct sap_context *sap_ctx,
+				    struct channel_change_req *req)
+{
+	return;
+}
+#endif
+
 QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx,
 					  uint32_t target_chan_freq)
 {
@@ -1780,16 +1809,20 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx,
 	else if (WLAN_REG_IS_24GHZ_CH_FREQ(target_chan_freq) &&
 		 (phy_mode == eCSR_DOT11_MODE_11a))
 		phy_mode = eCSR_DOT11_MODE_11g;
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_ctx->csr_roamProfile.phyMode = phy_mode;
+#endif
 	sap_ctx->phyMode = phy_mode;
 
 	if (!sap_ctx->chan_freq) {
 		sap_err("Invalid channel list");
 		return QDF_STATUS_E_FAULT;
 	}
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_ctx->csr_roamProfile.ChannelInfo.freq_list[0] = target_chan_freq;
-
+#endif
 	/*
 	 * We are getting channel bonding mode from sapDfsInfor structure
 	 * because we've implemented channel width fallback mechanism for DFS
@@ -1806,9 +1839,13 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx,
 	sap_ctx->chan_freq = target_chan_freq;
 	wlansap_get_sec_channel(ch_params->sec_ch_offset, sap_ctx->chan_freq,
 				&sap_ctx->sec_ch_freq);
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_ctx->csr_roamProfile.ch_params = *ch_params;
+#endif
 	sap_dfs_set_current_channel(sap_ctx);
-
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_get_cac_dur_dfs_region(sap_ctx,
 				   &sap_ctx->csr_roamProfile.cac_duration_ms,
 				   &sap_ctx->csr_roamProfile.dfs_regdomain,
@@ -1821,7 +1858,7 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx,
 					     sap_ctx->sessionId,
 					     ch_params,
 					     &sap_ctx->csr_roamProfile);
-
+#endif
 	sap_debug("chan_freq:%d phy_mode %d width:%d offset:%d seg0:%d seg1:%d",
 		  sap_ctx->chan_freq, phy_mode, ch_params->ch_width,
 		  ch_params->sec_ch_offset, ch_params->center_freq_seg0,
@@ -2467,7 +2504,10 @@ QDF_STATUS wlansap_acs_chselect(struct sap_context *sap_context,
 
 	sap_context->acs_cfg = &config->acs_cfg;
 	sap_context->ch_width_orig = config->acs_cfg.ch_width;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	sap_context->csr_roamProfile.phyMode = config->acs_cfg.hw_mode;
+#endif
 	sap_context->phyMode = config->acs_cfg.hw_mode;
 
 	/*

+ 40 - 0
core/sme/inc/csr_api.h

@@ -741,6 +741,32 @@ struct csr_del_sta_params {
 	uint8_t subtype;
 };
 
+#ifdef SAP_CP_CLEANUP
+/* Struct bss_dot11_config - Dot11 parameters for
+ * SAP operation
+ * @vdev_id: vdev id
+ * @privacy: privacy config
+ * @phy_mode: phy mode
+ * @bss_op_ch_freq: operational frequency
+ * @dot11_mode: dot11 mode
+ * @nw_type: network type
+ * @p_band: operating band
+ * @opr_rates: operational rates
+ * @ext_rates: extended rates
+ */
+struct bss_dot11_config {
+	uint8_t vdev_id;
+	uint8_t privacy;
+	eCsrPhyMode phy_mode;
+	uint32_t bss_op_ch_freq;
+	uint8_t dot11_mode;
+	tSirNwType nw_type;
+	enum reg_wifi_band p_band;
+	tSirMacRateSet opr_rates;
+	tSirMacRateSet ext_rates;
+};
+#endif
+
 typedef QDF_STATUS (*csr_roam_complete_cb)(struct wlan_objmgr_psoc *psoc,
 					   uint8_t session_id,
 					   struct csr_roam_info *param,
@@ -956,4 +982,18 @@ void csr_handle_sap_mlo_sta_concurrency(struct wlan_objmgr_vdev *vdev,
  * Return: concurrent frequency
  */
 qdf_freq_t csr_mlme_get_concurrent_operation_freq(void);
+
+#ifdef SAP_CP_CLEANUP
+/*
+ * csr_roam_get_phy_mode_band_for_bss() - CSR API to get phy mode and
+ * band for particular dot11 config
+ * @mac : mac context
+ * @dot11_cfg : pointer to the dot11 config
+ *
+ * Return : Void
+ */
+enum csr_cfgdot11mode
+csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac,
+				   struct bss_dot11_config *dot11_cfg);
+#endif
 #endif

+ 31 - 0
core/sme/inc/csr_internal.h

@@ -82,9 +82,11 @@ enum csr_cfgdot11mode {
 };
 
 enum csr_roam_reason {
+#ifndef SAP_CP_CLEANUP
 	eCsrNoConnection,
 	eCsrStartBss,
 	eCsrStopBss,
+#endif
 	eCsrForcedDisassocSta,
 	eCsrForcedDeauthSta,
 };
@@ -128,6 +130,7 @@ struct bss_config_param {
 	tSirMacCapabilityInfo BssCap;
 };
 
+#ifndef SAP_CP_CLEANUP
 struct csr_roamstart_bssparams {
 	tSirMacSSid ssId;
 
@@ -153,12 +156,26 @@ struct csr_roamstart_bssparams {
 	uint32_t cac_duration_ms;
 	uint32_t dfs_regdomain;
 };
+#else
+/* struct csr_roamstart_bssparams: csr bss parameters
+ * @cb_mode: channel bonding mode
+ * @bcn_int: beacon interval
+ * @update_bcn_int: updated beacon interval
+ */
+struct csr_roamstart_bssparams {
+	ePhyChanBondState cb_mode;
+	uint16_t bcn_int;
+	bool update_bcn_int;
+};
+#endif
 
 struct roam_cmd {
 	uint32_t roamId;
 	enum csr_roam_reason roamReason;
+#ifndef SAP_CP_CLEANUP
 	struct csr_roam_profile roamProfile;
 	bool fReleaseProfile;             /* whether to free roamProfile */
+#endif
 	tSirMacAddr peerMac;
 	enum wlan_reason_code reason;
 };
@@ -548,6 +565,7 @@ QDF_STATUS csr_get_tsm_stats(struct mac_context *mac,
 		void *pContext, uint8_t tid);
 #endif
 
+#ifndef SAP_CP_CLEANUP
 /**
  * csr_roam_channel_change_req() - Post channel change request to LIM
  * @mac: mac context
@@ -565,6 +583,19 @@ QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
 				       uint8_t vdev_id,
 				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile);
+#else
+/**
+ * csr_sap_channel_change_req() - Post channel change request to LIM
+ * @mac : mac context
+ * @req : channel change request
+ *
+ * This API is primarily used to post Channel Change Req for SAP
+ *
+ *  Return: QDF_STATUS
+ */
+QDF_STATUS csr_sap_channel_change_req(struct mac_context *mac,
+				      struct channel_change_req *req);
+#endif
 
 /* Post Beacon Tx Start Indication */
 QDF_STATUS csr_roam_start_beacon_req(struct mac_context *mac,

+ 69 - 2
core/sme/inc/sme_api.h

@@ -546,6 +546,7 @@ tCsrScanResultInfo *sme_scan_result_get_next(mac_handle_t,
 		tScanResultHandle hScanResult);
 QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult);
 
+#ifndef SAP_CP_CLEANUP
 /**
  * sme_bss_start() - A wrapper function to request CSR to inititiate start bss
  * @mac_handle: mac handle
@@ -557,7 +558,7 @@ QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult);
  */
 QDF_STATUS sme_bss_start(mac_handle_t mac_handle, uint8_t vdev_id,
 			 struct csr_roam_profile *profile, uint32_t *roam_id);
-
+#endif
 /**
  * sme_roam_ndi_stop() - API to request stop ndi
  * @mac_handle: Opaque handle to the global MAC context
@@ -1296,6 +1297,7 @@ QDF_STATUS sme_set_auto_shutdown_timer(mac_handle_t mac_handle,
 				       uint32_t timer_value);
 #endif
 
+#ifndef SAP_CP_CLEANUP
 /**
  * sme_roam_channel_change_req() - Channel change to new target channel
  * @mac_handle: handle returned by mac_open
@@ -1313,7 +1315,7 @@ QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 				       uint8_t vdev_id,
 				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile);
-
+#endif
 QDF_STATUS sme_roam_start_beacon_req(mac_handle_t mac_handle,
 				     struct qdf_mac_addr bssid,
 				     uint8_t dfsCacWaitStatus);
@@ -4530,4 +4532,69 @@ QDF_STATUS sme_update_vdev_mac_addr(struct wlan_objmgr_psoc *psoc,
 				    bool update_sta_self_peer, int req_status);
 #endif
 
+#ifdef SAP_CP_CLEANUP
+/**
+ * sme_get_network_params() - SME API to get dot11 config for SAP
+ * functionality
+ *@mac_ctx: mac context
+ *@dot11_cfg : pointer to dot11 config
+ *
+ * Return : QDF_STATUS
+ */
+QDF_STATUS
+sme_get_network_params(struct mac_context *mac_ctx,
+		       struct bss_dot11_config *dot11_cfg);
+
+/**
+ * sme_start_bss() -A wrapper function to request CSR to
+ * inititiate start bss
+ * @mac_handle: mac hancle
+ * @vdev_id: vdev id
+ * @bss_config: pointer to start bss config
+ * @roam_id: pointer to roam id
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_start_bss(mac_handle_t mac_handle, uint8_t vdev_id,
+			 struct start_bss_config *bss_config,
+			 uint32_t *roam_id);
+
+/**
+ * sme_sap_ser_callback() - callback from serialization module
+ * @cmd: serialization command
+ * @reason: reason why serialization module has given this callback
+ *
+ * Serialization module will give callback to SME for why it triggered
+ * the callback
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_sap_ser_callback(struct wlan_serialization_command *cmd,
+				enum wlan_serialization_cb_reason reason);
+
+/**
+ *sme_fill_channel_change_request() - SME API to fill the channel
+ * change request for monitor mode
+ * @mac_handle: mac handle
+ * @req: pointer to change channel request message
+ * @phy_mode: phy mode of the vdev
+ *
+ * Return: QDF_STATUS
+ */
+void
+sme_fill_channel_change_request(mac_handle_t mac_handle,
+				struct channel_change_req *req,
+				eCsrPhyMode phy_mode);
+
+/**
+ * sme_sap_channel_change_req() - SME API to post channel change
+ * request to LIM
+ * @mac_handle: mac handle
+ * @req: pointer to change channel request message
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_sap_channel_change_req(mac_handle_t mac_handle,
+				      struct channel_change_req *req);
+#endif
 #endif /* #if !defined( __SME_API_H ) */

+ 5 - 2
core/sme/inc/sme_nan_datapath.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -28,10 +29,11 @@
 #include "csr_inside_api.h"
 
 #ifdef WLAN_FEATURE_NAN
+#ifndef SAP_CP_CLEANUP
 /* Start NDI BSS */
 QDF_STATUS csr_roam_start_ndi(struct mac_context *mac_ctx, uint32_t session_id,
 			      struct csr_roam_profile *profile);
-
+#endif
 void csr_roam_update_ndp_return_params(struct mac_context *mac_ctx,
 					uint32_t result,
 					uint32_t *roam_status,
@@ -39,6 +41,7 @@ void csr_roam_update_ndp_return_params(struct mac_context *mac_ctx,
 					struct csr_roam_info *roam_info);
 
 #else /* WLAN_FEATURE_NAN */
+#ifndef SAP_CP_CLEANUP
 /* Start NDI BSS */
 static inline QDF_STATUS csr_roam_start_ndi(struct mac_context *mac_ctx,
 					uint32_t session_id,
@@ -46,7 +49,7 @@ static inline QDF_STATUS csr_roam_start_ndi(struct mac_context *mac_ctx,
 {
 	return QDF_STATUS_SUCCESS;
 }
-
+#endif
 static inline void csr_roam_update_ndp_return_params(struct mac_context *mac_ctx,
 					uint32_t result,
 					uint32_t *roam_status,

+ 53 - 0
core/sme/src/common/sme_api.c

@@ -3235,6 +3235,7 @@ eCsrPhyMode sme_get_phy_mode(mac_handle_t mac_handle)
 	return mac->roam.configParam.phyMode;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS sme_bss_start(mac_handle_t mac_handle, uint8_t vdev_id,
 			 struct csr_roam_profile *profile,
 			 uint32_t *roam_id)
@@ -3261,7 +3262,20 @@ QDF_STATUS sme_bss_start(mac_handle_t mac_handle, uint8_t vdev_id,
 
 	return status;
 }
+#else
+QDF_STATUS sme_get_network_params(struct mac_context *mac,
+				  struct bss_dot11_config *dot11_cfg)
+{
+	return QDF_STATUS_SUCCESS;
+}
 
+QDF_STATUS sme_start_bss(mac_handle_t mac_handle, uint8_t vdev_id,
+			 struct start_bss_config *bss_config,
+			 uint32_t *roam_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 /*
  * sme_set_phy_mode() -
  * Changes the PhyMode.
@@ -8491,6 +8505,7 @@ QDF_STATUS sme_set_mas(uint32_t val)
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 				       struct qdf_mac_addr bssid,
 				       uint8_t vdev_id,
@@ -8509,6 +8524,13 @@ QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 	}
 	return status;
 }
+#else
+QDF_STATUS sme_sap_channel_change_req(mac_handle_t mac_handle,
+				      struct channel_change_req *req)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 
 /*
  * sme_process_channel_change_resp() -
@@ -16253,3 +16275,34 @@ void sme_roam_events_deregister_callback(mac_handle_t mac_handle)
 }
 #endif
 
+#ifdef SAP_CP_CLEANUP
+static QDF_STATUS sme_send_start_bss_msg(struct mac_context *mac,
+					 struct start_bss_config *cfg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS sme_send_stop_bss_msg(struct mac_context *mac,
+					uint32_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS sme_sap_activate_cmd(struct wlan_serialization_command *cmd)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS sme_sap_ser_callback(struct wlan_serialization_command *cmd,
+				enum wlan_serialization_cb_reason reason)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+void sme_fill_channel_change_request(mac_handle_t mac_handle,
+				     struct channel_change_req *req,
+				     eCsrPhyMode phy_mode)
+{
+	return;
+}
+#endif

+ 140 - 8
core/sme/src/csr/csr_api_roam.c

@@ -171,9 +171,10 @@ static void init_config_param(struct mac_context *mac);
 static bool csr_roam_process_results(struct mac_context *mac, tSmeCmd *pCommand,
 				     enum csr_roamcomplete_result Result,
 				     void *Context);
-
+#ifndef SAP_CP_CLEANUP
 static void csr_roaming_state_config_cnf_processor(struct mac_context *mac,
 			tSmeCmd *pCommand, uint8_t session_id);
+#endif
 static QDF_STATUS csr_roam_open(struct mac_context *mac);
 static QDF_STATUS csr_roam_close(struct mac_context *mac);
 static QDF_STATUS csr_init11d_info(struct mac_context *mac, tCsr11dinfo *ps11dinfo);
@@ -182,6 +183,7 @@ static QDF_STATUS csr_init_channel_power_list(struct mac_context *mac,
 static QDF_STATUS csr_roam_free_connected_info(struct mac_context *mac,
 					       struct csr_roam_connectedinfo *
 					       pConnectedInfo);
+#ifndef SAP_CP_CLEANUP
 static enum csr_cfgdot11mode
 csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac,
 				   uint8_t vdev_id,
@@ -191,6 +193,7 @@ csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac,
 static QDF_STATUS csr_roam_start_wds(struct mac_context *mac,
 				     uint32_t sessionId,
 				     struct csr_roam_profile *pProfile);
+#endif
 static void csr_init_session(struct mac_context *mac, uint32_t sessionId);
 
 static void csr_init_operating_classes(struct mac_context *mac);
@@ -2532,6 +2535,7 @@ QDF_STATUS csr_roam_issue_deauth_sta_cmd(struct mac_context *mac,
 	return status;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_prepare_bss_config_from_profile(struct mac_context *mac,
 					struct csr_roam_profile *pProfile,
 					uint8_t vdev_id,
@@ -2777,7 +2781,7 @@ static QDF_STATUS csr_start_bss(struct mac_context *mac, tSmeCmd *pCommand)
 
 	return status;
 }
-
+#endif
 /**
  * csr_get_peer_stats_cb - Peer stats callback
  * @ev: stats event
@@ -2899,13 +2903,15 @@ QDF_STATUS csr_roam_process_command(struct mac_context *mac, tSmeCmd *pCommand)
 		pCommand->u.roamCmd.roamReason, sessionId);
 
 	switch (pCommand->u.roamCmd.roamReason) {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	case eCsrStopBss:
 		csr_roam_state_change(mac, eCSR_ROAMING_STATE_JOINING,
 				sessionId);
 		status = csr_roam_issue_stop_bss(mac, sessionId,
 				eCSR_ROAM_SUBSTATE_STOP_BSS_REQ);
 		break;
-
+#endif
 	case eCsrForcedDisassocSta:
 	case eCsrForcedDeauthSta:
 		csr_roam_state_change(mac, eCSR_ROAMING_STATE_JOINING,
@@ -2929,6 +2935,8 @@ QDF_STATUS csr_roam_process_command(struct mac_context *mac, tSmeCmd *pCommand)
 		 */
 		csr_get_peer_stats(mac, sessionId, peer_mac);
 		break;
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	case eCsrStartBss:
 		/* for success case */
 		/* fallthrough */
@@ -2940,16 +2948,20 @@ QDF_STATUS csr_roam_process_command(struct mac_context *mac, tSmeCmd *pCommand)
 			sme_warn("csr_roam() failed with status = 0x%08X",
 				status);
 		break;
+#endif
 	}
 	return status;
 }
 
 void csr_reinit_roam_cmd(struct mac_context *mac, tSmeCmd *pCommand)
 {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	if (pCommand->u.roamCmd.fReleaseProfile) {
 		csr_release_profile(mac, &pCommand->u.roamCmd.roamProfile);
 		pCommand->u.roamCmd.fReleaseProfile = false;
 	}
+#endif
 	/* Because u.roamCmd is union and share with scanCmd and StatusChange */
 	qdf_mem_zero(&pCommand->u.roamCmd, sizeof(struct roam_cmd));
 }
@@ -3033,11 +3045,14 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 	}
 
 	switch (cmd->u.roamCmd.roamReason) {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	case eCsrStopBss:
 		csr_roam_call_callback(mac_ctx, session_id, NULL,
 			cmd->u.roamCmd.roamId, eCSR_ROAM_INFRA_IND,
 			eCSR_ROAM_RESULT_INFRA_STOPPED);
 		break;
+#endif
 	case eCsrForcedDisassocSta:
 	case eCsrForcedDeauthSta:
 		roam_info->rssi = mac_ctx->peer_rssi;
@@ -3250,6 +3265,7 @@ static bool csr_roam_process_results(struct mac_context *mac_ctx, tSmeCmd *cmd,
 	return release_cmd;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_copy_profile(struct mac_context *mac,
 				 struct csr_roam_profile *pDstProfile,
 				 struct csr_roam_profile *pSrcProfile,
@@ -3395,6 +3411,7 @@ QDF_STATUS csr_issue_bss_start(struct mac_context *mac, uint8_t vdev_id,
 
 	return status;
 }
+#endif
 
 static void csr_flush_pending_start_bss_cmd(struct mac_context *mac_ctx,
 					     uint8_t vdev_id)
@@ -3421,6 +3438,7 @@ static void csr_flush_pending_start_bss_cmd(struct mac_context *mac_ctx,
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
 			 struct csr_roam_profile *profile, uint32_t *roam_id)
 {
@@ -3468,6 +3486,7 @@ QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
 
 	return status;
 }
+#endif
 
 bool cm_csr_is_ss_wait_for_key(uint8_t vdev_id)
 {
@@ -3555,6 +3574,7 @@ void cm_csr_set_ss_none(uint8_t vdev_id)
 				 vdev_id);
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_issue_stop_bss_cmd(struct mac_context *mac, uint8_t vdev_id,
 				       eCsrRoamBssType bss_type,
 				       bool high_priority)
@@ -3585,6 +3605,7 @@ QDF_STATUS csr_roam_issue_stop_bss_cmd(struct mac_context *mac, uint8_t vdev_id,
 
 	return status;
 }
+#endif
 
 QDF_STATUS csr_roam_ndi_stop(struct mac_context *mac_ctx, uint8_t vdev_id)
 {
@@ -3626,6 +3647,7 @@ csr_fill_single_pmk(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 {}
 #endif
 
+#ifndef SAP_CP_CLEANUP
 static void
 csr_roaming_state_config_cnf_processor(struct mac_context *mac_ctx,
 				       tSmeCmd *cmd, uint8_t vdev_id)
@@ -3659,6 +3681,7 @@ csr_roaming_state_config_cnf_processor(struct mac_context *mac_ctx,
 		return;
 	}
 }
+#endif
 
 static void csr_roam_roaming_state_stop_bss_rsp_processor(struct mac_context *mac,
 							  tSirSmeRsp *pSmeRsp)
@@ -3675,7 +3698,10 @@ static void csr_roam_roaming_state_stop_bss_rsp_processor(struct mac_context *ma
 			if (pSmeRsp->status_code != eSIR_SME_SUCCESS)
 				result_code = eCsrStopBssFailure;
 		}
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 		csr_roam_complete(mac, result_code, NULL, pSmeRsp->vdev_id);
+#endif
 	}
 }
 
@@ -3726,8 +3752,11 @@ csr_roam_roaming_state_start_bss_rsp_processor(struct mac_context *mac,
 		/* Let csr_roam_complete decide what to do */
 		result = eCsrStartBssFailure;
 	}
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	csr_roam_complete(mac, result, pSmeStartBssRsp,
 				pSmeStartBssRsp->sessionId);
+#endif
 }
 
 /**
@@ -5309,12 +5338,18 @@ csr_compute_mode_and_band(struct mac_context *mac_ctx,
  *
  * Return: dot11mode
  */
+#ifndef SAP_CP_CLEANUP
 static enum csr_cfgdot11mode
 csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac_ctx,
 				   uint8_t vdev_id,
 				   struct csr_roam_profile *profile,
 				   uint32_t bss_op_ch_freq,
 				   enum reg_wifi_band *p_band)
+#else
+enum csr_cfgdot11mode
+csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac_ctx,
+				   struct bss_dot11_config *dot11_cfg)
+#endif
 {
 	enum reg_wifi_band band = REG_BAND_2G;
 	qdf_freq_t opr_freq = 0;
@@ -5398,6 +5433,7 @@ csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac_ctx,
 	return cfg_dot11_mode;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_issue_stop_bss(struct mac_context *mac,
 		uint32_t sessionId, enum csr_roam_substate NewSubstate)
 {
@@ -5420,6 +5456,7 @@ QDF_STATUS csr_roam_issue_stop_bss(struct mac_context *mac,
 	}
 	return status;
 }
+#endif
 
 QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac,
 				      qdf_freq_t *ch_freq_list,
@@ -5443,6 +5480,7 @@ QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifndef SAP_CP_CLEANUP
 /**
  * csr_populate_basic_rates() - populates OFDM or CCK rates
  * @rates:         rate struct to populate
@@ -5460,6 +5498,7 @@ csr_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates,
 {
 	wlan_populate_basic_rates(rate_set, is_ofdm_rates, is_basic_rates);
 }
+#endif
 
 /**
  * csr_convert_mode_to_nw_type() - convert mode into network type
@@ -5493,6 +5532,7 @@ csr_convert_mode_to_nw_type(enum csr_cfgdot11mode dot11_mode,
 	return eSIR_DONOT_USE_NW_TYPE;
 }
 
+#ifndef SAP_CP_CLEANUP
 /**
  * csr_populate_supported_rates_from_hostapd() - populates operational
  * and extended rates.
@@ -5542,7 +5582,6 @@ static void csr_populate_supported_rates_from_hostapd(tSirMacRateSet *opr_rates,
 			FL("Extended Rate is %2x"), ext_rates->rate[i]);
 	}
 }
-
 /**
  * csr_roam_get_bss_start_parms() - get bss start param from profile
  * @mac:          mac global context
@@ -5777,7 +5816,7 @@ void csr_roam_prepare_bss_params(struct mac_context *mac, uint32_t sessionId,
 	}
 
 }
-
+#endif
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 void csr_get_pmk_info(struct mac_context *mac_ctx, uint8_t session_id,
 		      struct wlan_crypto_pmksa *pmk_cache)
@@ -5949,6 +5988,7 @@ void csr_clear_sae_single_pmk(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+#ifndef SAP_CP_CLEANUP
 static QDF_STATUS csr_roam_start_wds(struct mac_context *mac, uint32_t sessionId,
 				     struct csr_roam_profile *pProfile)
 {
@@ -5983,7 +6023,7 @@ static QDF_STATUS csr_roam_start_wds(struct mac_context *mac, uint32_t sessionId
 
 	return status;
 }
-
+#endif
 #ifdef FEATURE_WLAN_ESE
 void csr_update_prev_ap_info(struct csr_roam_session *session,
 			     struct wlan_objmgr_vdev *vdev)
@@ -7020,6 +7060,7 @@ QDF_STATUS csr_send_assoc_cnf_msg(struct mac_context *mac,
 	return status;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_send_mb_start_bss_req_msg(struct mac_context *mac, uint32_t
 					sessionId, eCsrRoamBssType bssType,
 					 struct csr_roamstart_bssparams *pParam)
@@ -7108,7 +7149,7 @@ QDF_STATUS csr_send_mb_stop_bss_req_msg(struct mac_context *mac,
 
 	return umac_send_mb_message_to_mac(pMsg);
 }
-
+#endif
 /**
  * csr_store_oce_cfg_flags_in_vdev() - fill OCE flags from ini
  * @mac: mac_context.
@@ -7668,12 +7709,15 @@ static enum wlan_serialization_cmd_type csr_get_roam_cmd_type(
 	enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX;
 
 	switch (sme_cmd->u.roamCmd.roamReason) {
+/* To be removed after SAP CSR cleanup changes */
+#ifndef SAP_CP_CLEANUP
 	case eCsrStartBss:
 		cmd_type = WLAN_SER_CMD_VDEV_START_BSS;
 		break;
 	case eCsrStopBss:
 		cmd_type = WLAN_SER_CMD_VDEV_STOP_BSS;
 		break;
+#endif
 	case eCsrForcedDisassocSta:
 		cmd_type = WLAN_SER_CMD_FORCE_DISASSOC_STA;
 		break;
@@ -7890,6 +7934,7 @@ QDF_STATUS csr_roam_update_config(struct mac_context *mac_ctx, uint8_t session_i
 	return status;
 }
 
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
 				       struct qdf_mac_addr bssid,
 				       uint8_t vdev_id,
@@ -7949,7 +7994,13 @@ QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
 
 	return status;
 }
-
+#else
+QDF_STATUS csr_sap_channel_change_req(struct mac_context *mac,
+				      struct channel_change_req *req)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 /*
  * Post Beacon Tx Start request to LIM
  * immediately after SAP CAC WAIT is
@@ -8706,3 +8757,84 @@ QDF_STATUS csr_update_owe_info(struct mac_context *mac,
 
 	return status;
 }
+
+#ifdef SAP_CP_CLEANUP
+/**
+ * csr_set_sap_ser_params() - API to fill serialization parameters for
+ * SAP requests
+ * @cmd : Serialization command
+ * @cmd_type: Type of serialization command
+ *
+ * Return: Void
+ */
+static void csr_set_sap_ser_params(struct wlan_serialization_command *cmd,
+				   enum wlan_serialization_cmd_type cmd_type)
+{
+	return;
+}
+
+QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
+			 struct start_bss_config *bss_config,
+			 uint32_t *roam_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS csr_roam_issue_stop_bss_cmd(struct mac_context *mac,
+				       uint8_t vdev_id,
+				       eCsrRoamBssType bss_type,
+				       bool high_priority)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * csr_process_sap_defaults() - API to process the default response
+ * for SAP from LIM
+ * @mac_ctx: mac context
+ * @req: Serialization command posted by SAP
+ * @vdev_id : vdev id
+ *
+ * Return: void
+ */
+static void csr_process_sap_defaults(struct mac_context *mac_ctx,
+				     struct wlan_serialization_command *req,
+				     uint32_t vdev_id)
+{
+	return;
+}
+
+/**
+ * csr_process_sap_results() - API to process the LIM response for
+ * the messages posted by SAP module
+ * @mac_ctx: mac context
+ * @req: Serialization command posted by SAP
+ * @rsp: Response from LIM
+ * @result: Result from LIM
+ * @vdev_id : vdev id
+ *
+ * Return: void
+ */
+static bool csr_process_sap_results(struct mac_context *mac_ctx,
+				    struct wlan_serialization_command *req,
+				    void *rsp,
+				    enum csr_roamcomplete_result result,
+				    uint8_t vdev_id)
+{
+	return true;
+}
+
+void csr_dequeue_sap_cmd(struct mac_context *mac_ctx,
+			 struct wlan_serialization_command *req,
+			 uint32_t vdev_id)
+{
+	return;
+}
+
+void csr_process_sap_response(struct mac_context *mac_ctx,
+			      enum csr_roamcomplete_result result,
+			      void *rsp, uint8_t vdev_id)
+{
+	return;
+}
+#endif

+ 62 - 6
core/sme/src/csr/csr_inside_api.h

@@ -78,11 +78,12 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac,
 void csr_release_command_roam(struct mac_context *mac, tSmeCmd *pCommand);
 void csr_release_command_wm_status_change(struct mac_context *mac,
 					  tSmeCmd *pCommand);
-
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_copy_profile(struct mac_context *mac,
 				 struct csr_roam_profile *pDstProfile,
 				 struct csr_roam_profile *pSrcProfile,
 				 uint8_t vdev_id);
+#endif
 QDF_STATUS csr_scan_open(struct mac_context *mac);
 QDF_STATUS csr_scan_close(struct mac_context *mac);
 
@@ -93,9 +94,15 @@ QDF_STATUS csr_roam_call_callback(struct mac_context *mac, uint32_t sessionId,
 				  struct csr_roam_info *roam_info,
 				  uint32_t roamId,
 				  eRoamCmdStatus u1, eCsrRoamResult u2);
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_issue_bss_start(struct mac_context *mac, uint8_t vdev_id,
 			       struct csr_roam_profile *pProfile,
 			       uint32_t roamId);
+#else
+QDF_STATUS csr_issue_bss_start(struct mac_context *mac, uint8_t vdev_id,
+			       struct start_bss_config *bss_config,
+			       uint32_t roam_id);
+#endif
 void csr_roam_complete(struct mac_context *mac, enum csr_roamcomplete_result Result,
 		       void *Context, uint8_t session_id);
 
@@ -123,13 +130,14 @@ csr_issue_set_context_req_helper(struct mac_context *mac,
 				 uint8_t *key);
 void csr_roam_check_for_link_status_change(struct mac_context *mac,
 					tSirSmeRsp *pSirMsg);
-
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_roam_issue_start_bss(struct mac_context *mac, uint32_t sessionId,
 				    struct csr_roamstart_bssparams *pParam,
 				    struct csr_roam_profile *pProfile,
 				    uint32_t roamId);
 QDF_STATUS csr_roam_issue_stop_bss(struct mac_context *mac, uint32_t sessionId,
 				   enum csr_roam_substate NewSubstate);
+#endif
 QDF_STATUS csr_send_mb_disassoc_req_msg(struct mac_context *mac, uint32_t sessionId,
 					tSirMacAddr bssId, uint16_t reasonCode);
 QDF_STATUS csr_send_mb_deauth_req_msg(struct mac_context *mac, uint32_t sessionId,
@@ -142,13 +150,14 @@ QDF_STATUS csr_send_assoc_cnf_msg(struct mac_context *mac,
 				  struct assoc_ind *pAssocInd,
 				  QDF_STATUS status,
 				  enum wlan_status_code mac_status_code);
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS csr_send_mb_start_bss_req_msg(struct mac_context *mac,
 					 uint32_t sessionId,
 					 eCsrRoamBssType bssType,
 					 struct csr_roamstart_bssparams *pParam);
 QDF_STATUS csr_send_mb_stop_bss_req_msg(struct mac_context *mac,
 					uint32_t sessionId);
-
+#endif
 /**
  * csr_get_cfg_valid_channels() - Get valid channel frequency list
  * @mac: mac context
@@ -162,10 +171,13 @@ QDF_STATUS csr_send_mb_stop_bss_req_msg(struct mac_context *mac,
 QDF_STATUS csr_get_cfg_valid_channels(struct mac_context *mac,
 				      uint32_t *ch_freq_list,
 				      uint32_t *num_ch_freq);
-
+#ifndef SAP_CP_CLEANUP
 /* to free memory allocated inside the profile structure */
 void csr_release_profile(struct mac_context *mac,
 			 struct csr_roam_profile *pProfile);
+#else
+void csr_clear_start_bss_config(struct start_bss_config *sap_config);
+#endif
 
 enum csr_cfgdot11mode
 csr_get_cfg_dot11_mode_from_csr_phy_mode(bool is_ap, eCsrPhyMode phyMode);
@@ -352,7 +364,7 @@ QDF_STATUS csr_scan_result_purge(struct mac_context *mac,
 				 tScanResultHandle hScanResult);
 
 /* /////////////////////////////////////////Common Scan ends */
-
+#ifndef SAP_CP_CLEANUP
 /**
  * csr_bss_start() - A wrapper function to request CSR to inititiate start bss
  * @mac: mac ctx
@@ -364,6 +376,21 @@ QDF_STATUS csr_scan_result_purge(struct mac_context *mac,
  */
 QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
 			 struct csr_roam_profile *profile, uint32_t *roam_id);
+#else
+/**
+ * csr_bss_start() - CSR API to post the start bss request to serialization
+ * module.
+ * @mac: mac context
+ * @vdev_id: vdev id
+ * @bss_config: start bss config
+ * @roam_id : pointer to roam id
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
+			 struct start_bss_config *bss_config,
+			 uint32_t *roam_id);
+#endif
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /*
@@ -528,12 +555,13 @@ QDF_STATUS csr_sta_continue_csa(struct mac_context *mac_ctx,
 QDF_STATUS csr_set_ht2040_mode(struct mac_context *mac, uint32_t sessionId,
 			       ePhyChanBondState cbMode, bool obssEnabled);
 #endif
+#ifndef SAP_CP_CLEANUP
 QDF_STATUS
 csr_roam_prepare_bss_config_from_profile(struct mac_context *mac_ctx,
 					 struct csr_roam_profile *profile,
 					 uint8_t vdev_id,
 					 struct bss_config_param *bss_cfg);
-
+#endif
 void
 csr_roam_prepare_bss_params(struct mac_context *mac_ctx, uint32_t session_id,
 			    struct csr_roam_profile *profile,
@@ -632,4 +660,32 @@ void csr_cm_get_sta_cxn_info(struct mac_context *mac_ctx, uint8_t vdev_id,
 #endif
 #endif
 
+#ifdef SAP_CP_CLEANUP
+/**
+ * csr_dequeue_sap_cmd() - API to dequeue the active/pending
+ * command posted by SAP from the serialization queues
+ * @mac_ctx: mac context
+ * @req: Serialization command to be dequeued
+ * @vdev_id: vdev ida
+ *
+ * Return: None
+ */
+void csr_dequeue_sap_cmd(struct mac_context *mac_ctx,
+			 struct wlan_serialization_command *req,
+			 uint32_t vdev_id);
+
+/**
+ * csr_process_sap_response() - Wrapper API to process the SAP
+ * response from LIM
+ * @mac_ctx: mac context
+ * @result: Result of LIM processing
+ * @rsp: Response from LIM
+ * @vdev_id: vdev id
+ *
+ * Return: void
+ */
+void csr_process_sap_response(struct mac_context *mac,
+			      enum csr_roamcomplete_result result,
+			      void *context, uint8_t session_id);
+#endif
 #endif /* CSR_INSIDE_API_H__ */