Browse Source

qcacld-3.0: Check and update SAP BW before CSA

At present, driver move DFS SAP to STA's non DFS 5 GHz channel
before STA connects to 5 GHz AP. But need to make sure the
new SAP BW doesn't cover DFS sub channels and cause CAC.
Move the BW check and update logic to correct location to handle
such case.

Change-Id: I59cd1e8d92d978429f24963b9cb241d6f89f2307
CRs-Fixed: 3427862
Liangwei Dong 2 years ago
parent
commit
373f804c45
1 changed files with 21 additions and 22 deletions
  1. 21 22
      core/hdd/src/wlan_hdd_cm_connect.c

+ 21 - 22
core/hdd/src/wlan_hdd_cm_connect.c

@@ -633,33 +633,32 @@ def_chan:
 	 */
 	ch_bw = hdd_ap_ctx->sap_config.ch_width_orig;
 	if (!ch_freq || wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, ch_freq) ||
-	    !policy_mgr_is_safe_channel(hdd_ctx->psoc, ch_freq)) {
+	    !policy_mgr_is_safe_channel(hdd_ctx->psoc, ch_freq))
 		ch_freq = policy_mgr_get_nondfs_preferred_channel(
 			hdd_ctx->psoc, PM_SAP_MODE, true);
-		if (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) &&
-		    ch_bw > CH_WIDTH_20MHZ) {
-			struct ch_params ch_params;
-
-			qdf_mem_zero(&ch_params, sizeof(ch_params));
+	if (WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) &&
+	    ch_bw > CH_WIDTH_20MHZ) {
+		struct ch_params ch_params;
+
+		qdf_mem_zero(&ch_params, sizeof(ch_params));
+		ch_params.ch_width = ch_bw;
+		ch_state =
+		wlan_reg_get_5g_bonded_channel_state_for_pwrmode(
+				hdd_ctx->pdev, ch_freq, &ch_params,
+				REG_CURRENT_PWR_MODE);
+		while (ch_bw > CH_WIDTH_20MHZ &&
+		       ch_state != CHANNEL_STATE_ENABLE) {
+			ch_bw =
+			wlan_reg_get_next_lower_bandwidth(ch_bw);
 			ch_params.ch_width = ch_bw;
 			ch_state =
-			wlan_reg_get_5g_bonded_channel_state_for_pwrmode(
-					hdd_ctx->pdev, ch_freq, &ch_params,
-					REG_CURRENT_PWR_MODE);
-			while (ch_bw > CH_WIDTH_20MHZ &&
-			       ch_state != CHANNEL_STATE_ENABLE) {
-				ch_bw =
-				wlan_reg_get_next_lower_bandwidth(ch_bw);
-				ch_params.ch_width = ch_bw;
-				ch_state =
-				wlan_reg_get_5g_bonded_channel_state_for_pwrmode
-					(hdd_ctx->pdev, ch_freq, &ch_params,
-					REG_CURRENT_PWR_MODE);
-			}
-			hdd_debug("bw change from %d to %d",
-				  hdd_ap_ctx->sap_config.ch_width_orig,
-				  ch_bw);
+			wlan_reg_get_5g_bonded_channel_state_for_pwrmode
+				(hdd_ctx->pdev, ch_freq, &ch_params,
+				REG_CURRENT_PWR_MODE);
 		}
+		hdd_debug("bw change from %d to %d",
+			  hdd_ap_ctx->sap_config.ch_width_orig,
+			  ch_bw);
 	}
 
 	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);