Browse Source

qcacld-3.0: Correct 160MHz SAP dfs flag

Use wlan_reg_get_channel_state_for_freq API to get channel
state and identify 6Ghz channel as non-dfs channel.

Change-Id: Ib134a71c62e24324abc12e5a5b11a524e89de810
CRs-Fixed: 2681608
Liangwei Dong 5 years ago
parent
commit
06109080e9

+ 23 - 12
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -1972,10 +1972,10 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac,
 {
 	struct scheduler_msg mmhMsg = {0};
 	struct sSirChanChangeResponse *chan_change_rsp;
-	uint8_t channelId;
 	bool is_ch_dfs = false;
 	enum phy_ch_width ch_width;
-	uint8_t ch_center_freq_seg1;
+	uint32_t ch_cfreq1 = 0;
+	enum reg_wifi_band band;
 
 	qdf_runtime_pm_allow_suspend(&pe_session->ap_ecsa_runtime_lock);
 	qdf_wake_lock_release(&pe_session->ap_ecsa_wakelock, 0);
@@ -2011,23 +2011,34 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac,
 	 * upper layers to start the beacon transmission .
 	 */
 	ch_width = pe_session->ch_width;
-	ch_center_freq_seg1 = pe_session->ch_center_freq_seg1;
-	channelId = wlan_reg_freq_to_chan(mac->pdev, pe_session->curr_op_freq);
+	band = wlan_reg_freq_to_band(pe_session->curr_op_freq);
+	if (pe_session->ch_center_freq_seg1)
+		ch_cfreq1 = wlan_reg_chan_band_to_freq(
+				mac->pdev,
+				pe_session->ch_center_freq_seg1,
+				BIT(band));
+
 	if (ch_width == CH_WIDTH_160MHZ) {
 		is_ch_dfs = true;
 	} else if (ch_width == CH_WIDTH_80P80MHZ) {
-		if (wlan_reg_get_channel_state(mac->pdev, channelId) ==
-				CHANNEL_STATE_DFS ||
-		    wlan_reg_get_channel_state(mac->pdev,
-			    ch_center_freq_seg1 -
-			    SIR_80MHZ_START_CENTER_CH_DIFF) ==
-							CHANNEL_STATE_DFS)
+		if (wlan_reg_get_channel_state_for_freq(
+						mac->pdev,
+						pe_session->curr_op_freq) ==
+		    CHANNEL_STATE_DFS ||
+		    wlan_reg_get_channel_state_for_freq(
+						mac->pdev,
+						ch_cfreq1) ==
+				CHANNEL_STATE_DFS)
 			is_ch_dfs = true;
 	} else {
-		if (wlan_reg_get_channel_state(mac->pdev, channelId) ==
-				CHANNEL_STATE_DFS)
+		if (wlan_reg_get_channel_state_for_freq(
+						mac->pdev,
+						pe_session->curr_op_freq) ==
+		    CHANNEL_STATE_DFS)
 			is_ch_dfs = true;
 	}
+	if (WLAN_REG_IS_6GHZ_CHAN_FREQ(pe_session->curr_op_freq))
+		is_ch_dfs = false;
 
 	if (is_ch_dfs) {
 		lim_sap_move_to_cac_wait_state(pe_session);

+ 12 - 6
core/sap/src/sap_api_link_cntl.c

@@ -427,18 +427,24 @@ wlansap_roam_process_ch_change_success(struct mac_context *mac_ctx,
 	if (sap_ctx->ch_params.ch_width == CH_WIDTH_160MHZ) {
 		is_ch_dfs = true;
 	} else if (sap_ctx->ch_params.ch_width == CH_WIDTH_80P80MHZ) {
-		if (wlan_reg_get_channel_state_for_freq(mac_ctx->pdev, target_chan_freq) ==
+		if (wlan_reg_get_channel_state_for_freq(
+						mac_ctx->pdev,
+						target_chan_freq) ==
 		    CHANNEL_STATE_DFS ||
-		    wlan_reg_get_channel_state(mac_ctx->pdev,
-			    sap_ctx->ch_params.center_freq_seg1 -
-					  SIR_80MHZ_START_CENTER_CH_DIFF) ==
-							CHANNEL_STATE_DFS)
+		    wlan_reg_get_channel_state_for_freq(
+					mac_ctx->pdev,
+					sap_ctx->ch_params.mhz_freq_seg1) ==
+				CHANNEL_STATE_DFS)
 			is_ch_dfs = true;
 	} else {
-		if (wlan_reg_get_channel_state_for_freq(mac_ctx->pdev, target_chan_freq) ==
+		if (wlan_reg_get_channel_state_for_freq(
+						mac_ctx->pdev,
+						target_chan_freq) ==
 		    CHANNEL_STATE_DFS)
 			is_ch_dfs = true;
 	}
+	if (WLAN_REG_IS_6GHZ_CHAN_FREQ(sap_ctx->chan_freq))
+		is_ch_dfs = false;
 
 	sap_ctx->chan_freq = target_chan_freq;
 	/* check if currently selected channel is a DFS channel */

+ 1 - 1
core/sap/src/sap_fsm.c

@@ -2532,7 +2532,7 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx,
 		if (sap_ctx->ch_params.ch_width == CH_WIDTH_160MHZ) {
 			is_dfs = wlan_reg_get_5g_bonded_channel_state_for_freq(
 					mac_ctx->pdev, sap_chan_freq,
-					CH_WIDTH_160MHZ);
+					CH_WIDTH_160MHZ) == CHANNEL_STATE_DFS;
 		} else if (sap_ctx->ch_params.ch_width == CH_WIDTH_80P80MHZ) {
 			if (wlan_reg_get_channel_state_for_freq(
 							mac_ctx->pdev,

+ 20 - 13
core/sap/src/sap_module.c

@@ -1667,29 +1667,36 @@ wlansap_set_cac_required_for_chan(struct mac_context *mac_ctx,
 {
 	bool is_ch_dfs = false;
 	bool cac_required;
-	uint32_t channel;
+	uint32_t chan_freq;
 	uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	uint32_t freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	uint8_t sta_cnt, i;
 
-	channel = wlan_reg_freq_to_chan(mac_ctx->pdev, sap_ctx->chan_freq);
-
+	chan_freq = sap_ctx->chan_freq;
 	if (sap_ctx->ch_params.ch_width == CH_WIDTH_160MHZ) {
 		is_ch_dfs = true;
 	} else if (sap_ctx->ch_params.ch_width == CH_WIDTH_80P80MHZ) {
-		if ((wlan_reg_get_channel_state(mac_ctx->pdev, channel) ==
-						CHANNEL_STATE_DFS) ||
-		    (wlan_reg_get_channel_state(mac_ctx->pdev,
-					sap_ctx->ch_params.center_freq_seg1 -
-					SIR_80MHZ_START_CENTER_CH_DIFF) ==
-					CHANNEL_STATE_DFS))
+		if (wlan_reg_get_channel_state_for_freq(
+						mac_ctx->pdev,
+						sap_ctx->chan_freq) ==
+		    CHANNEL_STATE_DFS ||
+		    wlan_reg_get_channel_state_for_freq(
+					mac_ctx->pdev,
+					sap_ctx->ch_params.mhz_freq_seg1) ==
+				CHANNEL_STATE_DFS)
+			is_ch_dfs = true;
+	} else {
+		if (wlan_reg_get_channel_state_for_freq(
+						mac_ctx->pdev,
+						sap_ctx->chan_freq) ==
+		    CHANNEL_STATE_DFS)
 			is_ch_dfs = true;
-	} else if (wlan_reg_get_channel_state(mac_ctx->pdev, channel) ==
-					      CHANNEL_STATE_DFS) {
-		is_ch_dfs = true;
 	}
+	if (WLAN_REG_IS_6GHZ_CHAN_FREQ(sap_ctx->chan_freq))
+		is_ch_dfs = false;
+
 	sap_debug("vdev id %d chan %d is_ch_dfs %d pre_cac_complete %d ignore_cac %d cac_state %d",
-		  sap_ctx->sessionId, channel, is_ch_dfs,
+		  sap_ctx->sessionId, chan_freq, is_ch_dfs,
 		  sap_ctx->pre_cac_complete, mac_ctx->sap.SapDfsInfo.ignore_cac,
 		  mac_ctx->sap.SapDfsInfo.cac_state);