From 5380cd5b8255643181d15f52c42e7223def3b4b7 Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Wed, 29 Jul 2020 15:01:53 +0800 Subject: [PATCH] qcacld-3.0: add api to check if the channel is allowed for sap Check the factors as below to decide whether the channel is allowed or not: * If the channel is in LTE coex channel avoidance list; * If it's STA+SAP SCC; * If STA+SAP SCC on LTE coex channel is allowed. Replace policy_mgr_is_safe_channel() with this new function for sap channel selection and acs channel filtering, to allow unsafe channels when it's STA+SAP SCC and STA+SAP SCC on LTE coex channel is allowed. CRs-Fixed: 2743042 Change-Id: Ic5a84b2628200fe9decf6972f00706f190f04722 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 15 +++++++++++++++ .../policy_mgr/src/wlan_policy_mgr_action.c | 19 +++++++++++++++++++ core/sap/src/sap_api_link_cntl.c | 10 +++++----- core/sap/src/sap_ch_select.c | 5 ++++- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 8afc64a4b5de..b81129ec42a0 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -3014,6 +3014,21 @@ QDF_STATUS policy_mgr_get_updated_scan_and_fw_mode_config( bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, uint32_t ch_freq); +/** + * policy_mgr_is_sap_freq_allowed - Check if the channel is allowed for sap + * @psoc: PSOC object information + * @sap_freq: channel frequency to be checked + * + * Check the factors as below to decide whether the channel is allowed or not: + * If the channel is in LTE coex channel avoidance list; + * If it's STA+SAP SCC; + * If STA+SAP SCC on LTE coex channel is allowed. + * + * Return: true for allowed, else false + */ +bool policy_mgr_is_sap_freq_allowed(struct wlan_objmgr_psoc *psoc, + uint32_t sap_freq); + /** * policy_mgr_get_ch_width() - Convert hw_mode_bandwidth to phy_ch_width * @bw: Hardware mode band width used by WMI diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 0ad42c07956e..bd81fecbc95d 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -1485,6 +1485,25 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, return is_safe; } +bool policy_mgr_is_sap_freq_allowed(struct wlan_objmgr_psoc *psoc, + uint32_t sap_freq) +{ + if (policy_mgr_is_safe_channel(psoc, sap_freq)) + return true; + + /* + * Return true if it's STA+SAP SCC and + * STA+SAP SCC on LTE coex channel is allowed. + */ + if (policy_mgr_sta_sap_scc_on_lte_coex_chan(psoc) && + policy_mgr_is_sta_sap_scc(psoc, sap_freq)) { + policy_mgr_debug("unsafe freq %d for sap is allowed", sap_freq); + return true; + } + + return false; +} + bool policy_mgr_is_sap_restart_required_after_sta_disconnect( struct wlan_objmgr_psoc *psoc, uint32_t sap_vdev_id, uint32_t *intf_ch_freq) diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index a33fd28178b5..8bf3e659ad17 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -237,6 +237,7 @@ wlansap_filter_unsafe_ch(struct wlan_objmgr_psoc *psoc, { uint16_t i; uint16_t num_safe_ch = 0; + uint32_t freq; /* * There are two channel list, one acs cfg channel list, and one @@ -252,13 +253,12 @@ wlansap_filter_unsafe_ch(struct wlan_objmgr_psoc *psoc, * the acs channel list before chosing one of them as a default channel */ for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) { - if (!policy_mgr_is_safe_channel( - psoc, sap_ctx->acs_cfg->freq_list[i])) { - sap_debug("unsafe freq %d removed from acs list", - sap_ctx->acs_cfg->freq_list[i]); + freq = sap_ctx->acs_cfg->freq_list[i]; + if (!policy_mgr_is_sap_freq_allowed(psoc, freq)) { + sap_debug("remove freq %d from acs list", freq); continue; } - /* Add only safe channels to the acs cfg ch list */ + /* Add only allowed channels to the acs cfg ch list */ sap_ctx->acs_cfg->freq_list[num_safe_ch++] = sap_ctx->acs_cfg->freq_list[i]; } diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 3ea5b8755d82..01e8143a6b36 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -472,8 +472,11 @@ static bool sap_chan_sel_init(mac_handle_t mac_handle, } } - if (!policy_mgr_is_safe_channel(mac->psoc, *pChans)) + if (!policy_mgr_is_sap_freq_allowed(mac->psoc, *pChans)) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, + "%s: Skip freq %d", __func__, *pChans); continue; + } /* OFDM rates are not supported on channel 14 */ if (channel == 14 &&