Ver Fonte

qcacld-3.0: Get best channel for SAP during CSA

Currently, if standalone SAP is operating in 6 GHz
and SET_FCC_CHANNEL 0/2 command is issued, as a result
complete 6 GHz band gets disabled and host triggers
SAP CSA to a new 2.4 GHz frequency.
In this path CSA is getting triggered for the second
time and as SAP is operating in a 2.4 GHz frequency
host does CSA to a new 5 GHz channel.

To address the issues,
 1) Add logic to do SAP CSA to best valid channel if current
    channel is disabled.
 2) Invoke wlan_reg_recompute_current_chan_list from
    policy_mgr_update_connection_info only for STA
    and P2P client.

Change-Id: I3dd2b4075d8cd9e73735317ac3a5f7fb08635548
CRs-Fixed: 3603739
Asutosh Mohapatra há 1 ano atrás
pai
commit
8a97a01153

+ 2 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -532,7 +532,8 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
 	else if (policy_mgr_update_indoor_concurrency(psoc, vdev_id, cur_freq,
 						SWITCH_WITHOUT_CONCURRENCY))
 		wlan_reg_recompute_current_chan_list(psoc, pm_ctx->pdev);
-	else if (wlan_reg_get_keep_6ghz_sta_cli_connection(pm_ctx->pdev))
+	else if (wlan_reg_get_keep_6ghz_sta_cli_connection(pm_ctx->pdev) &&
+		 (mode == PM_STA_MODE || mode == PM_P2P_CLIENT_MODE))
 		wlan_reg_recompute_current_chan_list(psoc, pm_ctx->pdev);
 
 	ml_nlink_conn_change_notify(

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

@@ -3455,6 +3455,7 @@ next_lower_bw:
  * wlansap_get_safe_channel() - Get safe channel from current regulatory
  * @sap_ctx: Pointer to SAP context
  * @ch_width: selected channel bandwdith
+ * @pref_band: Preferred channel band for sap
  *
  * This function is used to get safe channel from current regulatory valid
  * channels to restart SAP if failed to get safe channel from PCL.
@@ -3464,7 +3465,8 @@ next_lower_bw:
  */
 static uint32_t
 wlansap_get_safe_channel(struct sap_context *sap_ctx,
-			 enum phy_ch_width *ch_width)
+			 enum phy_ch_width *ch_width,
+			 enum reg_wifi_band pref_band)
 {
 	struct mac_context *mac;
 	uint32_t pcl_freqs[NUM_CHANNELS];
@@ -3473,6 +3475,9 @@ wlansap_get_safe_channel(struct sap_context *sap_ctx,
 	uint32_t pcl_len = 0, i;
 	uint32_t selected_freq;
 	enum policy_mgr_con_mode mode;
+	uint32_t first_valid_dfs_5g_freq = 0;
+	uint32_t first_valid_non_dfs_5g_freq = 0;
+	uint32_t first_valid_6g_freq = 0;
 
 	if (!sap_ctx) {
 		sap_err("NULL parameter");
@@ -3524,16 +3529,45 @@ wlansap_get_safe_channel(struct sap_context *sap_ctx,
 			return selected_freq;
 
 		for (i = 0; i < pcl_len; i++) {
-			if (WLAN_REG_IS_SAME_BAND_FREQS(sap_ctx->chan_freq,
+			if (!first_valid_non_dfs_5g_freq &&
+			    wlan_reg_is_5ghz_ch_freq(pcl_freqs[i])) {
+				if (!wlan_reg_is_dfs_in_secondary_list_for_freq(
+							mac->pdev,
 							pcl_freqs[i])) {
-				sap_debug("select %d from valid channel list",
-					  pcl_freqs[i]);
-				return pcl_freqs[i];
+					first_valid_non_dfs_5g_freq = pcl_freqs[i];
+					if (pref_band == REG_BAND_5G)
+						break;
+				} else if (!first_valid_dfs_5g_freq) {
+					first_valid_dfs_5g_freq = pcl_freqs[i];
+				}
+			}
+			if (!first_valid_6g_freq &&
+			    wlan_reg_is_6ghz_chan_freq(pcl_freqs[i])) {
+				first_valid_6g_freq = pcl_freqs[i];
+				if (pref_band == REG_BAND_6G)
+					break;
 			}
 		}
-		sap_debug("select first %d from valid channel list",
-			  pcl_freqs[0]);
-		return pcl_freqs[0];
+
+		selected_freq = pcl_freqs[0];
+
+		if (pref_band == REG_BAND_6G) {
+			if (first_valid_6g_freq)
+				selected_freq = first_valid_6g_freq;
+			else if (first_valid_non_dfs_5g_freq)
+				selected_freq = first_valid_non_dfs_5g_freq;
+			else if (first_valid_dfs_5g_freq)
+				selected_freq = first_valid_dfs_5g_freq;
+		} else if (pref_band == REG_BAND_5G) {
+			if (first_valid_non_dfs_5g_freq)
+				selected_freq = first_valid_non_dfs_5g_freq;
+			else if (first_valid_dfs_5g_freq)
+				selected_freq = first_valid_dfs_5g_freq;
+		}
+
+		sap_debug("select %d from valid channel list, pref band = %d",
+			  selected_freq, pref_band);
+		return selected_freq;
 	}
 
 	return INVALID_CHANNEL_ID;
@@ -3564,6 +3598,7 @@ wlansap_select_chan_with_best_bandwidth(struct sap_context *sap_ctx,
  * wlansap_get_safe_channel() - Get safe channel from current regulatory
  * @sap_ctx: Pointer to SAP context
  * @ch_width: selected channel width
+ * @pref_band: Preferred channel band for sap
  *
  * This function is used to get safe channel from current regulatory valid
  * channels to restart SAP if failed to get safe channel from PCL.
@@ -3573,7 +3608,8 @@ wlansap_select_chan_with_best_bandwidth(struct sap_context *sap_ctx,
  */
 static uint8_t
 wlansap_get_safe_channel(struct sap_context *sap_ctx,
-			 enum phy_ch_width *ch_width)
+			 enum phy_ch_width *ch_width,
+			 enum reg_wifi_band pref_band)
 {
 	return 0;
 }
@@ -3606,7 +3642,7 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx,
 
 	if (policy_mgr_get_connection_count(mac->psoc) == 1) {
 		sap_debug("only SAP present return best channel from ACS list");
-		return wlansap_get_safe_channel(sap_ctx, ch_width);
+		return wlansap_get_safe_channel(sap_ctx, ch_width, REG_BAND_6G);
 	}
 
 	mode = policy_mgr_qdf_opmode_to_pm_con_mode(mac->psoc, QDF_SAP_MODE,
@@ -3655,7 +3691,7 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx,
 	 * channel is unsafe channel, the pcl may be empty, instead of return,
 	 * try to choose a safe channel from acs range.
 	 */
-	return wlansap_get_safe_channel(sap_ctx, ch_width);
+	return wlansap_get_safe_channel(sap_ctx, ch_width, REG_BAND_6G);
 }
 
 static uint32_t wlansap_get_2g_first_safe_chan_freq(struct sap_context *sap_ctx)