From a92bb13dfc243fc4413ce439cdaa503696187920 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Fri, 17 May 2019 00:10:19 +0530 Subject: [PATCH] qcacld-3.0: Filter SAP based upon ACS channel list Scenario: 1. Start SAP on any potential LTE-COEX channel. 2. SAP would restart when it gets the event of unsafe channel. Observation: SAP restarts on a channel not in ACS channel list. Expectation: SAP should restart in channels given by the user space only which are configured by hostapd. Issue with driver: Currently in wlansap_filter_ch_based_acs, the driver eliminates the channels based upon the ACS start, and end channel, and not the channel list, which can lead to almost all the channels being picked, and none eliminated if the start channel was 1, and end channel was 165, even when only two channels, say 1 and 165 only were present in ACS channel list. Fix: Fix is to eliminate all the candidate channels which were not part of the ACS channel list, and pick only those channels that were part of initial do_acs request. Change-Id: Ib3b0b0a77c07b423b66e99feb085a370ed01f2de CRs-Fixed: 2454270 --- core/sap/src/sap_module.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 65712b9dee19..af6e91398180 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2725,6 +2725,26 @@ QDF_STATUS wlansap_update_owe_info(struct sap_context *sap_ctx, return status; } +static bool wlansap_is_channel_present_in_acs_list(uint8_t ch, + uint8_t *ch_list, + uint8_t ch_count) +{ + uint8_t i; + + for(i = 0; i < ch_count; i++) { + if (ch_list[i] == ch) { + /* + * channel was given by hostpad for ACS, and is present + * in PCL. + */ + sap_debug("channel present in ACS channel list %d", ch); + return true; + } + } + + return false; +} + QDF_STATUS wlansap_filter_ch_based_acs(struct sap_context *sap_ctx, uint8_t *ch_list, uint32_t *ch_cnt) @@ -2738,8 +2758,9 @@ QDF_STATUS wlansap_filter_ch_based_acs(struct sap_context *sap_ctx, } for (ch_index = 0; ch_index < *ch_cnt; ch_index++) { - if (ch_list[ch_index] >= sap_ctx->acs_cfg->start_ch && - ch_list[ch_index] <= sap_ctx->acs_cfg->end_ch) + if (wlansap_is_channel_present_in_acs_list(ch_list[ch_index], + sap_ctx->acs_cfg->ch_list, + sap_ctx->acs_cfg->ch_list_count)) ch_list[target_ch_cnt++] = ch_list[ch_index]; }