diff options
author | gaurank kathpalia <gkathpal@codeaurora.org> | 2019-12-30 10:32:29 +0530 |
---|---|---|
committer | Isaac Chiou <isaacchiou@google.com> | 2020-01-31 08:24:40 +0000 |
commit | 03dac54f7f20be6d799aa0349fcae5466cf5117a (patch) | |
tree | 932e1d2b4dd5061bee3a845ad981c897225afe88 /core | |
parent | 05007d5bba53fbc4472829b39993748c1b165eb2 (diff) | |
download | qcacld-03dac54f7f20be6d799aa0349fcae5466cf5117a.tar.gz |
qcacld-3.0: Use policy mgr safe ch list in ACS
Currently the driver uses a global safe channel
list, and also keeps another safe channel list in
policy mgr which results in duplicate copies
of the same thing.
Also there are many possible issues which are seen
if the global list implementation is used.
Issue 1:-
The global unsafe ch list is maintained for each
channel and is updated as part of ACS scan cb.
So if a user does ACS again and again ( SAP on off)
then the result of unsafe channels of the previous
ACS request would be updated as part of the ACS cb
of the new ACS scan request.
In the function of sap_get_freq_list, the driver
filters out the channels which are unsafe, and the
same channels are not chosen as the best channel for
SAP operation.
Now the filtration of the channels would happen
according to the previous ACS request, and the driver
would remove the channels from the ACS scan list.
But those channels were unsafe when the previous ACS
happened, and may not be unsafe now, and can be used
to turn on the SAP (can be chosen as the best channel)
Issue 2:-
If the channels are truly unsafe, then the driver
filters out the channel in the function sap_get_freq_list,
and do not chose them for the SAP.
It may happen that the channel list that the driver
preferred as part of do acs becomes unsafe, and the
channels that were unsafe at the time of do acs becomes
safe while the driver was scanning the ACS channels to
find other APs.
Now since the channels that were unsafe at the time of
ACS req are safe now, they could have been chosen as the
best channel but they were not scanned, so the ACS channel
weight of these channels would remain maximum, and they
would be sorted at last of the sorted list.
Also the channels that were as part of the ACS channels list
became unsafe, hence the driver would also assign maximum
weight to them, and they would too become unusable channels.
This would result in all channels having the same weight that
is maximum weight, and so the sorting algorithm does not have
to sort any channel now since all of the weights are same.
The first channel in the sorted list would be channel number
1 of 2.4Ghz, and would get chosen, but this may not be
correct if the HW mode is 5ghz only.
Fix:-
Safe and unsafe channels can be checked by using
policy mgr safe channel list too, so it is better
to keep just one unsafe channel list.
The driver would not filter out the unsafe channels
for ACS scan, and would filter out the unsafe channels
as part of the ACS scan done callback.
Bug: 142287550
Change-Id: Ief236db9e73864e5cb2d290a8106799f9e80f82d
CRs-Fixed: 2530241
Signed-off-by: Isaac Chiou <isaacchiou@google.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/sap/inc/sap_api.h | 9 | ||||
-rw-r--r-- | core/sap/src/sap_ch_select.c | 242 | ||||
-rw-r--r-- | core/sap/src/sap_fsm.c | 21 | ||||
-rw-r--r-- | core/sap/src/sap_internal.h | 6 |
4 files changed, 7 insertions, 271 deletions
diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index cc6252caa6..28d98eab5d 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -874,13 +874,6 @@ typedef struct sap_SoftapStats_s { #endif } tSap_SoftapStats, *tpSap_SoftapStats; -#ifdef FEATURE_WLAN_CH_AVOID -/* Store channel safety information */ -typedef struct { - uint16_t channelNumber; - bool isSafe; -} sapSafeChannelType; -#endif /* FEATURE_WLAN_CH_AVOID */ void sap_cleanup_channel_list(void *sapContext); void sapCleanupAllChannelList(void); diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index f8352dc541..7cecd4b4ab 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -128,52 +128,6 @@ #define ACS_WEIGHT_SOFTAP_TX_POWER_THROUGHPUT_CFG(weights) \ (((weights) & 0xf00000) >> 20) -#ifdef FEATURE_WLAN_CH_AVOID -sapSafeChannelType safe_channels[NUM_CHANNELS] = { - {1, true}, - {2, true}, - {3, true}, - {4, true}, - {5, true}, - {6, true}, - {7, true}, - {8, true}, - {9, true}, - {10, true}, - {11, true}, - {12, true}, - {13, true}, - {14, true}, - {36, true}, - {40, true}, - {44, true}, - {48, true}, - {52, true}, - {56, true}, - {60, true}, - {64, true}, - {100, true}, - {104, true}, - {108, true}, - {112, true}, - {116, true}, - {120, true}, - {124, true}, - {128, true}, - {132, true}, - {136, true}, - {140, true}, - {144, true}, - {149, true}, - {153, true}, - {157, true}, - {161, true}, - {165, true}, - {169, true}, - {173, true}, -}; -#endif - typedef struct { uint16_t chStartNum; uint32_t weight; @@ -401,81 +355,6 @@ static void sap_process_avoid_ie(tHalHandle hal, } #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ -#ifdef FEATURE_WLAN_CH_AVOID -/*========================================================================== - FUNCTION sap_update_unsafe_channel_list - - DESCRIPTION - Function Undate unsafe channel list table - - DEPENDENCIES - NA. - - IN - SapContext pointer - - RETURN VALUE - NULL - ============================================================================*/ -void sap_update_unsafe_channel_list(ptSapContext pSapCtx) -{ - uint16_t i, j; - uint16_t unsafe_channel_list[NUM_CHANNELS]; - uint16_t unsafe_channel_count = 0; - qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); - - if (!qdf_ctx) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_FATAL, - "qdf_ctx is NULL"); - return; - } - - /* Flush, default set all channel safe */ - for (i = 0; i < NUM_CHANNELS; i++) { - safe_channels[i].isSafe = true; - } - - /* Try to find unsafe channel */ -#if defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE) - for (i = 0; i < NUM_CHANNELS; i++) { - if (pSapCtx->dfs_ch_disable == true) { - if (CDS_IS_DFS_CH(safe_channels[i].channelNumber)) { - safe_channels[i].isSafe = false; - QDF_TRACE(QDF_MODULE_ID_SAP, - QDF_TRACE_LEVEL_DEBUG, - "%s: DFS Ch %d is not safe in" - " Concurrent mode", - __func__, - safe_channels[i].channelNumber); - } - } - } -#endif - pld_get_wlan_unsafe_channel(qdf_ctx->dev, - unsafe_channel_list, - &unsafe_channel_count, - sizeof(unsafe_channel_list)); - - for (i = 0; i < unsafe_channel_count; i++) { - for (j = 0; j < NUM_CHANNELS; j++) { - if (safe_channels[j].channelNumber == - unsafe_channel_list[i]) { - /* Found unsafe channel, update it */ - safe_channels[j].isSafe = false; - QDF_TRACE(QDF_MODULE_ID_SAP, - QDF_TRACE_LEVEL_DEBUG, - FL("CH %d is not safe"), - unsafe_channel_list[i]); - break; - } - } - } - - return; -} - -#endif /* FEATURE_WLAN_CH_AVOID */ - /*========================================================================== FUNCTION sap_cleanup_channel_list @@ -635,9 +514,6 @@ static bool sap_chan_sel_init(tHalHandle halHandle, uint16_t channelnum = 0; tpAniSirGlobal pMac = PMAC_STRUCT(halHandle); bool chSafe = true; -#ifdef FEATURE_WLAN_CH_AVOID - uint16_t i; -#endif uint32_t dfs_master_cap_enabled; bool include_dfs_ch = true; bool sta_sap_scc_on_dfs_chan = @@ -714,19 +590,8 @@ static bool sap_chan_sel_init(tHalHandle halHandle, } } -#ifdef FEATURE_WLAN_CH_AVOID - for (i = 0; i < NUM_CHANNELS; i++) { - if ((safe_channels[i].channelNumber == *pChans) && - (false == safe_channels[i].isSafe)) { - QDF_TRACE(QDF_MODULE_ID_SAP, - QDF_TRACE_LEVEL_DEBUG, - "In %s, Ch %d is not safe", __func__, - *pChans); - chSafe = false; - break; - } - } -#endif /* FEATURE_WLAN_CH_AVOID */ + if (!cds_is_safe_channel(*pChans)) + chSafe = false; /* OFDM rates are not supported on channel 14 */ if (*pChans == 14 && @@ -2564,101 +2429,6 @@ static bool sap_is_ch_non_overlap(ptSapContext sap_ctx, uint16_t ch) return false; } -#ifdef FEATURE_WLAN_CH_AVOID -/** - * sap_select_channel_no_scan_result() - select SAP channel when no scan results - * are available. - * @sap_ctx: Sap context - * - * Returns: channel number if success, 0 otherwise - */ -static uint8_t sap_select_channel_no_scan_result(tHalHandle hal, - ptSapContext sap_ctx) -{ - enum channel_state ch_type; - uint8_t i, first_safe_ch_in_range = SAP_CHANNEL_NOT_SELECTED; - uint32_t dfs_master_cap_enabled; - uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch; - uint32_t end_ch_num = sap_ctx->acs_cfg->end_ch; - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - FL("start - end: %d - %d"), start_ch_num, end_ch_num); - - sme_cfg_get_int(hal, WNI_CFG_DFS_MASTER_ENABLED, - &dfs_master_cap_enabled); - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - "%s: dfs_master %x", __func__, dfs_master_cap_enabled); - - /* get a channel in PCL and within the range */ - for (i = 0; i < sap_ctx->acs_cfg->pcl_ch_count; i++) { - if ((sap_ctx->acs_cfg->pcl_channels[i] < start_ch_num) || - (sap_ctx->acs_cfg->pcl_channels[i] > end_ch_num)) - continue; - - first_safe_ch_in_range = sap_ctx->acs_cfg->pcl_channels[i]; - break; - } - - if (SAP_CHANNEL_NOT_SELECTED != first_safe_ch_in_range) - return first_safe_ch_in_range; - - for (i = 0; i < NUM_CHANNELS; i++) { - if ((safe_channels[i].channelNumber < start_ch_num) || - (safe_channels[i].channelNumber > end_ch_num)) - continue; - - ch_type = cds_get_channel_state(safe_channels[i].channelNumber); - - if ((ch_type == CHANNEL_STATE_DISABLE) || - (ch_type == CHANNEL_STATE_INVALID)) - continue; - if ((!dfs_master_cap_enabled) && - (CHANNEL_STATE_DFS == ch_type)) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - "%s: DFS master mode disabled. Skip DFS channel %d", - __func__, safe_channels[i].channelNumber); - continue; - } - if ((sap_ctx->dfs_mode == ACS_DFS_MODE_DISABLE) && - (CHANNEL_STATE_DFS == ch_type)) - continue; - - if (safe_channels[i].isSafe == true) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - FL("channel %d in the configuration is safe"), - safe_channels[i].channelNumber); - first_safe_ch_in_range = safe_channels[i].channelNumber; - break; - } - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - FL("channel %d in the configuration is unsafe"), - safe_channels[i].channelNumber); - } - - /* if no channel selected return SAP_CHANNEL_NOT_SELECTED */ - return first_safe_ch_in_range; -} -#else -static uint8_t sap_select_channel_no_scan_result(tHalHandle hal, - ptSapContext sap_ctx) -{ - uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch; - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, - FL("start - end: %d - %d"), - start_ch_num, - sap_ctx->acs_cfg->end_ch); - - sap_ctx->acs_cfg->pri_ch = start_ch_num; - sap_ctx->acs_cfg->ht_sec_ch = 0; - - /* pick the first channel in configured range */ - return start_ch_num; -} -#endif /* FEATURE_WLAN_CH_AVOID */ - /** * sap_select_channel() - select SAP channel * @hal: Pointer to HAL handle @@ -2685,10 +2455,6 @@ uint8_t sap_select_channel(tHalHandle hal, ptSapContext sap_ctx, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, "In %s, Running SAP Ch Select", __func__); -#ifdef FEATURE_WLAN_CH_AVOID - sap_update_unsafe_channel_list(sap_ctx); -#endif - /* * If ACS weight is not enabled on noise_floor/channel_free/tx_power, * then skip acs process if no bss found. @@ -2701,7 +2467,7 @@ uint8_t sap_select_channel(tHalHandle hal, ptSapContext sap_ctx, #ifndef SOFTAP_CHANNEL_RANGE return SAP_CHANNEL_NOT_SELECTED; #else - return sap_select_channel_no_scan_result(hal, sap_ctx); + return sap_select_default_oper_chan(sap_ctx->acs_cfg); #endif } diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 92770aad9d..a6387edc7c 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -67,10 +67,6 @@ /*---------------------------------------------------------------------------- * External declarations for global context * -------------------------------------------------------------------------*/ -#ifdef FEATURE_WLAN_CH_AVOID -extern sapSafeChannelType safe_channels[]; -#endif /* FEATURE_WLAN_CH_AVOID */ - /*---------------------------------------------------------------------------- * Static Variable Definitions * -------------------------------------------------------------------------*/ @@ -4872,9 +4868,7 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, uint8_t end_ch_num, band_end_ch; uint32_t en_lte_coex; tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx); -#ifdef FEATURE_WLAN_CH_AVOID uint8_t i; -#endif tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); tSapChSelSpectInfo spect_info_obj = { NULL, 0 }; uint16_t ch_width; @@ -4983,13 +4977,6 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, continue; } -#ifdef FEATURE_WLAN_CH_AVOID - for (i = 0; i < NUM_CHANNELS; i++) { - if (safe_channels[i].channelNumber == - CDS_CHANNEL_NUM(loop_count)) { - /* Check if channel is safe */ - if (true == safe_channels[i].isSafe) { -#endif #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE uint8_t ch; @@ -5026,12 +5013,6 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, list[ch_count] = CDS_CHANNEL_NUM(loop_count); ch_count++; #endif -#ifdef FEATURE_WLAN_CH_AVOID - } - break; - } - } -#endif } for (i = 0; i < ch_count; i++) { diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 24991f1550..5ad7c5f2c3 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -374,10 +374,6 @@ QDF_STATUS sap_acquire_global_lock(ptSapContext pSapCtx); QDF_STATUS sap_release_global_lock(ptSapContext pSapCtx); -#ifdef FEATURE_WLAN_CH_AVOID -void sap_update_unsafe_channel_list(ptSapContext pSapCtx); -#endif /* FEATURE_WLAN_CH_AVOID */ - uint8_t sap_indicate_radar(ptSapContext sapContext, tSirSmeDfsEventInd *dfs_event); |