From 97c070b5da754de9386e8ef6eadd17f59914da79 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Mon, 7 Jan 2019 17:23:06 +0530 Subject: [PATCH] qcacld-3.0: Enable/disable first DFS channel scan through ini Currently the driver includes all the DFS channels as part of scan in the scan list, and thus not exclude the DFS channels in the first scan for faster scan. Fix is to check the ini, for first DFS channel scan, and then remove the DFS channels from the scan list if the ini is enabled. Change-Id: Iff3361f3c1a577fd8e2b541a0673af431db65a5e CRs-Fixed: 2378801 --- core/hdd/inc/wlan_hdd_cfg.h | 37 ---------------------------- core/hdd/src/wlan_hdd_cfg.c | 13 +++------- core/hdd/src/wlan_hdd_cfg80211.c | 20 ++++++++++----- core/hdd/src/wlan_hdd_hostapd.c | 5 +++- core/hdd/src/wlan_hdd_hostapd_wext.c | 6 +++-- core/hdd/src/wlan_hdd_main.c | 3 ++- core/hdd/src/wlan_hdd_regulatory.c | 6 ++++- 7 files changed, 33 insertions(+), 57 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 3f80007b72bb..cb9a04d6c6e0 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -185,21 +185,6 @@ enum hdd_dot11_mode { #define CFG_CHANNEL_BONDING_MODE_MAX WNI_CFG_CHANNEL_BONDING_MODE_STAMAX #define CFG_CHANNEL_BONDING_MODE_DEFAULT WNI_CFG_CHANNEL_BONDING_MODE_STADEF -/* - * - * gEnableDFSChnlScan - Enable DFS channel scan - * @Min: 0 - * @Max: 1 - * @Default: 1 - * - * This ini is used to enable or disable DFS channel - * scan - */ -#define CFG_ENABLE_DFS_CHNL_SCAN_NAME "gEnableDFSChnlScan" -#define CFG_ENABLE_DFS_CHNL_SCAN_MIN (0) -#define CFG_ENABLE_DFS_CHNL_SCAN_MAX (1) -#define CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT (1) - /* * * gEnableDFSPnoChnlScan - enable dfs channels in PNO scan @@ -586,27 +571,6 @@ enum hdd_dot11_mode { #define CFG_TL_DELAYED_TRGR_FRM_INT_MAX (4294967295UL) #define CFG_TL_DELAYED_TRGR_FRM_INT_DEFAULT 3000 -/* - * gEnableDFSChnlScan - enable dfs channel scan. - * @Min: 0 - * @Max: 1 - * @Default: 1 - * - * This ini is used to enable/disable dfs channels in scan, enabling this - * will enable driver to include dfs channels in its scan list. - * Related: NA - * - * Supported Feature: DFS, Scan - * - * Usage: Internal/External - * - * - */ -#define CFG_ENABLE_DFS_CHNL_SCAN_NAME "gEnableDFSChnlScan" -#define CFG_ENABLE_DFS_CHNL_SCAN_MIN (0) -#define CFG_ENABLE_DFS_CHNL_SCAN_MAX (1) -#define CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT (1) - /* * * gEnableSNRMonitoring - Enables SNR Monitoring @@ -1103,7 +1067,6 @@ struct hdd_config { #ifdef ENABLE_MTRACE_LOG bool enable_mtrace; #endif - uint8_t enableDFSChnlScan; uint8_t enable_dfs_pno_chnl_scan; bool prevent_link_down; uint8_t scanAgingTimeout; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index e82b62f1b05c..d816a4d61e15 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -91,13 +91,6 @@ struct reg_table_entry g_registry_table[] = { CFG_TL_DELAYED_TRGR_FRM_INT_MIN, CFG_TL_DELAYED_TRGR_FRM_INT_MAX), - REG_VARIABLE(CFG_ENABLE_DFS_CHNL_SCAN_NAME, WLAN_PARAM_Integer, - struct hdd_config, enableDFSChnlScan, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT, - CFG_ENABLE_DFS_CHNL_SCAN_MIN, - CFG_ENABLE_DFS_CHNL_SCAN_MAX), - REG_VARIABLE(CFG_ENABLE_DFS_PNO_CHNL_SCAN_NAME, WLAN_PARAM_Integer, struct hdd_config, enable_dfs_pno_chnl_scan, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -1838,6 +1831,7 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) tSmeConfigParams *smeConfig; mac_handle_t mac_handle = hdd_ctx->mac_handle; bool roam_scan_enabled; + bool enable_dfs_scan = true; #ifdef FEATURE_WLAN_ESE bool ese_enabled; #endif @@ -1885,8 +1879,9 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) smeConfig->csrConfig.AdHocChannel24 = ibss_cfg.adhoc_ch_2g; smeConfig->csrConfig.ProprietaryRatesEnabled = 0; smeConfig->csrConfig.HeartbeatThresh50 = 40; - smeConfig->csrConfig.fEnableDFSChnlScan = pConfig->enableDFSChnlScan; - + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); + smeConfig->csrConfig.fEnableDFSChnlScan = enable_dfs_scan; smeConfig->csrConfig.Csr11dinfo.Channels.numChannels = 0; hdd_set_power_save_offload_config(hdd_ctx); diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 0bb90f00d16b..e1334fffc652 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -134,6 +134,7 @@ #include "nan_ucfg_api.h" #include "wlan_fwol_ucfg_api.h" #include "wlan_cfg80211_crypto.h" +#include "wlan_scan_ucfg_api.h" #define g_mode_rates_size (12) #define a_mode_rates_size (8) @@ -4267,8 +4268,12 @@ int wlan_hdd_enable_dfs_chan_scan(struct hdd_context *hdd_ctx, QDF_STATUS status; bool err; mac_handle_t mac_handle; + bool enable_dfs_scan = true; - if (enable_dfs_channels == hdd_ctx->config->enableDFSChnlScan) { + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); + + if (enable_dfs_channels == enable_dfs_scan) { hdd_debug("DFS channels are already %s", enable_dfs_channels ? "enabled" : "disabled"); return 0; @@ -4286,7 +4291,8 @@ int wlan_hdd_enable_dfs_chan_scan(struct hdd_context *hdd_ctx, return -EOPNOTSUPP; } - hdd_ctx->config->enableDFSChnlScan = enable_dfs_channels; + ucfg_scan_cfg_set_dfs_chan_scan_allowed(hdd_ctx->psoc, + enable_dfs_channels); mac_handle = hdd_ctx->mac_handle; status = sme_enable_dfs_chan_scan(mac_handle, enable_dfs_channels); @@ -4327,7 +4333,7 @@ static int __wlan_hdd_cfg80211_disable_dfs_chan_scan(struct wiphy *wiphy, struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; int ret_val; uint32_t no_dfs_flag = 0; - + bool enable_dfs_scan = true; hdd_enter_dev(dev); ret_val = wlan_hdd_validate_context(hdd_ctx); @@ -4356,13 +4362,15 @@ static int __wlan_hdd_cfg80211_disable_dfs_chan_scan(struct wiphy *wiphy, hdd_err("invalid value of dfs flag"); return -EINVAL; } + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); - if (hdd_ctx->config->enableDFSChnlScan) { + if (enable_dfs_scan) { ret_val = wlan_hdd_enable_dfs_chan_scan(hdd_ctx, !no_dfs_flag); } else { - if ((!no_dfs_flag) != hdd_ctx->config->enableDFSChnlScan) { + if ((!no_dfs_flag) != enable_dfs_scan) { hdd_err("DFS chan ini configured %d, no dfs flag: %d", - hdd_ctx->config->enableDFSChnlScan, + enable_dfs_scan, no_dfs_flag); return -EINVAL; } diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index eee1f1371a33..9a9e3ffb44ca 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4732,6 +4732,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, bool sap_force_11n_for_11ac = 0; bool go_force_11n_for_11ac = 0; bool bval = false, ap_obss_prot = false, sap_uapsd = true; + bool enable_dfs_scan = true; hdd_enter(); @@ -4957,9 +4958,11 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, ret = -EINVAL; goto error; } + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); /* reject SAP if DFS channel scan is not allowed */ - if (!(hdd_ctx->config->enableDFSChnlScan) && + if (!(enable_dfs_scan) && (CHANNEL_STATE_DFS == wlan_reg_get_channel_state(hdd_ctx->pdev, pConfig->channel))) { diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 8a3192f26cf8..fd06722dbfc3 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -1960,6 +1960,7 @@ static int __iw_get_channel_list(struct net_device *dev, struct hdd_adapter *hostapd_adapter = (netdev_priv(dev)); struct channel_list_info *channel_list = (struct channel_list_info *) extra; + bool enable_dfs_scan = true; enum band_info cur_band = BAND_ALL; struct hdd_context *hdd_ctx; int ret; @@ -1993,9 +1994,10 @@ static int __iw_get_channel_list(struct net_device *dev, if (cur_band != BAND_2G) band_end_channel = MAX_5GHZ_CHANNEL; - + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); if (hostapd_adapter->device_mode == QDF_STA_MODE && - hdd_ctx->config->enableDFSChnlScan) { + enable_dfs_scan) { is_dfs_mode_enabled = true; } else if (hostapd_adapter->device_mode == QDF_SAP_MODE) { if (QDF_STATUS_SUCCESS != ucfg_mlme_get_dfs_master_capability( diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 8992774d1551..30549659cc36 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9065,7 +9065,8 @@ static void hdd_override_ini_config(struct hdd_context *hdd_ctx) QDF_STATUS status; if (0 == enable_dfs_chan_scan || 1 == enable_dfs_chan_scan) { - hdd_ctx->config->enableDFSChnlScan = enable_dfs_chan_scan; + ucfg_scan_cfg_set_dfs_chan_scan_allowed(hdd_ctx->psoc, + enable_dfs_chan_scan); hdd_debug("Module enable_dfs_chan_scan set to %d", enable_dfs_chan_scan); } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 23b3879ef3f4..cb03eca622d9 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -216,6 +216,7 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx, QDF_STATUS status; bool country_priority = 0; bool value = false; + bool enable_dfs_scan = true; status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); if (QDF_IS_STATUS_ERROR(status)) @@ -238,7 +239,10 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx, &country_priority); config_vars->userspace_ctry_priority = country_priority; - config_vars->dfs_enabled = hdd_ctx->config->enableDFSChnlScan; + ucfg_scan_cfg_get_dfs_chan_scan_allowed(hdd_ctx->psoc, + &enable_dfs_scan); + + config_vars->dfs_enabled = enable_dfs_scan; ucfg_mlme_get_indoor_channel_support(hdd_ctx->psoc, &indoor_chan_enabled);