Prechádzať zdrojové kódy

qcacmn: Remove legacy dependency from Policy Manager Part 3

Remove legacy dependency from Policy Manager component Part 3

Change-Id: I63f6330e0b4b172d8f78f3e93131e9fba3121f09
CRs-Fixed: 2019994
Archana Ramachandran 8 rokov pred
rodič
commit
94fef7786b

+ 23 - 16
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -190,30 +190,27 @@ QDF_STATUS policy_mgr_change_mcc_go_beacon_interval(
 		struct wlan_objmgr_psoc *psoc,
 		uint8_t vdev_id, enum tQDF_ADAPTER_MODE dev_mode);
 
-/**
- * policy_mgr_set_mcc_latency() - Set MCC latency
- * @psoc: PSOC object information
- * @set_value: Latency value
- *
- * Sets the MCC latency value during STA-P2P concurrency
- *
- * Return: None
- */
-void policy_mgr_set_mcc_latency(struct wlan_objmgr_psoc *psoc, int set_value);
 #if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH)
 /**
  * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA
  * @psoc: PSOC object information
- * @hdd_ap_ctx: AP context
+ * @vdev_id: Vdev id
+ * @channel: Channel to change
+ * @ch_width: channel width to change
  *
  * Invoke the callback function to change SAP channel using (E)CSA
  *
  * Return: None
  */
-void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc);
+void policy_mgr_change_sap_channel_with_csa(
+		struct wlan_objmgr_psoc *psoc,
+		uint8_t vdev_id, uint32_t channel,
+		uint32_t ch_width);
 #else
 static inline void policy_mgr_change_sap_channel_with_csa(
-		struct wlan_objmgr_psoc *psoc)
+		struct wlan_objmgr_psoc *psoc,
+		uint8_t vdev_id, uint32_t channel,
+		uint32_t ch_width)
 {
 
 }
@@ -757,6 +754,12 @@ struct policy_mgr_sme_cbacks {
 		uint8_t next_action, struct wlan_objmgr_psoc *psoc,
 		enum policy_mgr_conn_update_reason reason);
 	QDF_STATUS (*sme_change_mcc_beacon_interval) (uint8_t session_id);
+	QDF_STATUS (*sme_get_ap_channel_from_scan_cache) (
+		void *roam_profile,
+		void **scan_cache,
+		uint8_t *channel);
+	QDF_STATUS (*sme_scan_result_purge) (
+				void *scan_result);
 };
 
 /**
@@ -938,23 +941,27 @@ void policy_mgr_clear_concurrent_session_count(struct wlan_objmgr_psoc *psoc);
 /**
  * policy_mgr_is_multiple_active_sta_sessions() - Check for
  * multiple STA connections
+ * @psoc: PSOC object information
  *
  * Checks if multiple active STA connection are in the driver
  *
  * Return: True if multiple STA sessions are present, False otherwise
  *
  */
-bool policy_mgr_is_multiple_active_sta_sessions(struct wlan_objmgr_psoc *psoc);
+bool policy_mgr_is_multiple_active_sta_sessions(
+	struct wlan_objmgr_psoc *psoc);
 
 /**
  * policy_mgr_is_sta_active_connection_exists() - Check if a STA
  * connection is active
+ * @psoc: PSOC object information
  *
  * Checks if there is atleast one active STA connection in the driver
  *
  * Return: True if an active STA session is present, False otherwise
  */
-bool policy_mgr_is_sta_active_connection_exists(void);
+bool policy_mgr_is_sta_active_connection_exists(
+	struct wlan_objmgr_psoc *psoc);
 
 /**
  * policy_mgr_concurrent_beaconing_sessions_running() - Checks
@@ -1137,7 +1144,7 @@ QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc,
  */
 QDF_STATUS policy_mgr_register_sap_restart_channel_switch_cb(
 		struct wlan_objmgr_psoc *psoc,
-		void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t));
+		void (*sap_restart_chan_switch_cb)(uint8_t, uint32_t, uint32_t));
 
 /**
  * policy_mgr_deregister_sap_restart_channel_switch_cb() -

+ 28 - 3
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -588,9 +588,34 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 #endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
 
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
-void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc)
+/**
+ * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA
+ * @psoc: PSOC object information
+ * @vdev_id: Vdev id
+ * @channel: Channel to change
+ * @ch_width: channel width to change
+ *
+ * Invoke the callback function to change SAP channel using (E)CSA
+ *
+ * Return: None
+ */
+void policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc,
+					    uint8_t vdev_id, uint32_t channel,
+					    uint32_t ch_width)
 {
-	return;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid context");
+		return;
+	}
+
+	if (pm_ctx->sap_restart_chan_switch_cb) {
+		policy_mgr_info("SAP change change without restart");
+		pm_ctx->sap_restart_chan_switch_cb(vdev_id,
+				channel, ch_width);
+	}
 }
 #endif
 
@@ -694,7 +719,7 @@ QDF_STATUS policy_mgr_restart_opportunistic_timer(
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 QDF_STATUS policy_mgr_register_sap_restart_channel_switch_cb(
 		struct wlan_objmgr_psoc *psoc,
-		void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t))
+		void (*sap_restart_chan_switch_cb)(uint8_t, uint32_t, uint32_t))
 {
 	struct policy_mgr_psoc_priv_obj *policy_mgr_ctx;
 

+ 49 - 8
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -1163,11 +1163,46 @@ uint32_t policy_mgr_get_concurrency_mode(void)
 	return 0;
 }
 
+/**
+ * policy_mgr_get_channel_from_scan_result() - to get channel from scan result
+ * @psoc: PSOC object information
+ * @roam_profile: pointer to roam profile
+ * @channel: channel to be filled
+ *
+ * This routine gets channel which most likely a candidate to which STA
+ * will make connection.
+ *
+ * Return: QDF_STATUS
+ */
 QDF_STATUS policy_mgr_get_channel_from_scan_result(
 		struct wlan_objmgr_psoc *psoc,
 		void *roam_profile, uint8_t *channel)
 {
-	return QDF_STATUS_SUCCESS;
+	QDF_STATUS status;
+	void *scan_cache = NULL;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid context");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!roam_profile || !channel) {
+		policy_mgr_err("Invalid input parameters");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = pm_ctx->sme_cbacks.sme_get_ap_channel_from_scan_cache
+		(roam_profile, &scan_cache, channel);
+	if (status != QDF_STATUS_SUCCESS) {
+		policy_mgr_err("Get AP channel failed");
+		return status;
+	}
+
+	status = pm_ctx->sme_cbacks.sme_scan_result_purge(scan_cache);
+
+	return status;
 }
 
 uint8_t policy_mgr_search_and_check_for_session_conc(
@@ -1341,11 +1376,6 @@ QDF_STATUS policy_mgr_change_mcc_go_beacon_interval(
 	return QDF_STATUS_SUCCESS;
 }
 
-void policy_mgr_set_mcc_latency(struct wlan_objmgr_psoc *psoc, int set_value)
-{
-	return;
-}
-
 struct policy_mgr_conc_connection_info *policy_mgr_get_conn_info(uint32_t *len)
 {
 	struct policy_mgr_conc_connection_info *conn_ptr =
@@ -1412,9 +1442,20 @@ bool policy_mgr_is_multiple_active_sta_sessions(struct wlan_objmgr_psoc *psoc)
 		psoc, PM_STA_MODE, NULL) > 1;
 }
 
-bool policy_mgr_is_sta_active_connection_exists(void)
+/**
+ * policy_mgr_is_sta_active_connection_exists() - Check if a STA
+ * connection is active
+ * @psoc: PSOC object information
+ *
+ * Checks if there is atleast one active STA connection in the driver
+ *
+ * Return: True if an active STA session is present, False otherwise
+ */
+bool policy_mgr_is_sta_active_connection_exists(
+	struct wlan_objmgr_psoc *psoc)
 {
-	return true;
+	return (!policy_mgr_mode_specific_connection_count(
+		psoc, QDF_STA_MODE, NULL)) ? false : true;
 }
 
 bool policy_mgr_is_any_nondfs_chnl_present(struct wlan_objmgr_psoc *psoc,

+ 1 - 1
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -260,7 +260,7 @@ struct policy_mgr_psoc_priv_obj {
 		qdf_event_t connection_update_done_evt;
 		qdf_mutex_t qdf_conc_list_lock;
 		qdf_mc_timer_t dbs_opportunistic_timer;
-		void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t);
+		void (*sap_restart_chan_switch_cb)(uint8_t, uint32_t, uint32_t);
 		struct policy_mgr_sme_cbacks sme_cbacks;
 		struct policy_mgr_wma_cbacks wma_cbacks;
 		struct policy_mgr_tdls_cbacks tdls_cbacks;

+ 4 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -398,6 +398,10 @@ QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc,
 		sme_cbacks->sme_soc_set_dual_mac_config;
 	pm_ctx->sme_cbacks.sme_change_mcc_beacon_interval =
 		sme_cbacks->sme_change_mcc_beacon_interval;
+	pm_ctx->sme_cbacks.sme_get_ap_channel_from_scan_cache =
+		sme_cbacks->sme_get_ap_channel_from_scan_cache;
+	pm_ctx->sme_cbacks.sme_scan_result_purge =
+		sme_cbacks->sme_scan_result_purge;
 
 	return QDF_STATUS_SUCCESS;
 }