From e423549d8ea78c1e5af6416e646ccab2a89326ad Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 5 May 2020 14:13:31 +0530 Subject: [PATCH] qcacld-3.0: Add support for DFS channel weightage in ACS Add support to provide the channel weightage of DFS channels so that the weight can be configured and the user can control whether they are allowed to be selected for the SAP. Change-Id: I53a22a0059d56aa8fca66215fed1ed0588db7db5 CRs-Fixed: 2676919 --- components/mlme/core/src/wlan_mlme_main.c | 2 +- components/mlme/dispatcher/inc/cfg_mlme_acs.h | 41 ++++++++++++++++++- .../dispatcher/inc/wlan_mlme_public_struct.h | 3 ++ core/sap/src/sap_ch_select.c | 9 ++++ core/sap/src/sap_fsm.c | 4 ++ 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index a9cc0cb573db..dd168f55af8a 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1311,7 +1311,7 @@ static void mlme_init_acs_cfg(struct wlan_objmgr_psoc *psoc, cfg_get(psoc, CFG_USER_ACS_DFS_LTE); acs->is_external_acs_policy = cfg_get(psoc, CFG_EXTERNAL_ACS_POLICY); - + acs->np_chan_weightage = cfg_get(psoc, CFG_ACS_NP_CHAN_WEIGHT); mlme_acs_parse_weight_list(psoc, acs); } diff --git a/components/mlme/dispatcher/inc/cfg_mlme_acs.h b/components/mlme/dispatcher/inc/cfg_mlme_acs.h index b71c33c803a6..5782369b58ad 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_acs.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_acs.h @@ -202,6 +202,44 @@ 0, \ "Force start SAP") +/* + * + * np_chan_weight - chan weightage for non preferred channels + * @Min: 0x00000000 + * @Max: 0x64646464 + * @Default: 0x00000000 + * + * This INI give percentage value of weights to be considered in the ACS algo + * for the non preferred channels. the distribution of the channel type is:- + * Example:- If the percentage of lets say DFS channels is set to 50%, and + * the weight comes out to be x, then we would increase the weight of DFS + * channels by 50% ( 100 - y% set in INI), so that it gets de-prioritized in + * the ACS sorted channel list, the lesser the weight, the better the channel. + * So the channel with more weight is less likely to be selected. So by default + * the np chan weightage for DFS is set to 0, that is it will be assigned max + * weightage, so no probality of getting selected, as for standlaone, DFS is not + * recommended (it takes 60 sec/10min to start depending upon channel type). + * + * Indexes are defined in this way. + * 0 Index (BITS 0-7): DFS - Def 0% + * 1 Index (BITS 8-15): Reserved + * 2 Index (BITS 16-23): Reserved + * 3 Index (BITS 24-31): Reserved + * These percentage values are stored in HEX. Max can be 0x64 + * Supported Feature: ACS + * + * Usage: External + * + * + */ +#define CFG_ACS_NP_CHAN_WEIGHT CFG_INI_UINT( \ + "np_chan_weight", \ + 0x00000000, \ + 0x64646464, \ + 0x00000000, \ + CFG_VALUE_OR_DEFAULT, \ + "np chan weight") + #define CFG_ACS_ALL \ CFG(CFG_ACS_WITH_MORE_PARAM) \ CFG(CFG_AUTO_CHANNEL_SELECT_WEIGHT) \ @@ -209,6 +247,7 @@ CFG(CFG_USER_ACS_DFS_LTE) \ CFG(CFG_EXTERNAL_ACS_POLICY) \ CFG(CFG_NORMALIZE_ACS_WEIGHT) \ - CFG(CFG_ACS_FORCE_START_SAP) + CFG(CFG_ACS_FORCE_START_SAP) \ + CFG(CFG_ACS_NP_CHAN_WEIGHT) #endif /* __CFG_MLME_ACS_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 7ffb27b814fe..504b60b93da8 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1221,6 +1221,7 @@ struct acs_weight_range { }; #define MAX_ACS_WEIGHT_RANGE 10 +#define MLME_GET_DFS_CHAN_WEIGHT(np_chan_weight) (np_chan_weight & 0x000000FF) /* * struct wlan_mlme_acs - All acs related cfg items @@ -1235,6 +1236,7 @@ struct acs_weight_range { * @num_weight_range: num of ranges provided by user * @force_sap_start: Force SAP start when no channel is found suitable * by ACS + * @np_chan_weightage: Weightage to be given to non preferred channels. */ struct wlan_mlme_acs { bool is_acs_with_more_param; @@ -1247,6 +1249,7 @@ struct wlan_mlme_acs { struct acs_weight_range normalize_weight_range[MAX_ACS_WEIGHT_RANGE]; uint16_t num_weight_range; bool force_sap_start; + uint32_t np_chan_weightage; }; /* diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 0faf793940c7..8da54f2b31bb 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -1407,6 +1407,15 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams, chan_freq = pSpectCh->chan_freq; + if (wlan_reg_is_dfs_for_freq(mac->pdev, chan_freq)) { + normalize_factor = + MLME_GET_DFS_CHAN_WEIGHT( + mac->mlme_cfg->acs.np_chan_weightage); + freq_present_in_list = true; + sap_debug_rl("DFS channel weightage %d", + normalize_factor); + } + /* Check if the freq is present in range list */ for (i = 0; i < mac->mlme_cfg->acs.num_weight_range; i++) { if (chan_freq >= range_list[i].start_freq && diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 98fb643e07f1..9959fb0db43d 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -3407,6 +3407,10 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx, mac_ctx->psoc, WLAN_REG_CH_TO_FREQ(loop_count))) continue; + normalize_factor = + MLME_GET_DFS_CHAN_WEIGHT( + mac_ctx->mlme_cfg->acs.np_chan_weightage); + freq_present_in_list = true; } /* Dont scan ETSI13 SRD channels if the ETSI13 SRD channels