Browse Source

qcacld-3.0: change sme code for policy manager restructuring

Modify sme code to cope with the policy manager moving to host
common.

Change-Id: I3a78736ea63f5e79644a9e0a3db790a1fcd286bd
CRs-Fixed: 2009818
Tushnim Bhattacharyya 8 years ago
parent
commit
0c4ad2d08a

+ 19 - 17
core/mac/inc/sir_api.h

@@ -435,20 +435,6 @@ typedef struct sSirSmeReadyReq {
 	void *pe_roam_synch_cb;
 } tSirSmeReadyReq, *tpSirSmeReadyReq;
 
-/**
- * struct sir_hw_mode - Format of set HW mode
- * @hw_mode_index: Index of HW mode to be set
- * @set_hw_mode_cb: HDD set HW mode callback
- * @reason: Reason for HW mode change
- * @session_id: Session id
- */
-struct sir_hw_mode {
-	uint32_t hw_mode_index;
-	void *set_hw_mode_cb;
-	enum sir_conn_update_reason reason;
-	uint32_t session_id;
-};
-
 /**
  * struct s_sir_set_hw_mode - Set HW mode request
  * @messageType: Message type
@@ -458,7 +444,7 @@ struct sir_hw_mode {
 struct s_sir_set_hw_mode {
 	uint16_t messageType;
 	uint16_t length;
-	struct sir_hw_mode set_hw;
+	struct policy_mgr_hw_mode set_hw;
 };
 
 /**
@@ -3349,7 +3335,7 @@ struct sir_hw_mode_trans_ind {
 	uint32_t old_hw_mode_index;
 	uint32_t new_hw_mode_index;
 	uint32_t num_vdev_mac_entries;
-	struct sir_vdev_mac_map vdev_mac_map[MAX_VDEV_SUPPORTED];
+	struct policy_mgr_vdev_mac_map vdev_mac_map[MAX_VDEV_SUPPORTED];
 };
 
 /**
@@ -5494,7 +5480,8 @@ struct send_extcap_ie {
 
 typedef void (*hw_mode_cb)(uint32_t status, uint32_t cfgd_hw_mode_index,
 		uint32_t num_vdev_mac_entries,
-		struct sir_vdev_mac_map *vdev_mac_map);
+		struct sir_vdev_mac_map *vdev_mac_map,
+		struct wlan_objmgr_psoc *context);
 typedef void (*hw_mode_transition_cb)(uint32_t old_hw_mode_index,
 		uint32_t new_hw_mode_index,
 		uint32_t num_vdev_mac_entries,
@@ -6903,4 +6890,19 @@ struct sir_del_all_tdls_peers {
 	uint16_t msg_len;
 	struct qdf_mac_addr bssid;
 };
+
+/*
+ * @SCAN_REJECT_DEFAULT: default value
+ * @CONNECTION_IN_PROGRESS: connection is in progress
+ * @REASSOC_IN_PROGRESS: reassociation is in progress
+ * @EAPOL_IN_PROGRESS: STA/P2P-CLI is in middle of EAPOL/WPS exchange
+ * @SAP_EAPOL_IN_PROGRESS: SAP/P2P-GO is in middle of EAPOL/WPS exchange
+ */
+enum scan_reject_states {
+	SCAN_REJECT_DEFAULT = 0,
+	CONNECTION_IN_PROGRESS,
+	REASSOC_IN_PROGRESS,
+	EAPOL_IN_PROGRESS,
+	SAP_EAPOL_IN_PROGRESS,
+};
 #endif /* __SIR_API_H */

+ 16 - 14
core/sme/inc/sme_api.h

@@ -527,7 +527,7 @@ uint16_t sme_check_concurrent_channel_overlap(tHalHandle hHal, uint16_t sap_ch,
  */
 QDF_STATUS sme_abort_mac_scan(tHalHandle hHal, uint8_t sessionId,
 		uint32_t scan_id, eCsrAbortReason reason);
-QDF_STATUS sme_get_cfg_valid_channels(tHalHandle hHal, uint8_t *aValidChannels,
+QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels,
 		uint32_t *len);
 #ifdef FEATURE_WLAN_SCAN_PNO
 QDF_STATUS sme_set_preferred_network_list(tHalHandle hHal,
@@ -1002,23 +1002,20 @@ void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss);
 
 bool sme_is_any_session_in_connected_state(tHalHandle h_hal);
 
-QDF_STATUS sme_pdev_set_pcl(tHalHandle hal,
-		struct sir_pcl_list msg);
-QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal,
-		struct sir_hw_mode msg);
+QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg);
+QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg);
 void sme_register_hw_mode_trans_cb(tHalHandle hal,
 		hw_mode_transition_cb callback);
-QDF_STATUS sme_nss_update_request(tHalHandle hHal, uint32_t vdev_id,
-				uint8_t  new_nss, void *cback,
-				uint8_t next_action, void *hdd_context,
-				enum sir_conn_update_reason reason);
+QDF_STATUS sme_nss_update_request(uint32_t vdev_id,
+				uint8_t  new_nss, policy_mgr_nss_update_cback cback,
+				uint8_t next_action, struct wlan_objmgr_psoc *psoc,
+				enum policy_mgr_conn_update_reason reason);
 
 typedef void (*sme_peer_authorized_fp) (uint32_t vdev_id);
 QDF_STATUS sme_set_peer_authorized(uint8_t *peer_addr,
 				   sme_peer_authorized_fp auth_fp,
 				   uint32_t vdev_id);
-QDF_STATUS sme_soc_set_dual_mac_config(tHalHandle hal,
-		struct sir_dual_mac_config msg);
+QDF_STATUS sme_soc_set_dual_mac_config(struct policy_mgr_dual_mac_config msg);
 QDF_STATUS sme_soc_set_antenna_mode(tHalHandle hal,
 		struct sir_antenna_mode_param *msg);
 
@@ -1263,7 +1260,7 @@ QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id,
 				       struct sir_mac_pwr_dbg_cmd*
 				       dbg_args);
 
-void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode,
+void sme_get_vdev_type_nss(enum tQDF_ADAPTER_MODE dev_mode,
 		uint8_t *nss_2g, uint8_t *nss_5g);
 QDF_STATUS sme_roam_set_default_key_index(tHalHandle hal, uint8_t session_id,
 					  uint8_t default_idx);
@@ -1453,13 +1450,18 @@ QDF_STATUS sme_delete_all_tdls_peers(tHalHandle hal, uint8_t session_id);
  * sme_register_set_connection_info_cb() - Register connection
  * info callback
  * @hal - MAC global handle
- * @callback_routine - callback routine from HDD
+ * @set_connection_info_cb - callback routine from HDD to set
+ *                   connection info flag
+ * @get_connection_info_cb - callback routine from HDD to get
+ *                         connection info
  *
  * This API is invoked by HDD to register its callback to mac
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal,
-					  bool (*set_connection_info_cb)(bool));
+				bool (*set_connection_info_cb)(bool),
+				bool (*get_connection_info_cb)(uint8_t *session_id,
+				enum scan_reject_states *reason));
 
 #endif /* #if !defined( __SME_API_H ) */

+ 1 - 1
core/sme/inc/sme_inside.h

@@ -184,7 +184,7 @@ typedef struct tagSmeCmd {
 #ifdef FEATURE_WLAN_TDLS
 		tTdlsCmd tdlsCmd;
 #endif
-		struct sir_hw_mode set_hw_mode_cmd;
+		struct policy_mgr_hw_mode set_hw_mode_cmd;
 		struct s_nss_update_cmd nss_update_cmd;
 		struct sir_dual_mac_config set_dual_mac_cmd;
 		struct sir_antenna_mode_param set_antenna_mode_cmd;

+ 2 - 0
core/sme/inc/sme_internal.h

@@ -258,6 +258,8 @@ typedef struct tagSmeStruct {
 	void (*lost_link_info_cb)(void *context,
 			struct sir_lost_link_info *lost_link_info);
 	bool (*set_connection_info_cb)(bool);
+	bool (*get_connection_info_cb)(uint8_t *session_id,
+			enum scan_reject_states *reason);
 } tSmeStruct, *tpSmeStruct;
 
 #endif /* #if !defined( __SMEINTERNAL_H ) */

+ 66 - 29
core/sme/src/common/sme_api.c

@@ -198,7 +198,8 @@ static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg)
 	callback(param->status,
 			param->cfgd_hw_mode_index,
 			param->num_vdev_mac_entries,
-			param->vdev_mac_map);
+			param->vdev_mac_map,
+			command->u.set_hw_mode_cmd.context);
 	session = CSR_GET_SESSION(mac, session_id);
 	if (reason == SIR_UPDATE_REASON_HIDDEN_STA) {
 		/* In the case of hidden SSID, connection update
@@ -294,10 +295,10 @@ static QDF_STATUS sme_process_hw_mode_trans_ind(tpAniSirGlobal mac,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cds_hw_mode_transition_cb(param->old_hw_mode_index,
+	policy_mgr_hw_mode_transition_cb(param->old_hw_mode_index,
 		param->new_hw_mode_index,
 		param->num_vdev_mac_entries,
-		param->vdev_mac_map);
+		param->vdev_mac_map, mac->psoc);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -6981,16 +6982,45 @@ QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue)
 }
 #endif
 
-QDF_STATUS sme_get_cfg_valid_channels(tHalHandle hHal, uint8_t *aValidChannels,
+static tpAniSirGlobal sme_get_mac_context(void)
+{
+	tpAniSirGlobal mac_ctx;
+	tHalHandle h_hal;
+
+	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	if (NULL == h_hal) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL,
+		FL("invalid h_hal"));
+		return NULL;
+	}
+
+	mac_ctx = PMAC_STRUCT(h_hal);
+	if (NULL == mac_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+		FL("Invalid MAC context"));
+		return NULL;
+	}
+
+	return mac_ctx;
+}
+
+QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels,
 				      uint32_t *len)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+	tpAniSirGlobal mac_ctx = sme_get_mac_context();
 
-	status = sme_acquire_global_lock(&pMac->sme);
+	if (NULL == mac_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+		FL("Invalid MAC context"));
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	status = sme_acquire_global_lock(&mac_ctx->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_get_cfg_valid_channels(pMac, aValidChannels, len);
-		sme_release_global_lock(&pMac->sme);
+		status = csr_get_cfg_valid_channels(mac_ctx,
+			aValidChannels, len);
+		sme_release_global_lock(&mac_ctx->sme);
 	}
 
 	return status;
@@ -12626,7 +12656,8 @@ QDF_STATUS sme_update_dsc_pto_up_mapping(tHalHandle hHal,
 	}
 
 	if (!pSession->QosMapSet.present) {
-		hdd_notice("QOS Mapping IE not present");
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+				FL("QOS Mapping IE not present"));
 		sme_release_global_lock(&pMac->sme);
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -12720,7 +12751,7 @@ QDF_STATUS sme_get_valid_channels_by_band(tHalHandle hHal,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	status = sme_get_cfg_valid_channels(hHal, &chanList[0],
+	status = sme_get_cfg_valid_channels(&chanList[0],
 			&totValidChannels);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		sms_log(pMac, QDF_TRACE_LEVEL_ERROR,
@@ -14722,11 +14753,10 @@ QDF_STATUS sme_fw_mem_dump(tHalHandle hHal, void *recvd_req)
  * Sends the command to WMA to send WMI_PDEV_SET_PCL_CMDID to FW
  * Return: QDF_STATUS_SUCCESS on successful posting
  */
-QDF_STATUS sme_pdev_set_pcl(tHalHandle hal,
-		struct sir_pcl_list msg)
+QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal mac   = PMAC_STRUCT(hal);
+	tpAniSirGlobal mac   = sme_get_mac_context();
 	struct scheduler_msg message;
 	struct wmi_pcl_chan_weights *req_msg;
 	uint32_t len, i;
@@ -14779,11 +14809,10 @@ QDF_STATUS sme_pdev_set_pcl(tHalHandle hal,
  * Sends the command to CSR to send WMI_PDEV_SET_HW_MODE_CMDID to FW
  * Return: QDF_STATUS_SUCCESS on successful posting
  */
-QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal,
-		struct sir_hw_mode msg)
+QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal mac = PMAC_STRUCT(hal);
+	tpAniSirGlobal mac = sme_get_mac_context();
 	tSmeCmd *cmd = NULL;
 
 	status = sme_acquire_global_lock(&mac->sme);
@@ -14804,6 +14833,7 @@ QDF_STATUS sme_pdev_set_hw_mode(tHalHandle hal,
 	cmd->u.set_hw_mode_cmd.set_hw_mode_cb = msg.set_hw_mode_cb;
 	cmd->u.set_hw_mode_cmd.reason = msg.reason;
 	cmd->u.set_hw_mode_cmd.session_id = msg.session_id;
+	cmd->u.set_hw_mode_cmd.context = msg.context;
 
 	sms_log(mac, LOG1,
 		FL("Queuing set hw mode to CSR, session:%d reason:%d"),
@@ -14846,13 +14876,13 @@ void sme_register_hw_mode_trans_cb(tHalHandle hal,
  * Sends the command to CSR to send to PE
  * Return: QDF_STATUS_SUCCESS on successful posting
  */
-QDF_STATUS sme_nss_update_request(tHalHandle hHal, uint32_t vdev_id,
-				uint8_t  new_nss, void *cback, uint8_t next_action,
-				void *hdd_context,
-				enum sir_conn_update_reason reason)
+QDF_STATUS sme_nss_update_request(uint32_t vdev_id,
+				uint8_t  new_nss, policy_mgr_nss_update_cback cback,
+				uint8_t next_action, struct wlan_objmgr_psoc *psoc,
+				enum policy_mgr_conn_update_reason reason)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal mac = PMAC_STRUCT(hHal);
+	tpAniSirGlobal mac = sme_get_mac_context();
 	tSmeCmd *cmd = NULL;
 
 	status = sme_acquire_global_lock(&mac->sme);
@@ -14869,7 +14899,7 @@ QDF_STATUS sme_nss_update_request(tHalHandle hHal, uint32_t vdev_id,
 		cmd->u.nss_update_cmd.new_nss = new_nss;
 		cmd->u.nss_update_cmd.session_id = vdev_id;
 		cmd->u.nss_update_cmd.nss_update_cb = cback;
-		cmd->u.nss_update_cmd.context = hdd_context;
+		cmd->u.nss_update_cmd.context = psoc;
 		cmd->u.nss_update_cmd.next_action = next_action;
 		cmd->u.nss_update_cmd.reason = reason;
 
@@ -14890,11 +14920,10 @@ QDF_STATUS sme_nss_update_request(tHalHandle hHal, uint32_t vdev_id,
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS sme_soc_set_dual_mac_config(tHalHandle hal,
-		struct sir_dual_mac_config msg)
+QDF_STATUS sme_soc_set_dual_mac_config(struct policy_mgr_dual_mac_config msg)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal mac = PMAC_STRUCT(hal);
+	tpAniSirGlobal mac = sme_get_mac_context();
 	tSmeCmd *cmd;
 
 	status = sme_acquire_global_lock(&mac->sme);
@@ -15978,7 +16007,6 @@ QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id,
 }
 /**
  * sme_get_vdev_type_nss() - gets the nss per vdev type
- * @hal: Pointer to HAL
  * @dev_mode: connection type.
  * @nss2g: Pointer to the 2G Nss parameter.
  * @nss5g: Pointer to the 5G Nss parameter.
@@ -15987,10 +16015,16 @@ QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id,
  *
  * Return: None
  */
-void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode,
+void sme_get_vdev_type_nss(enum tQDF_ADAPTER_MODE dev_mode,
 		uint8_t *nss_2g, uint8_t *nss_5g)
 {
-	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	tpAniSirGlobal mac_ctx = sme_get_mac_context();
+
+	if (NULL == mac_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+		FL("Invalid MAC context"));
+		return;
+	}
 	csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g);
 }
 
@@ -16517,7 +16551,9 @@ QDF_STATUS sme_set_peer_param(uint8_t *peer_addr, uint32_t param_id,
 }
 
 QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal,
-					  bool (*set_connection_info_cb)(bool))
+				bool (*set_connection_info_cb)(bool),
+				bool (*get_connection_info_cb)(uint8_t *session_id,
+				enum scan_reject_states *reason))
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
@@ -16525,6 +16561,7 @@ QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal,
 	status = sme_acquire_global_lock(&pMac->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 		pMac->sme.set_connection_info_cb = set_connection_info_cb;
+		pMac->sme.get_connection_info_cb = get_connection_info_cb;
 		sme_release_global_lock(&pMac->sme);
 	}
 	return status;

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

@@ -53,11 +53,12 @@
 #include "cfg_api.h"
 #include "sme_power_save_api.h"
 #include "wma.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "sme_nan_datapath.h"
 #include "pld_common.h"
 #include <wlan_logging_sock_svc.h>
 #include "wlan_objmgr_psoc_obj.h"
+#include <wlan_scan_ucfg_api.h>
 
 #define MAX_PWR_FCC_CHAN_12 8
 #define MAX_PWR_FCC_CHAN_13 2
@@ -5399,8 +5400,8 @@ static bool csr_roam_select_bss(tpAniSirGlobal mac_ctx,
 		 * sessions exempted
 		 */
 		result = &scan_result->Result;
-		if (cds_concurrent_open_sessions_running() &&
-			!csr_is_valid_mc_concurrent_session(mac_ctx,
+		if (policy_mgr_concurrent_open_sessions_running(mac_ctx->psoc)
+			&& !csr_is_valid_mc_concurrent_session(mac_ctx,
 					session_id, &result->BssDescriptor)) {
 			conc_channel = csr_get_concurrent_operation_channel(
 					mac_ctx);
@@ -8043,8 +8044,8 @@ QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
 			 (pScanFilter->csrPersona == QDF_P2P_CLIENT_MODE)) {
 			csr_get_bssdescr_from_scan_handle(hBSSList,
 					&first_ap_profile);
-			status = cds_handle_conc_multiport(sessionId,
-						first_ap_profile.channelId);
+			status = policy_mgr_handle_conc_multiport(pMac->psoc,
+					sessionId, first_ap_profile.channelId);
 			if ((QDF_IS_STATUS_SUCCESS(status)) &&
 				(!csr_wait_for_connection_update(pMac, true))) {
 					sms_log(pMac, LOG1,
@@ -14656,7 +14657,7 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
 		 * those cases (by now channel has been decided).
 		 */
 		if (eSIR_INFRASTRUCTURE_MODE == csr_join_req->bsstype ||
-		    !wma_is_dbs_enable())
+		    !policy_mgr_is_dbs_enable(pMac->psoc))
 			csr_set_ldpc_exception(pMac, pSession,
 					pBssDescription->channelId,
 					pMac->roam.configParam.rxLdpcEnable);
@@ -15478,7 +15479,8 @@ QDF_STATUS csr_send_mb_start_bss_req_msg(tpAniSirGlobal pMac, uint32_t sessionId
 	 * for 5Ghz for STA like persona then here is how to handle
 	 * those cases (by now channel has been decided).
 	 */
-	if (eSIR_IBSS_MODE == pMsg->bssType || !wma_is_dbs_enable())
+	if (eSIR_IBSS_MODE == pMsg->bssType ||
+		!policy_mgr_is_dbs_enable(pMac->psoc))
 		csr_set_ldpc_exception(pMac, pSession,
 				pMsg->channelId,
 				pMac->roam.configParam.rxLdpcEnable);
@@ -19907,7 +19909,7 @@ void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command)
 	QDF_STATUS status;
 	struct scheduler_msg msg;
 	struct sir_set_hw_mode_resp *param;
-	enum cds_hw_mode_change cds_hw_mode;
+	enum policy_mgr_hw_mode_change hw_mode;
 
 	/* Setting HW mode is for the entire system.
 	 * So, no need to check session
@@ -19931,7 +19933,8 @@ void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command)
 	/* For hidden SSID case, if there is any scan command pending
 	 * it needs to be cleared before issuing set HW mode
 	 */
-	if (command->u.set_hw_mode_cmd.reason == SIR_UPDATE_REASON_HIDDEN_STA) {
+	if (command->u.set_hw_mode_cmd.reason ==
+		POLICY_MGR_UPDATE_REASON_HIDDEN_STA) {
 		sms_log(mac, LOGE, FL("clear any pending scan command"));
 		status = csr_scan_abort_mac_scan_not_for_connect(mac,
 				command->u.set_hw_mode_cmd.session_id);
@@ -19941,21 +19944,23 @@ void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command)
 		}
 	}
 
-	if ((SIR_UPDATE_REASON_OPPORTUNISTIC ==
-	     command->u.set_hw_mode_cmd.reason) &&
-	    (true == cds_is_connection_in_progress(NULL, NULL))) {
+	if ((POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC ==
+		command->u.set_hw_mode_cmd.reason) &&
+		(true == mac->sme.get_connection_info_cb(NULL, NULL))) {
 		sms_log(mac, LOGE, FL("Set HW mode refused: conn in progress"));
-		cds_restart_opportunistic_timer(false);
+		policy_mgr_restart_opportunistic_timer(mac->psoc, false);
 		goto fail;
 	}
 
-	cds_hw_mode = wma_get_cds_hw_mode_change_from_hw_mode_index(
-				command->u.set_hw_mode_cmd.hw_mode_index);
+	hw_mode = policy_mgr_get_hw_mode_change_from_hw_mode_index(
+			mac->psoc, command->u.set_hw_mode_cmd.hw_mode_index);
 
-	if (CDS_HW_MODE_NOT_IN_PROGRESS == cds_hw_mode)
+	if (POLICY_MGR_HW_MODE_NOT_IN_PROGRESS == hw_mode) {
+		sms_log(mac, LOGE, FL("hw_mode %d, failing"), hw_mode);
 		goto fail;
+	}
 
-	cds_set_hw_mode_change_in_progress(cds_hw_mode);
+	policy_mgr_set_hw_mode_change_in_progress(mac->psoc, hw_mode);
 
 	cmd->messageType = eWNI_SME_SET_HW_MODE_REQ;
 	cmd->length = len;
@@ -19974,7 +19979,8 @@ void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command)
 
 	status = umac_send_mb_message_to_mac(cmd);
 	if (QDF_STATUS_SUCCESS != status) {
-		cds_set_hw_mode_change_in_progress(CDS_HW_MODE_NOT_IN_PROGRESS);
+		policy_mgr_set_hw_mode_change_in_progress(mac->psoc,
+			POLICY_MGR_HW_MODE_NOT_IN_PROGRESS);
 		sms_log(mac, LOGE, FL("Posting to PE failed"));
 		return;
 	}
@@ -20329,17 +20335,18 @@ QDF_STATUS csr_roam_synch_callback(tpAniSirGlobal mac_ctx,
 		 * 3) Set connection in progress = false
 		 */
 		/* first update connection info from wma interface */
-		cds_update_connection_info(session_id);
+		policy_mgr_update_connection_info(mac_ctx->psoc, session_id);
 		/* then update remaining parameters from roam sync ctx */
 		sms_log(mac_ctx, LOGE, FL("Update DBS hw mode"));
-		cds_hw_mode_transition_cb(
+		policy_mgr_hw_mode_transition_cb(
 			roam_synch_data->hw_mode_trans_ind.old_hw_mode_index,
 			roam_synch_data->hw_mode_trans_ind.new_hw_mode_index,
 			roam_synch_data->hw_mode_trans_ind.num_vdev_mac_entries,
-			roam_synch_data->hw_mode_trans_ind.vdev_mac_map);
+			roam_synch_data->hw_mode_trans_ind.vdev_mac_map,
+			mac_ctx->psoc);
 		mac_ctx->sme.set_connection_info_cb(false);
 		session->roam_synch_in_progress = false;
-		cds_check_concurrent_intf_and_restart_sap(session->pContext);
+		policy_mgr_check_concurrent_intf_and_restart_sap(mac_ctx->psoc);
 		sme_release_global_lock(&mac_ctx->sme);
 		return status;
 	default:

+ 22 - 18
core/sme/src/csr/csr_api_scan.c

@@ -50,7 +50,7 @@
 #include "cfg_api.h"
 #include "wma.h"
 
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "wlan_hdd_main.h"
 #include "pld_common.h"
 #include "csr_internal.h"
@@ -2244,16 +2244,16 @@ csr_parse_scan_results(tpAniSirGlobal pMac,
 	eCsrEncryptionType uc, mc;
 	eCsrAuthType auth = eCSR_AUTH_TYPE_OPEN_SYSTEM;
 	uint32_t len = 0;
-	enum cds_con_mode new_mode;
+	enum policy_mgr_con_mode new_mode;
 	uint8_t weight_list[QDF_MAX_NUM_CHAN];
 
 
 	csr_ll_lock(&pMac->scan.scanResultList);
 
 	if (pFilter && (0 == pFilter->BSSIDs.numOfBSSIDs)) {
-		if (cds_map_concurrency_mode(
+		if (policy_mgr_map_concurrency_mode(
 					&pFilter->csrPersona, &new_mode)) {
-			status = cds_get_pcl(new_mode,
+			status = policy_mgr_get_pcl(pMac->psoc, new_mode,
 				&pFilter->pcl_channels.channelList[0], &len,
 				weight_list, QDF_ARRAY_SIZE(weight_list));
 			pFilter->pcl_channels.numChannels = (uint8_t)len;
@@ -3983,7 +3983,8 @@ static eCsrScanCompleteNextCommand csr_scan_get_next_command_state(
 	switch (session->scan_info.scan_reason) {
 	case eCsrScanForSsid:
 		sms_log(mac_ctx, LOG1, FL("Resp for Scan For Ssid"));
-		channel = cds_search_and_check_for_session_conc(
+		channel = policy_mgr_search_and_check_for_session_conc(
+				mac_ctx->psoc,
 				session_id,
 				session->scan_info.profile);
 		if ((!channel) || scan_status) {
@@ -4050,7 +4051,8 @@ static eCsrScanCompleteNextCommand csr_scan_get_next_command_state(
 		 * failure: csr_scan_handle_search_for_ssid_failure
 		 */
 		sms_log(pMac, LOG1, FL("Resp for eCsrScanForSsid"));
-		channel = cds_search_and_check_for_session_conc(
+		channel = policy_mgr_search_and_check_for_session_conc(
+				pMac->psoc,
 				pCommand->sessionId,
 				pCommand->u.scanCmd.pToRoamProfile);
 		if ((!channel) || !fSuccess) {
@@ -4323,8 +4325,8 @@ static void csr_handle_nxt_cmd(tpAniSirGlobal mac_ctx,
 		csr_scan_handle_search_for_ssid_failure(mac_ctx, session_id);
 		break;
 	case eCsrNextCheckAllowConc:
-		ret = cds_current_connections_update(session_id,
-					chan,
+		ret = policy_mgr_current_connections_update(mac_ctx->psoc,
+					session_id, chan,
 					SIR_UPDATE_REASON_HIDDEN_STA);
 		sms_log(mac_ctx, LOG1, FL("chan: %d session: %d status: %d"),
 					chan, session_id, ret);
@@ -4527,8 +4529,8 @@ csr_handle_nxt_cmd(tpAniSirGlobal mac_ctx, tSmeCmd *pCommand,
 		csr_scan_handle_search_for_ssid_failure(mac_ctx, pCommand);
 		break;
 	case eCsrNextCheckAllowConc:
-		ret = cds_current_connections_update(pCommand->sessionId,
-					chan,
+		ret = policy_mgr_current_connections_update(mac_ctx->psoc,
+					pCommand->sessionId, chan,
 					SIR_UPDATE_REASON_HIDDEN_STA);
 		sms_log(mac_ctx, LOG1, FL("chan: %d session: %d status: %d"),
 					chan, pCommand->sessionId, ret);
@@ -6183,10 +6185,11 @@ QDF_STATUS csr_scan_copy_request(tpAniSirGlobal mac_ctx,
 	 * out SAP/GO channel's band otherwise it will cause issue in
 	 * SAP+STA concurrency
 	 */
-	if (cds_is_ibss_conn_exist(&channel)) {
+	if (policy_mgr_is_ibss_conn_exist(mac_ctx->psoc, &channel)) {
 		sms_log(mac_ctx, LOG1,
 			FL("Conc IBSS exist, channel list will be modified"));
-	} else if (cds_is_any_dfs_beaconing_session_present(&channel)) {
+	} else if (policy_mgr_is_any_dfs_beaconing_session_present(
+			mac_ctx->psoc, &channel)) {
 		/*
 		 * 1) if agile & DFS scans are supported
 		 * 2) if hardware is DBS capable
@@ -6194,9 +6197,10 @@ QDF_STATUS csr_scan_copy_request(tpAniSirGlobal mac_ctx,
 		 * if all above 3 conditions are true then don't skip any
 		 * channel from scan list
 		 */
-		if (true != wma_is_current_hwmode_dbs() &&
-		    wma_get_dbs_plus_agile_scan_config() &&
-		    wma_get_single_mac_scan_with_dfs_config())
+		if (true != policy_mgr_is_current_hwmode_dbs(mac_ctx->psoc) &&
+		    policy_mgr_get_dbs_plus_agile_scan_config(mac_ctx->psoc) &&
+		    policy_mgr_get_single_mac_scan_with_dfs_config(
+		    mac_ctx->psoc))
 			channel = 0;
 		else
 			sms_log(mac_ctx, LOG1,
@@ -8288,7 +8292,7 @@ static QDF_STATUS csr_prepare_scan_filter(tpAniSirGlobal mac_ctx,
 	int i;
 	uint32_t len = 0;
 	QDF_STATUS status;
-	enum cds_con_mode new_mode;
+	enum policy_mgr_con_mode new_mode;
 	uint8_t weight_list[QDF_MAX_NUM_CHAN];
 	struct roam_ext_params *roam_params = NULL;
 
@@ -8371,9 +8375,9 @@ static QDF_STATUS csr_prepare_scan_filter(tpAniSirGlobal mac_ctx,
 	filter->dot11_mode = pFilter->phyMode;
 
 	if (!pFilter->BSSIDs.numOfBSSIDs) {
-		if (cds_map_concurrency_mode(
+		if (policy_mgr_map_concurrency_mode(
 		   &pFilter->csrPersona, &new_mode)) {
-			status = cds_get_pcl(new_mode,
+			status = policy_mgr_get_pcl(mac_ctx->psoc, new_mode,
 				filter->pcl_channel_list, &len,
 				weight_list, QDF_ARRAY_SIZE(weight_list));
 			filter->num_of_pcl_channels = (uint8_t)len;

+ 4 - 3
core/sme/src/csr/csr_host_scan_roam.c

@@ -35,7 +35,7 @@
 #include "sme_api.h"
 #include "csr_neighbor_roam.h"
 #include "mac_trace.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 
 /**
  * csr_roam_issue_reassociate() - Issue Reassociate
@@ -204,8 +204,9 @@ void csr_neighbor_roam_process_scan_results(tpAniSirGlobal mac_ctx,
 			 * Continue if MCC is disabled in INI and if AP
 			 * will create MCC
 			 */
-			if (cds_concurrent_open_sessions_running() &&
-			   !mac_ctx->roam.configParam.fenableMCCMode) {
+			if (policy_mgr_concurrent_open_sessions_running(
+				mac_ctx->psoc) &&
+				!mac_ctx->roam.configParam.fenableMCCMode) {
 				uint8_t conc_channel;
 
 				conc_channel =

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

@@ -45,7 +45,7 @@
 #include "sme_api.h"
 #include "csr_neighbor_roam.h"
 #include "mac_trace.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 
 #define NEIGHBOR_ROAM_DEBUG sms_log
 static const char *lfr_get_config_item_string(uint8_t reason)
@@ -1044,7 +1044,7 @@ static void csr_neighbor_roam_info_ctx_init(
 	/* Initialize all the data structures needed for the 11r FT Preauth */
 	ngbr_roam_info->FTRoamInfo.currentNeighborRptRetryNum = 0;
 	csr_neighbor_roam_purge_preauth_failed_list(pMac);
-	if (!cds_is_multiple_active_sta_sessions() &&
+	if (!policy_mgr_is_multiple_active_sta_sessions(pMac->psoc) &&
 		csr_roam_is_roam_offload_scan_enabled(pMac)) {
 		/*
 		 * If this is not a INFRA type BSS, then do not send the command

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

@@ -35,7 +35,7 @@
 #include "sme_api.h"
 #include "csr_neighbor_roam.h"
 #include "mac_trace.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "sir_api.h"
 
 static void csr_reinit_preauth_cmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);

+ 7 - 5
core/sme/src/csr/csr_util.c

@@ -41,7 +41,7 @@
 #include "sme_qos_internal.h"
 #include "wma_types.h"
 #include "cds_utils.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "wlan_serialization_legacy_api.h"
 
 
@@ -1273,7 +1273,9 @@ uint16_t csr_check_concurrent_channel_overlap(tpAniSirGlobal mac_ctx,
 		else if (cc_switch_mode ==
 			QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL) {
 			status =
-			    cds_get_sap_mandatory_channel((uint32_t *)&intf_ch);
+				policy_mgr_get_sap_mandatory_channel(
+				mac_ctx->psoc,
+				(uint32_t *)&intf_ch);
 			if (QDF_IS_STATUS_ERROR(status)) {
 				sms_log(mac_ctx, LOGE,
 						FL("no mandatory channel"));
@@ -1284,8 +1286,8 @@ uint16_t csr_check_concurrent_channel_overlap(tpAniSirGlobal mac_ctx,
 				QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL)) {
 		if (cds_chan_to_band(intf_ch) == CDS_BAND_2GHZ) {
 			status =
-				cds_get_sap_mandatory_channel(
-						(uint32_t *)&intf_ch);
+				policy_mgr_get_sap_mandatory_channel(
+					mac_ctx->psoc, (uint32_t *)&intf_ch);
 			if (QDF_IS_STATUS_ERROR(status)) {
 				sms_log(mac_ctx, LOGE,
 						FL("no mandatory channel"));
@@ -6218,7 +6220,7 @@ bool csr_wait_for_connection_update(tpAniSirGlobal mac,
 		}
 	}
 
-	status = qdf_wait_for_connection_update();
+	status = policy_mgr_wait_for_connection_update(mac->psoc);
 
 	if (do_release_reacquire_lock == true) {
 		ret = sme_acquire_global_lock(&mac->sme);