Kaynağa Gözat

qcacld-3.0: Fix SAP start failure on CN country code

In CN country code, 5180 is indoor channel with channel
state DFS, but not DFS channel flags.
wlan_hdd_handle_zero_acs_list try to find preferred channel
for SAP to start, but it selected 5180 because
wlan_reg_is_dfs_for_freq check DFS by DFS channel flags
and return false for indoor channel 5180. The other
concurrency code use channel state to check DFS channel.
Fix the mismatch to use wlan_reg_get_channel_state_for_pwrmode
API to check DFS channel state. and make the DFS channel as
last choice.

Change-Id: I39b81ea256ab9b944a284862afe9d50ee5fc2a8d
CRs-Fixed: 3404069
Liangwei Dong 2 yıl önce
ebeveyn
işleme
5fbce73ad3
1 değiştirilmiş dosya ile 19 ekleme ve 5 silme
  1. 19 5
      core/hdd/src/wlan_hdd_cfg80211.c

+ 19 - 5
core/hdd/src/wlan_hdd_cfg80211.c

@@ -3180,8 +3180,9 @@ void wlan_hdd_handle_zero_acs_list(struct hdd_context *hdd_ctx,
 				   uint8_t org_ch_list_count)
 {
 	uint16_t i, sta_count;
-	uint32_t acs_chan_default = 0;
+	uint32_t acs_chan_default = 0, acs_dfs_chan = 0;
 	bool force_sap_allowed = false;
+	enum channel_state state;
 
 	if (!acs_ch_list_count || *acs_ch_list_count > 0 ||
 	    !acs_freq_list) {
@@ -3204,8 +3205,11 @@ void wlan_hdd_handle_zero_acs_list(struct hdd_context *hdd_ctx,
 	wlan_hdd_dump_freq_list(org_freq_list, org_ch_list_count);
 
 	for (i = 0; i < org_ch_list_count; i++) {
-		if (wlan_reg_is_dfs_for_freq(hdd_ctx->pdev,
-					     org_freq_list[i]))
+		state = wlan_reg_get_channel_state_for_pwrmode(
+				hdd_ctx->pdev, org_freq_list[i],
+				REG_CURRENT_PWR_MODE);
+		if (state == CHANNEL_STATE_DISABLE ||
+		    state == CHANNEL_STATE_INVALID)
 			continue;
 
 		if (wlan_reg_is_6ghz_chan_freq(org_freq_list[i]) &&
@@ -3215,11 +3219,21 @@ void wlan_hdd_handle_zero_acs_list(struct hdd_context *hdd_ctx,
 		if (!policy_mgr_is_safe_channel(hdd_ctx->psoc,
 						org_freq_list[i]))
 			continue;
+		/* Make dfs channel as last choice */
+		if (state == CHANNEL_STATE_DFS ||
+		    state == CHANNEL_STATE_PASSIVE) {
+			acs_dfs_chan = org_freq_list[i];
+			continue;
+		}
 		acs_chan_default = org_freq_list[i];
 		break;
 	}
-	if (!acs_chan_default)
-		acs_chan_default = org_freq_list[0];
+	if (!acs_chan_default) {
+		if (acs_dfs_chan)
+			acs_chan_default = acs_dfs_chan;
+		else
+			acs_chan_default = org_freq_list[0];
+	}
 
 	acs_freq_list[0] = acs_chan_default;
 	*acs_ch_list_count = 1;