From 25701b0bd387e9236bf0609d11eca6b04e2030bf Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Fri, 16 Apr 2021 18:45:37 +0530 Subject: [PATCH] qcacld-3.0: Allow MCC if STA ch is non-preferred and sap ACS 1-11 If STA is present on non-preferred channel i.e. 12, 13, 14 and SAP ACS channel list is 1-11 then MCC is preferable as SAP don't want to come up on non-preferable channel. Change-Id: I82bd707c26258e0bf0b7cc14657185d11f56f757 CRs-Fixed: 2922824 --- core/sap/src/sap_fsm.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 8fbe265e821a..d90181efd543 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -763,6 +763,26 @@ uint32_t sap_select_default_oper_chan(struct mac_context *mac_ctx, return default_freq; } +static bool is_mcc_preferred(struct sap_context *sap_context, + uint32_t con_ch_freq) +{ + /* + * If SAP ACS channel list is 1-11 and STA is on non-preferred + * channel i.e. 12, 13, 14 then MCC is unavoidable. This is because + * if SAP is started on 12,13,14 some clients may not be able to + * join dependending on their regulatory country. + */ + if ((con_ch_freq >= 2467) && (con_ch_freq <= 2484) && + (sap_context->acs_cfg->start_ch_freq >= 2412 && + sap_context->acs_cfg->end_ch_freq <= 2462)) { + sap_debug("conc ch freq %d & sap acs ch list is 1-11, prefer mcc", + con_ch_freq); + return true; + } + + return false; +} + QDF_STATUS sap_validate_chan(struct sap_context *sap_context, bool pre_start_bss, @@ -852,9 +872,12 @@ sap_validate_chan(struct sap_context *sap_context, mac_ctx->pdev, &ch_params, con_ch_freq) || sta_sap_scc_on_dfs_chan)) { + if (is_mcc_preferred(sap_context, con_ch_freq)) + goto validation_done; + sap_debug("Override ch freq %d to %d due to CC Intf", sap_context->chan_freq, - con_ch_freq); + con_ch_freq); sap_context->chan_freq = con_ch_freq; sap_context->ch_params.ch_width = wlan_sap_get_concurrent_bw(mac_ctx->pdev,