Forráskód Böngészése

qcacmn: Remove legacy dependency from Policy Manager Part 7

Remove legacy dependency from Policy Manager component Part 7

Change-Id: Ied83a92118b8ff2ff1a387a052033aaa97bfbbe0
CRs-Fixed: 2019994
Archana Ramachandran 8 éve
szülő
commit
8d46dbd8ac

+ 3 - 73
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -39,33 +39,6 @@
 #include "qdf_status.h"
 #include "wlan_objmgr_psoc_obj.h"
 #include "wlan_policy_mgr_public_struct.h"
-#include <cds_reg_service.h>
-
-enum cds_band_type {
-	CDS_BAND_ALL = 0,
-	CDS_BAND_2GHZ = 1,
-	CDS_BAND_5GHZ = 2
-};
-extern uint32_t cds_chan_to_freq(uint8_t chan);
-extern uint8_t cds_freq_to_chan(uint32_t freq);
-extern enum cds_band_type cds_chan_to_band(uint32_t chan);
-
-#define WLAN_REG_IS_24GHZ_CH(ch) CDS_IS_CHANNEL_24GHZ(ch)
-#define WLAN_REG_IS_5GHZ_CH(ch) CDS_IS_CHANNEL_5GHZ(ch)
-#define WLAN_REG_IS_SAME_BAND_CHANNELS(ch1, ch2) \
-	CDS_IS_SAME_BAND_CHANNELS(ch1, ch2)
-#define WLAN_REG_IS_CHANNEL_VALID_5G_SBS(curchan, newchan) \
-	CDS_IS_CHANNEL_VALID_5G_SBS(curchan, newchan)
-#define wlan_reg_is_dfs_ch(psoc, ch) CDS_IS_DFS_CH(ch)
-#define WLAN_REG_MAX_24GHZ_CH_NUM CDS_MAX_24GHZ_CHANNEL_NUMBER
-#define reg_chan_to_freq(chan_num) cds_chan_to_freq(chan_num)
-#define reg_freq_to_chan(freq) cds_freq_to_chan(freq)
-#define reg_chan_to_band(chan_num) cds_chan_to_band(chan_num)
-#define BAND_2G CDS_BAND_2GHZ
-#define BAND_5G CDS_BAND_5GHZ
-#define BAND_ALL CDS_BAND_ALL
-#define wlan_reg_set_channel_params(channel, sec_ch, ch_params) \
-	cds_set_channel_params(channel, sec_ch, ch_params)
 
 typedef const enum policy_mgr_pcl_type
 	pm_dbs_pcl_second_connection_table_type
@@ -186,14 +159,10 @@ QDF_STATUS policy_mgr_handle_conc_multiport(
  * Return: None
  */
 void policy_mgr_check_concurrent_intf_and_restart_sap(
-		struct wlan_objmgr_psoc *psoc,
-		uint8_t vdev_id,
-		uint8_t operation_channel);
+		struct wlan_objmgr_psoc *psoc);
 #else
 static inline void policy_mgr_check_concurrent_intf_and_restart_sap(
-		struct wlan_objmgr_psoc *psoc,
-		uint8_t vdev_id,
-		uint8_t operation_channel)
+		struct wlan_objmgr_psoc *psoc)
 {
 
 }
@@ -763,17 +732,6 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc,
 		uint8_t next_action,
 		enum policy_mgr_conn_update_reason reason);
 
-/**
- * struct check_cc_channel_work - Check concurrent interface
- * channel to restart SAP work data
- * @wlan_objmgr_psoc: PSOC object data
- * @vdev_id: vdev id of sap
- */
-struct check_cc_channel_work {
-	struct wlan_objmgr_psoc *psoc;
-	uint8_t vdev_id;
-};
-
 /**
  * struct policy_mgr_sme_cbacks - SME Callbacks to be invoked
  * from policy manager
@@ -822,8 +780,7 @@ struct policy_mgr_hdd_cbacks {
 	QDF_STATUS (*wlan_hdd_get_channel_for_sap_restart)(
 				struct wlan_objmgr_psoc *psoc,
 				uint8_t vdev_id, uint8_t *channel,
-				uint8_t *sec_ch,
-				struct ch_params_s *ch_params);
+				uint8_t *sec_ch, bool is_restart_sap);
 };
 
 
@@ -1199,33 +1156,6 @@ QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc,
  */
 QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc,
 		uint8_t *channels, uint32_t len);
-#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
-/**
- * policy_mgr_register_sap_restart_channel_switch_cb() -
- * Register callback for SAP channel switch without restart
- * @psoc: PSOC object information
- * @sap_restart_chan_switch_cb: Callback to perform channel switch
- *
- * Registers callback to perform channel switch without having to actually
- * restart the beaconing entity
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS policy_mgr_register_sap_restart_channel_switch_cb(
-		struct wlan_objmgr_psoc *psoc,
-		void (*sap_restart_chan_switch_cb)(uint8_t, uint32_t, uint32_t));
-
-/**
- * policy_mgr_deregister_sap_restart_channel_switch_cb() -
- * De-Register callback for SAP channel switch without restart
- * @psoc: PSOC object information
- * De Registers callback to perform channel switch
- *
- * Return: QDF_STATUS Enumeration
- */
-QDF_STATUS policy_mgr_deregister_sap_restart_channel_switch_cb(
-		struct wlan_objmgr_psoc *psoc);
-#endif
 
 /**
  * policy_mgr_is_any_mode_active_on_band_along_with_session() -

+ 36 - 74
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -630,25 +630,20 @@ static bool policy_mgr_is_sap_channel_change_without_restart(
  */
 void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
 {
-	struct check_cc_channel_work *cc_intf_work =
-		(struct check_cc_channel_work *) data;
+	struct wlan_objmgr_psoc *psoc =
+		(struct wlan_objmgr_psoc *) data;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	uint32_t mcc_to_scc_switch;
-	struct wlan_objmgr_psoc *psoc;
 	QDF_STATUS status;
 	uint8_t channel, sec_ch;
-	struct ch_params_s ch_params;
+	uint8_t operating_channel, vdev_id;
+	bool restart_sap;
 
-	if (!cc_intf_work) {
-		policy_mgr_err("Invalid check channel interface work");
-		goto work_done;
-	}
-	psoc = cc_intf_work->psoc;
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
 		policy_mgr_err("Invalid context");
-		goto work_done;
+		return;
 	}
 	mcc_to_scc_switch =
 		policy_mgr_mcc_to_scc_switch_mode_in_user_cfg(psoc);
@@ -657,67 +652,32 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
 		policy_mgr_concurrent_open_sessions_running(psoc));
 
 	if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch))
-		goto work_done;
+		return;
+
+	if (!policy_mgr_get_sap_conn_info(psoc,
+					  &operating_channel,
+					  &vdev_id)) {
+		policy_mgr_err("Could not retrieve SAP channel & vdev id");
+		return;
+	}
+
+	restart_sap = policy_mgr_is_sap_channel_change_without_restart(
+		mcc_to_scc_switch) ? false : true;
 
 	if (!pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart) {
 		policy_mgr_err("SAP restart get channel callback in NULL");
-		goto work_done;
+		return;
 	}
-
 	status = pm_ctx->hdd_cbacks.
-		wlan_hdd_get_channel_for_sap_restart(psoc,
-			cc_intf_work->vdev_id, &channel,
-			&sec_ch, &ch_params);
+		wlan_hdd_get_channel_for_sap_restart(psoc, vdev_id,
+			&channel, &sec_ch, restart_sap);
 	if (status != QDF_STATUS_SUCCESS) {
-		policy_mgr_err("Failed to get channel to restart SAP");
-		goto work_done;
-	}
-
-	if (channel == 0) {
-		policy_mgr_err("Invalid channel to restart SAP");
-		goto work_done;
-	}
-	policy_mgr_info("SAP restarts due to MCC->SCC switch, new chan: %d",
-			channel);
-
-	wlan_reg_set_channel_params(channel, sec_ch, &ch_params);
-
-	if (policy_mgr_is_sap_channel_change_without_restart(
-		mcc_to_scc_switch) &&
-	    pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb) {
-		pm_ctx->hdd_cbacks.sap_restart_chan_switch_cb(psoc,
-			cc_intf_work->vdev_id, channel,
-			ch_params.ch_width);
+		policy_mgr_err("Failed to switch SAP channel");
+		return;
 	}
 
-work_done:
-	qdf_mem_free(cc_intf_work);
-
-}
-
-/**
- * create_check_cc_channel_work() - Create Check concurrent intf
- * channel work
- * @psoc: PSOC object information
- *
- * Create check concurrent interface channel work
- *
- * Return: check concurrent channel interface work object
- */
-static struct check_cc_channel_work *create_check_cc_channel_work(
-	struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
-{
-	struct check_cc_channel_work *cc_intf_work;
-
-	cc_intf_work = qdf_mem_malloc(
-		sizeof(struct check_cc_channel_work));
-	if (NULL == cc_intf_work) {
-		policy_mgr_err("Falied to allocate check concurrent channel work");
-		return NULL;
-	}
-	cc_intf_work->psoc = psoc;
-	cc_intf_work->vdev_id = vdev_id;
-	return cc_intf_work;
+	policy_mgr_info("SAP restarts due to MCC->SCC switch, old chan :%d new chan: %d",
+			operating_channel, channel);
 }
 
 /**
@@ -732,13 +692,11 @@ static struct check_cc_channel_work *create_check_cc_channel_work(
  * Return: None
  */
 void policy_mgr_check_concurrent_intf_and_restart_sap(
-		struct wlan_objmgr_psoc *psoc,
-		uint8_t vdev_id,
-		uint8_t operation_channel)
+		struct wlan_objmgr_psoc *psoc)
 {
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	uint32_t mcc_to_scc_switch;
-	struct check_cc_channel_work *cc_intf_work;
+	uint8_t operating_channel, vdev_id;
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
@@ -746,22 +704,26 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 		return;
 	}
 
+	if (!policy_mgr_get_sap_conn_info(psoc,
+					  &operating_channel,
+					  &vdev_id)) {
+		policy_mgr_err("Could not retrieve SAP channel & vdev id");
+		return;
+	}
+
 	mcc_to_scc_switch =
 		policy_mgr_mcc_to_scc_switch_mode_in_user_cfg(psoc);
 	policy_mgr_info("MCC to SCC switch: %d chan: %d",
-			mcc_to_scc_switch, operation_channel);
+			mcc_to_scc_switch, operating_channel);
 	if ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE)
 #ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
 		 && !wlan_reg_is_dfs_ch(psoc,
-					 operationChannel)
+					 operating_channel)
 #endif
 	    ) {
-		cc_intf_work = create_check_cc_channel_work(psoc, vdev_id);
-		if (!cc_intf_work)
-			return;
 		qdf_create_work(0, &pm_ctx->sta_ap_intf_check_work,
-			policy_mgr_check_sta_ap_concurrent_ch_intf,
-			cc_intf_work);
+				policy_mgr_check_sta_ap_concurrent_ch_intf,
+				psoc);
 		qdf_sched_work(0, &pm_ctx->sta_ap_intf_check_work);
 		policy_mgr_info("Checking for Concurrent Change interference");
 	}

+ 46 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -929,6 +929,52 @@ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc,
 	return status;
 }
 
+bool policy_mgr_get_sap_conn_info(struct wlan_objmgr_psoc *psoc,
+				  uint8_t *channel, uint8_t *vdev_id)
+{
+	uint32_t count, index = 0;
+	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
+	bool status = false;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return false;
+	}
+	if (NULL == channel || NULL == vdev_id) {
+		policy_mgr_err("Null pointer error");
+		return false;
+	}
+
+	count = policy_mgr_mode_specific_connection_count(
+				psoc, PM_SAP_MODE, list);
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	if (count == 0) {
+		policy_mgr_err("No SAP connection");
+		status = false;
+	} else if (count == 1) {
+		*channel = pm_conc_connection_list[list[index]].chan;
+		*vdev_id =
+			pm_conc_connection_list[list[index]].vdev_id;
+		status = true;
+	} else {
+		/*
+		 * Todo Currently the first SAP connection info is
+		 * returned. Modify this to accommodate SAP+SAP+STA
+		 * and SAP+SAP+P2P
+		 */
+		*channel = pm_conc_connection_list[list[index]].chan;
+		*vdev_id =
+			pm_conc_connection_list[list[index]].vdev_id;
+		policy_mgr_notice("Multiple SAP connections, picking first one");
+		status = true;
+	}
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+
+	return status;
+}
+
 bool policy_mgr_max_concurrent_connections_reached(
 		struct wlan_objmgr_psoc *psoc)
 {

+ 42 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -34,6 +34,34 @@
 #include "qdf_lock.h"
 #include "qdf_defer.h"
 
+#include <cds_reg_service.h>
+
+enum cds_band_type {
+	CDS_BAND_ALL = 0,
+	CDS_BAND_2GHZ = 1,
+	CDS_BAND_5GHZ = 2
+};
+
+extern uint32_t cds_chan_to_freq(uint8_t chan);
+extern uint8_t cds_freq_to_chan(uint32_t freq);
+extern enum cds_band_type cds_chan_to_band(uint32_t chan);
+
+#define WLAN_REG_IS_24GHZ_CH(ch) CDS_IS_CHANNEL_24GHZ(ch)
+#define WLAN_REG_IS_5GHZ_CH(ch) CDS_IS_CHANNEL_5GHZ(ch)
+#define WLAN_REG_IS_SAME_BAND_CHANNELS(ch1, ch2) \
+	CDS_IS_SAME_BAND_CHANNELS(ch1, ch2)
+#define WLAN_REG_IS_CHANNEL_VALID_5G_SBS(curchan, newchan) \
+	CDS_IS_CHANNEL_VALID_5G_SBS(curchan, newchan)
+#define wlan_reg_is_dfs_ch(psoc, ch) CDS_IS_DFS_CH(ch)
+#define WLAN_REG_MAX_24GHZ_CH_NUM CDS_MAX_24GHZ_CHANNEL_NUMBER
+#define reg_chan_to_freq(chan_num) cds_chan_to_freq(chan_num)
+#define reg_freq_to_chan(freq) cds_freq_to_chan(freq)
+#define reg_chan_to_band(chan_num) cds_chan_to_band(chan_num)
+#define BAND_2G CDS_BAND_2GHZ
+#define BAND_5G CDS_BAND_5GHZ
+#define BAND_ALL CDS_BAND_ALL
+
+
 #define MAX_NUMBER_OF_CONC_CONNECTIONS 3
 #define DBS_OPPORTUNISTIC_TIME    10
 #ifdef QCA_WIFI_3_0_EMU
@@ -381,4 +409,18 @@ enum policy_mgr_conc_next_action
 		struct wlan_objmgr_psoc *psoc);
 QDF_STATUS policy_mgr_reset_sap_mandatory_channels(
 		struct policy_mgr_psoc_priv_obj *pm_ctx);
+
+/**
+ * policy_mgr_get_sap_conn_info() - Get active SAP channel and
+ * vdev id
+ * @psoc: PSOC object information
+ * @channel: SAP channel
+ * @vdev_id: SAP vdev id
+ *
+ * Get active SAP channel and vdev id
+ *
+ * Return: true for success, else false
+ */
+bool policy_mgr_get_sap_conn_info(struct wlan_objmgr_psoc *psoc,
+				uint8_t *channel, uint8_t *vdev_id);
 #endif