diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 9089b2844776..48a73ad81f6d 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1722,32 +1722,37 @@ static int wlan_hdd_reset_force_acs_chan_range(struct hdd_context *hdd_ctx, } /** - * wlan_hdd_set_acs_ch_range : Start ACS channel range values + * wlan_hdd_set_acs_ch_range : Populate ACS hw mode and channel range values * @sap_cfg: pointer to SAP config struct + * @hw_mode: hw mode retrieved from vendor command buffer + * @ht_enabled: whether HT phy mode is enabled + * @vht_enabled: whether VHT phy mode is enabled * - * This function sets the default ACS start and end channel for the given band - * and also parses the given ACS channel list. + * This function populates the ACS hw mode based on the configuration retrieved + * from the vendor command buffer; and sets ACS start and end channel for the + * given band. * - * Return: status + * Return: 0 if success; -EINVAL if ACS channel list is NULL */ -static int wlan_hdd_set_acs_ch_range(tsap_Config_t *sap_cfg, bool ht_enabled, - bool vht_enabled) +static int wlan_hdd_set_acs_ch_range( + tsap_Config_t *sap_cfg, enum qca_wlan_vendor_acs_hw_mode hw_mode, + bool ht_enabled, bool vht_enabled) { int i; - if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211B) { + if (hw_mode == QCA_ACS_MODE_IEEE80211B) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11b; sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_1); sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_14); - } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211G) { + } else if (hw_mode == QCA_ACS_MODE_IEEE80211G) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11g; sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_1); sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_13); - } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211A) { + } else if (hw_mode == QCA_ACS_MODE_IEEE80211A) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11a; sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_36); sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_165); - } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211ANY) { + } else if (hw_mode == QCA_ACS_MODE_IEEE80211ANY) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_abg; sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_1); sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_165); @@ -2505,7 +2510,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, int status = -EINVAL, i = 0; struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1]; bool ht_enabled, ht40_enabled, vht_enabled; - uint8_t ch_width, hw_mode; + uint8_t ch_width; + enum qca_wlan_vendor_acs_hw_mode hw_mode; QDF_STATUS qdf_status; /* ***Note*** Donot set SME config related to ACS operation here because @@ -2557,8 +2563,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, goto out; } hw_mode = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE]); - /* This value will be overwritten in wlan_hdd_set_acs_ch_range */ - sap_config->acs_cfg.hw_mode = hw_mode; if (tb[QCA_WLAN_VENDOR_ATTR_ACS_HT_ENABLED]) ht_enabled = @@ -2685,7 +2689,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, pcl_channels_weight_list[i]); } - status = wlan_hdd_set_acs_ch_range(sap_config, ht_enabled, vht_enabled); + status = wlan_hdd_set_acs_ch_range(sap_config, hw_mode, + ht_enabled, vht_enabled); if (status) { hdd_err("set acs channel range failed"); goto out; diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 4b7f412f44ba..9cff66e52177 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.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. * @@ -495,7 +495,7 @@ typedef struct sap_SSIDInfo { struct sap_acs_cfg { /* ACS Algo Input */ uint8_t acs_mode; - uint32_t hw_mode; + eCsrPhyMode hw_mode; uint8_t start_ch; uint8_t end_ch; uint8_t *ch_list; diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index e5f8f1c334ce..fe4b65f6eb30 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -311,8 +311,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, FL("CSR scan_status = eCSR_SCAN_ABORT/FAILURE (%d), choose default channel"), scan_status); sap_ctx->channel = - sap_select_default_oper_chan(hal_handle, - sap_ctx->acs_cfg); + sap_select_default_oper_chan(sap_ctx->acs_cfg); sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED; sap_ctx->sap_status = eSAP_STATUS_SUCCESS; goto close_session; @@ -377,8 +376,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, } else { #else sap_ctx->channel = - sap_select_default_oper_chan(hal_handle, - sap_ctx->acs_cfg); + sap_select_default_oper_chan(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 1f6d4464d23b..29c8e9b6b027 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1622,15 +1622,7 @@ sap_dfs_is_channel_in_nol_list(struct sap_context *sap_context, return false; } -/** - * sap_select_default_oper_chan() - Select operating channel based on acs hwmode - * @hal: pointer to HAL - * @acs_cfg: ACS config info - * - * Return: selected operating channel - */ -uint8_t sap_select_default_oper_chan(tHalHandle hal, - struct sap_acs_cfg *acs_cfg) +uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg) { uint8_t channel; @@ -1641,21 +1633,21 @@ uint8_t sap_select_default_oper_chan(tHalHandle hal, return 0; } - if (acs_cfg->hw_mode == eCSR_DOT11_MODE_11a) + 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)) { + } 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 + } else { channel = SAP_DEFAULT_24GHZ_CHANNEL; + } QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, FL("channel selected to start bss %d"), channel); @@ -1886,8 +1878,7 @@ QDF_STATUS sap_goto_channel_sel(struct sap_context *sap_context, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("SAP Configuring default channel, Ch=%d"), sap_context->channel); - sap_context->channel = - sap_select_default_oper_chan(h_hal, + sap_context->channel = sap_select_default_oper_chan( sap_context->acs_cfg); #ifdef SOFTAP_CHANNEL_RANGE diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 5e814d55ad03..cceaf552c70f 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -472,9 +472,19 @@ void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev, */ uint8_t sap_indicate_radar(struct sap_context *sap_ctx); +/** + * sap_select_default_oper_chan() - Select AP mode default operating channel + * @acs_cfg: pointer to ACS config info + * + * Select AP mode default operating channel based on ACS hw mode and channel + * range configuration when ACS scan fails due to some reasons, such as scan + * timeout, etc. + * + * Return: Selected operating channel number + */ +uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg); + #ifdef __cplusplus } #endif -uint8_t sap_select_default_oper_chan(tHalHandle hal, - struct sap_acs_cfg *acs_cfg); #endif