diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 160bc11aba85..6b23d99a0cb4 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -66,6 +66,29 @@ #define MAX_CFG_INI_ITEMS 1024 /* Defines for all of the things we read from the configuration (registry). */ +/* + * + * gEnableConnectedScan - Will enable or disable scan in connected state + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * This ini is used to enable or disable the scanning in + * Connected state + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ + +#define CFG_ENABLE_CONNECTED_SCAN_NAME "gEnableConnectedScan" +#define CFG_ENABLE_CONNECTED_SCAN_MIN (0) +#define CFG_ENABLE_CONNECTED_SCAN_MAX (1) +#define CFG_ENABLE_CONNECTED_SCAN_DEFAULT (1) /* * @@ -10231,6 +10254,7 @@ struct hdd_config { DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS); /* Config parameters */ + bool enable_connected_scan; uint32_t RTSThreshold; uint32_t FragmentationThreshold; uint8_t OperatingChannel; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index de9e5fbe084b..7f637e56d62e 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -329,6 +329,13 @@ cb_notify_set_roam_scan_hi_rssi_scan_params(hdd_context_t *hdd_ctx, struct reg_table_entry g_registry_table[] = { + REG_VARIABLE(CFG_ENABLE_CONNECTED_SCAN_NAME, WLAN_PARAM_Integer, + struct hdd_config, enable_connected_scan, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ENABLE_CONNECTED_SCAN_DEFAULT, + CFG_ENABLE_CONNECTED_SCAN_MIN, + CFG_ENABLE_CONNECTED_SCAN_MAX), + REG_VARIABLE(CFG_RTS_THRESHOLD_NAME, WLAN_PARAM_Integer, struct hdd_config, RTSThreshold, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -5915,6 +5922,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) hdd_debug("Name = [%s] value = [%u]", CFG_FORCE_1X1_NAME, pHddCtx->config->is_force_1x1); + hdd_info("Name = [%s] Value = %u", + CFG_ENABLE_CONNECTED_SCAN_NAME, + pHddCtx->config->enable_connected_scan); } diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 1bdef9282b80..0a3b9ac85474 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -1552,6 +1552,17 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, if (!sme_is_session_id_valid(pHddCtx->hHal, pAdapter->sessionId)) return -EINVAL; + if ((eConnectionState_Associated == + WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)-> + conn_info.connState) && + (!pHddCtx->config->enable_connected_scan)) { + hdd_info("enable_connected_scan is false, Aborting scan"); + pAdapter->request = request; + pAdapter->scan_source = source; + schedule_work(&pAdapter->scan_block_work); + return 0; + } + hdd_debug("Device_mode %s(%d)", hdd_device_mode_to_string(pAdapter->device_mode), pAdapter->device_mode); @@ -2556,6 +2567,14 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, return -EINVAL; } + if ((eConnectionState_Associated == + WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)-> + conn_info.connState) && + (!pHddCtx->config->enable_connected_scan)) { + hdd_info("enable_connected_scan is false, Aborting scan"); + return -EBUSY; + } + if (!sme_is_session_id_valid(pHddCtx->hHal, pAdapter->sessionId)) return -EINVAL;