From 9a9266eac5a2e5a551faf80ec9646a854aa2bd9e Mon Sep 17 00:00:00 2001 From: "Selvaraj, Sridhar" Date: Fri, 16 Sep 2016 14:19:43 +0530 Subject: [PATCH] qcacld-3.0: Start BSS on operating band based on ACS hw mode qcacld-2.0 to qcacld-3.0 propagation. Currently, SAP start's on 2.4ghz channels on detecting unsafe channels even though operating band ACS hw mode is configured on 5ghz channels. Fix is to start BSS on band based on ACS hw mode Change-Id: I210937b4b464c408d5a22c348c028fa9a11b2142 CRs-Fixed: 1005327 --- core/sap/src/sap_api_link_cntl.c | 15 ++++++--------- core/sap/src/sap_fsm.c | 27 +++++++++++++++++++++++++-- core/sap/src/sap_internal.h | 1 + 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index bf694c2ed6db..2447879bcab7 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -325,14 +325,9 @@ wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, void *pcontext, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, FL("CSR scan_status = eCSR_SCAN_ABORT/FAILURE (%d), choose default channel"), scan_status); -#ifdef SOFTAP_CHANNEL_RANGE - if (sap_ctx->acs_cfg->hw_mode == eCSR_DOT11_MODE_11a) - sap_ctx->channel = SAP_DEFAULT_5GHZ_CHANNEL; - else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; -#else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; -#endif + sap_ctx->channel = + sap_select_default_oper_chan(hal_handle, + sap_ctx->acs_cfg->hw_mode); sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED; sap_ctx->sap_status = eSAP_STATUS_SUCCESS; goto close_session; @@ -396,7 +391,9 @@ wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, void *pcontext, goto close_session; } else { #else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; + sap_ctx->channel = + sap_select_default_oper_chan(hal_handle, + sap_ctx->acs_cfg->hw_mode); } 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 32fca747bc2e..8eef7af80814 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2089,6 +2089,28 @@ sap_dfs_is_channel_in_nol_list(ptSapContext sap_context, return false; } +/** + * sap_select_default_oper_chan() - Select operating channel based on acs hwmode + * @hal: pointer to HAL + * @acs_hwmode: HW mode of ACS + * + * Return: selected operating channel + */ +uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode) +{ + uint8_t channel; + + if ((acs_hwmode == QCA_ACS_MODE_IEEE80211A) || + (acs_hwmode == QCA_ACS_MODE_IEEE80211AD)) + channel = SAP_DEFAULT_5GHZ_CHANNEL; + else + channel = SAP_DEFAULT_24GHZ_CHANNEL; + + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, + FL("channel selected to start bss %d"), channel); + return channel; +} + /** * sap_goto_channel_sel - Function for initiating scan request for SME * @sap_context: Sap Context value. @@ -2297,8 +2319,9 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("SAP Configuring default channel, Ch=%d"), sap_context->channel); - /* In case of error, switch to default channel */ - sap_context->channel = SAP_DEFAULT_24GHZ_CHANNEL; + sap_context->channel = + sap_select_default_oper_chan(h_hal, + sap_context->acs_cfg->hw_mode); #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 e8e50f6350ed..dc52e2fe304c 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -434,4 +434,5 @@ QDF_STATUS sap_close_session(tHalHandle hHal, #ifdef __cplusplus } #endif +uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode); #endif