From bdffeb8d955fdedc66d894ddd8e9c50a69b5eadf Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Fri, 13 Jul 2018 09:19:09 +0530 Subject: [PATCH] qcacmn: Fix channel selection in case of DFS in ACS algo The driver includes the DFS channel in case of force SCC, on 5GHz band, and rejects all 2.4Ghz band channels in the ACS scan list in case of band_width > 40. The DFS SCC not allowed till date prevents the SAP vdev up on that DFS channel, hence the SAP turns on with default channel of 2.4 Ghz i.e channel 1, because the ACS scan channel list didn't contain any 2.4Ghz channel. Fix is to include the 2.4Ghz channel list, and remove that DFS channel in case the force SCC is enabled, and STA is already up on that channel. Change-Id: I1dc14d3890d8128e83910c2bed1cb95d7f70ea1c CRs-Fixed: 2261802 --- src/wlan_policy_mgr_get_set_utils.c | 112 +++++++++++++++------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/src/wlan_policy_mgr_get_set_utils.c b/src/wlan_policy_mgr_get_set_utils.c index 281a6845590e..d81e6d17a775 100644 --- a/src/wlan_policy_mgr_get_set_utils.c +++ b/src/wlan_policy_mgr_get_set_utils.c @@ -2887,7 +2887,7 @@ void policy_mgr_trim_acs_channel_list(struct wlan_objmgr_psoc *psoc, uint8_t *org_ch_list, uint8_t *org_ch_list_count) { uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; - uint32_t index, count, i, ch_list_count; + uint32_t index = 0, count, i, ch_list_count; uint8_t band_mask = 0, ch_5g = 0, ch_24g = 0; uint8_t ch_list[QDF_MAX_NUM_CHAN]; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2909,61 +2909,67 @@ void policy_mgr_trim_acs_channel_list(struct wlan_objmgr_psoc *psoc, */ count = policy_mgr_mode_specific_connection_count( psoc, PM_STA_MODE, list); - if (policy_mgr_is_force_scc(psoc) && count) { - index = 0; - while (index < count) { - if (WLAN_REG_IS_24GHZ_CH( - pm_conc_connection_list[list[index]].chan) && - policy_mgr_is_safe_channel(psoc, - pm_conc_connection_list[list[index]].chan)) { - band_mask |= 1; - ch_24g = pm_conc_connection_list[list[index]].chan; - } - if (WLAN_REG_IS_5GHZ_CH( - pm_conc_connection_list[list[index]].chan) && - policy_mgr_is_safe_channel(psoc, - pm_conc_connection_list[list[index]].chan) && - !wlan_reg_is_dfs_ch(pm_ctx->pdev, - pm_conc_connection_list[list[index]].chan) && - !wlan_reg_is_passive_or_disable_ch(pm_ctx->pdev, - pm_conc_connection_list[list[index]].chan)) { - band_mask |= 2; - ch_5g = pm_conc_connection_list[list[index]].chan; - } - index++; + if (!(policy_mgr_is_force_scc(psoc) && count)) + return; + while (index < count) { + if (WLAN_REG_IS_24GHZ_CH( + pm_conc_connection_list[list[index]].chan) && + policy_mgr_is_safe_channel(psoc, + pm_conc_connection_list[list[index]].chan)) { + band_mask |= 1; + ch_24g = pm_conc_connection_list[list[index]].chan; } - ch_list_count = 0; - if (band_mask == 1) { - ch_list[ch_list_count++] = ch_24g; - for (i = 0; i < *org_ch_list_count; i++) { - if (WLAN_REG_IS_24GHZ_CH( - org_ch_list[i])) - continue; - ch_list[ch_list_count++] = - org_ch_list[i]; - } - } else if (band_mask == 2) { - ch_list[ch_list_count++] = ch_5g; - for (i = 0; i < *org_ch_list_count; i++) { - if (WLAN_REG_IS_5GHZ_CH( - org_ch_list[i])) - continue; - ch_list[ch_list_count++] = - org_ch_list[i]; - } - } else if (band_mask == 3) { - ch_list[ch_list_count++] = ch_24g; - ch_list[ch_list_count++] = ch_5g; - } else { - policy_mgr_debug("unexpected band_mask value %d", - band_mask); - return; + if (WLAN_REG_IS_5GHZ_CH( + pm_conc_connection_list[list[index]].chan) && + policy_mgr_is_safe_channel(psoc, + pm_conc_connection_list[list[index]].chan) && + !wlan_reg_is_dfs_ch(pm_ctx->pdev, + pm_conc_connection_list[list[index]].chan) && + !wlan_reg_is_passive_or_disable_ch(pm_ctx->pdev, + pm_conc_connection_list[list[index]].chan)) { + band_mask |= 2; + ch_5g = pm_conc_connection_list[list[index]].chan; } - - *org_ch_list_count = ch_list_count; - for (i = 0; i < *org_ch_list_count; i++) - org_ch_list[i] = ch_list[i]; + index++; } + ch_list_count = 0; + if (band_mask == 1) { + ch_list[ch_list_count++] = ch_24g; + for (i = 0; i < *org_ch_list_count; i++) { + if (WLAN_REG_IS_24GHZ_CH( + org_ch_list[i])) + continue; + ch_list[ch_list_count++] = + org_ch_list[i]; + } + } else if (band_mask == 2) { + if ((reg_get_channel_state(pm_ctx->pdev, ch_5g) == + CHANNEL_STATE_DFS) && + policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc)) + ch_list[ch_list_count++] = ch_5g; + else if (!(reg_get_channel_state(pm_ctx->pdev, ch_5g) == + CHANNEL_STATE_DFS)) + ch_list[ch_list_count++] = ch_5g; + for (i = 0; i < *org_ch_list_count; i++) { + if (WLAN_REG_IS_5GHZ_CH( + org_ch_list[i])) + continue; + ch_list[ch_list_count++] = + org_ch_list[i]; + } + } else if (band_mask == 3) { + ch_list[ch_list_count++] = ch_24g; + ch_list[ch_list_count++] = ch_5g; + } else { + policy_mgr_debug("unexpected band_mask value %d", + band_mask); + return; + } + + *org_ch_list_count = ch_list_count; + for (i = 0; i < *org_ch_list_count; i++) + org_ch_list[i] = ch_list[i]; + } uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,