From c46581bc1cd6c3b85473e9f56e14223213c5c71c Mon Sep 17 00:00:00 2001 From: wadesong Date: Tue, 26 Dec 2017 13:29:29 +0800 Subject: [PATCH] qcacld-3.0: Fix an ACS hw mode mapping discrepancy When ACS is started, acs_cfg.hw_mode in AP context will be set after mapping from values defined in enum qca_wlan_vendor_acs_hw_mode to values defined in enum eCsrPhyMode, but when ACS scan fails due to some reason, such as scan timeout, the code in function sap_select_default_oper_chan is still using values defined in enum qca_wlan_vendor_acs_hw_mode to setup the default channel. Change the code in function sap_select_default_oper_chan to use the values defined in enum eCsrPhyMode when setting up the default channel. Change-Id: Ic0d43c43bf9b9a9a36c290d2754c30ebb40bb0e3 CRs-Fixed: 2163658 --- core/sap/src/sap_api_link_cntl.c | 6 +++--- core/sap/src/sap_fsm.c | 30 ++++++++++++++++++++++++------ core/sap/src/sap_internal.h | 5 +++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index 484dec3691..e5f8f1c334 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -312,7 +312,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, scan_status); sap_ctx->channel = sap_select_default_oper_chan(hal_handle, - sap_ctx->acs_cfg->hw_mode); + sap_ctx->acs_cfg); sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED; sap_ctx->sap_status = eSAP_STATUS_SUCCESS; goto close_session; @@ -378,7 +378,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, #else sap_ctx->channel = sap_select_default_oper_chan(hal_handle, - sap_ctx->acs_cfg->hw_mode); + sap_ctx->acs_cfg); } else { #endif /* Valid Channel Found from scan results. */ diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index ceb675dfae..1f6d4464d2 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1625,17 +1625,35 @@ sap_dfs_is_channel_in_nol_list(struct sap_context *sap_context, /** * sap_select_default_oper_chan() - Select operating channel based on acs hwmode * @hal: pointer to HAL - * @acs_hwmode: HW mode of ACS + * @acs_cfg: ACS config info * * Return: selected operating channel */ -uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode) +uint8_t sap_select_default_oper_chan(tHalHandle hal, + struct sap_acs_cfg *acs_cfg) { uint8_t channel; - if ((acs_hwmode == QCA_ACS_MODE_IEEE80211A) || - (acs_hwmode == QCA_ACS_MODE_IEEE80211AD)) + if (NULL == acs_cfg) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + "ACS config invalid!"); + QDF_BUG(0); + return 0; + } + + if (acs_cfg->hw_mode == eCSR_DOT11_MODE_11a) channel = SAP_DEFAULT_5GHZ_CHANNEL; + else if ((acs_cfg->hw_mode == eCSR_DOT11_MODE_11n) || + (acs_cfg->hw_mode == eCSR_DOT11_MODE_11n_ONLY) || + (acs_cfg->hw_mode == eCSR_DOT11_MODE_11ac) || + (acs_cfg->hw_mode == eCSR_DOT11_MODE_11ac_ONLY) || + (acs_cfg->hw_mode == eCSR_DOT11_MODE_11ax) || + (acs_cfg->hw_mode == eCSR_DOT11_MODE_11ax_ONLY)) { + if (WLAN_REG_IS_5GHZ_CH(acs_cfg->start_ch)) + channel = SAP_DEFAULT_5GHZ_CHANNEL; + else + channel = SAP_DEFAULT_24GHZ_CHANNEL; + } else channel = SAP_DEFAULT_24GHZ_CHANNEL; @@ -1870,7 +1888,7 @@ QDF_STATUS sap_goto_channel_sel(struct sap_context *sap_context, sap_context->channel); sap_context->channel = sap_select_default_oper_chan(h_hal, - sap_context->acs_cfg->hw_mode); + sap_context->acs_cfg); #ifdef SOFTAP_CHANNEL_RANGE if (sap_context->channelList != NULL) { diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 1162773c0f..5e814d55ad 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -475,5 +475,6 @@ uint8_t sap_indicate_radar(struct sap_context *sap_ctx); #ifdef __cplusplus } #endif -uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode); +uint8_t sap_select_default_oper_chan(tHalHandle hal, + struct sap_acs_cfg *acs_cfg); #endif