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

qcacld-3.0: Move SAP to STA channel during SAP start

When STA is connected to non-dfs, non-indoor channel and
SAP starts second with mandatory channel list enabled,
then SAP is moving to 2.4Ghz. But SAP should follow sta
and move to non-indoor, non-dfs channel.

Also when STA is connected on DFS channel and when SAP
is coming up with g_enable_sta_sap_scc_on_dfs_chan,
then SAP also should move to DFS channel

So when PCL channels are filtered based on mandatory
channel list, then allow dfs/indoor channels based on
concurrent STA frequency.

Change-Id: I2bcb81a8b014108b07db36a31d03d0a16fe49eb9
CRs-Fixed: 3207750
Pragaspathi Thilagaraj 2 éve
szülő
commit
ad399448bc

+ 10 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -3741,6 +3741,16 @@ bool policy_mgr_is_special_mode_active_5g(struct wlan_objmgr_psoc *psoc,
  */
 bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * policy_mgr_is_connected_sta_5g() - check if sta connected in 5 GHz
+ * @psoc: pointer to soc
+ * @freq: Pointer to the frequency on which sta is connected
+ *
+ * Return: true if sta is connected in 5 GHz else false
+ */
+bool policy_mgr_is_connected_sta_5g(struct wlan_objmgr_psoc *psoc,
+				    qdf_freq_t *freq);
+
 /**
  * policy_mgr_scan_trim_5g_chnls_for_dfs_ap() - check if sta scan should skip
  * 5g channel when dfs ap is present.

+ 29 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -7085,6 +7085,35 @@ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc)
 	return ret;
 }
 
+bool
+policy_mgr_is_connected_sta_5g(struct wlan_objmgr_psoc *psoc, qdf_freq_t *freq)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t conn_index;
+	bool ret = false;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return ret;
+	}
+
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+	     conn_index++) {
+		*freq = pm_conc_connection_list[conn_index].freq;
+		if (pm_conc_connection_list[conn_index].mode == PM_STA_MODE &&
+		    WLAN_REG_IS_5GHZ_CH_FREQ(*freq) &&
+		    pm_conc_connection_list[conn_index].in_use) {
+			ret = true;
+			break;
+		}
+	}
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+
+	return ret;
+}
+
 uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,
 					struct connection_info *info)
 {

+ 42 - 5
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -2800,7 +2800,12 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 	uint32_t i, j, pcl_len = 0;
 	bool found;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
-	uint32_t indoor_sta_freq = INVALID_CHANNEL_ID;
+	qdf_freq_t dfs_sta_freq = INVALID_CHANNEL_ID;
+	qdf_freq_t indoor_sta_freq = INVALID_CHANNEL_ID;
+	qdf_freq_t sta_5GHz_freq = INVALID_CHANNEL_ID;
+	enum hw_mode_bandwidth sta_ch_width;
+	uint8_t sta_vdev_id = 0, scc_on_dfs_channel = 0;
+	bool sta_sap_scc_on_5ghz_channel;
 	bool scc_on_indoor =
 		 policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc);
 
@@ -2822,26 +2827,58 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
 
 	for (i = 0; i < pm_ctx->sap_mandatory_channels_len; i++)
 		policy_mgr_debug("fav chan:%d",
-			pm_ctx->sap_mandatory_channels[i]);
+				 pm_ctx->sap_mandatory_channels[i]);
 
 	if (scc_on_indoor)
 		indoor_sta_freq = policy_mgr_is_sta_on_indoor_channel(psoc);
 
+	policy_mgr_get_sta_sap_scc_on_dfs_chnl(psoc, &scc_on_dfs_channel);
+	if (scc_on_dfs_channel)
+		policy_mgr_is_sta_present_on_dfs_channel(psoc,
+							 &sta_vdev_id,
+							 &dfs_sta_freq,
+							 &sta_ch_width);
+	sta_sap_scc_on_5ghz_channel =
+		policy_mgr_is_connected_sta_5g(psoc, &sta_5GHz_freq);
+
 	for (i = 0; i < *pcl_len_org; i++) {
 		found = false;
 		if (i >= NUM_CHANNELS) {
 			policy_mgr_debug("index is exceeding NUM_CHANNELS");
 			break;
 		}
+
+		if (scc_on_indoor && policy_mgr_is_force_scc(psoc) &&
+		    pcl_list_org[i] == indoor_sta_freq) {
+			policy_mgr_debug("indoor chan:%d", pcl_list_org[i]);
+			found = true;
+			goto update_pcl;
+		}
+
+		if (scc_on_dfs_channel && policy_mgr_is_force_scc(psoc) &&
+		    pcl_list_org[i] == dfs_sta_freq) {
+			policy_mgr_debug("dfs chan:%d", pcl_list_org[i]);
+			found = true;
+			goto update_pcl;
+		}
+
+		if (sta_sap_scc_on_5ghz_channel &&
+		    policy_mgr_is_force_scc(psoc) &&
+		    pcl_list_org[i] == sta_5GHz_freq) {
+			policy_mgr_debug("scc chan:%d", pcl_list_org[i]);
+			found = true;
+			goto update_pcl;
+		}
+
 		for (j = 0; j < pm_ctx->sap_mandatory_channels_len; j++) {
 			if (pcl_list_org[i] ==
-			    pm_ctx->sap_mandatory_channels[j] ||
-			    (scc_on_indoor &&
-			     pcl_list_org[i] == indoor_sta_freq)) {
+			    pm_ctx->sap_mandatory_channels[j]) {
 				found = true;
 				break;
 			}
 		}
+
+update_pcl:
 		if (found && (pcl_len < NUM_CHANNELS)) {
 			pcl_list_org[pcl_len] = pcl_list_org[i];
 			weight_list_org[pcl_len++] = weight_list_org[i];