diff options
| author | Anurag Chouhan <achouhan@codeaurora.org> | 2017-01-09 11:52:19 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-01-09 05:18:38 -0800 |
| commit | 6bbc9633684423e3617f4e5d96b022387da96ed7 (patch) | |
| tree | 9f969a9e6c2c4edaaab6447aa04e4c7d6e5c0d3d | |
| parent | 4ec6031c503f82b7f95434f96160e3f75b5c34bd (diff) | |
qcacld-3.0: Add support to honour multiple scan plans
Add Support to configure multiple 'scan plans' for scheduled scan.
Each 'scan plan' defines the number of scan cycles and the interval
between scans. The scan plans are executed in the order they were
configured. The last scan plan will always run infinitely and thus
defines only the interval between scans
The maximum number of scan plans supported by the device and the
maximum number of iterations in a single scan plan are advertised
to userspace so it can configure the scan plans appropriately.
Change-Id: Ie4b76f84ac633f4328137283bdeb2829a942b3d0
CRs-Fixed: 1102402
| -rw-r--r-- | core/hdd/inc/wlan_hdd_cfg.h | 48 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg.c | 12 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 46 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_scan.c | 86 | ||||
| -rw-r--r-- | core/mac/inc/sir_api.h | 2 |
5 files changed, 161 insertions, 33 deletions
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index c65f13197a26..28db9d890ec4 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -5502,6 +5502,52 @@ enum dot11p_mode { /* * <ini> + * g_max_sched_scan_plan_int - pno sched max scan plan interval. + * @Min: 1 + * @Max: 7200 + * @Default: 3600 + * + * This ini is used to set max sched scan plan interval for pno scan + * (value in seconds). + * + * Related: gPNOScanSupport + * + * Supported Feature: PNO scan + * + * Usage: External + * + * </ini> + */ +#define CFG_MAX_SCHED_SCAN_PLAN_INT_NAME "g_max_sched_scan_plan_int" +#define CFG_MAX_SCHED_SCAN_PLAN_INT_MIN (1) +#define CFG_MAX_SCHED_SCAN_PLAN_INT_MAX (7200) +#define CFG_MAX_SCHED_SCAN_PLAN_INT_DEFAULT (3600) + +/* + * <ini> + * g_max_sched_scan_plan_iterations - pno sched max scan plan iterations. + * @Min: 1 + * @Max: 100 + * @Default: 10 + * + * This ini is used to set max sched scan plan iterations for pno scan + * (value in seconds). + * + * Related: gPNOScanSupport + * + * Supported Feature: PNO scan + * + * Usage: External + * + * </ini> + */ +#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_NAME "g_max_sched_scan_plan_iterations" +#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MIN (1) +#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MAX (100) +#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_DEFAULT (10) + +/* + * <ini> * gper_roam_enabled - To enabled/disable PER based roaming in FW * @Min: 0 * @Max: 1 @@ -6331,6 +6377,8 @@ struct hdd_config { uint32_t per_roam_low_rate_threshold; uint32_t per_roam_th_percent; uint32_t per_roam_rest_time; + uint32_t max_sched_scan_plan_interval; + uint32_t max_sched_scan_plan_iterations; }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index ea11965c0eca..b240d39682b3 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4189,6 +4189,18 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_PER_ROAM_REST_TIME_DEFAULT, CFG_PER_ROAM_REST_TIME_MIN, CFG_PER_ROAM_REST_TIME_MAX), + REG_VARIABLE(CFG_MAX_SCHED_SCAN_PLAN_INT_NAME, WLAN_PARAM_Integer, + struct hdd_config, max_sched_scan_plan_interval, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_MAX_SCHED_SCAN_PLAN_INT_DEFAULT, + CFG_MAX_SCHED_SCAN_PLAN_INT_MIN, + CFG_MAX_SCHED_SCAN_PLAN_INT_MAX), + REG_VARIABLE(CFG_MAX_SCHED_SCAN_PLAN_ITRNS_NAME, WLAN_PARAM_Integer, + struct hdd_config, max_sched_scan_plan_iterations, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_MAX_SCHED_SCAN_PLAN_ITRNS_DEFAULT, + CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MIN, + CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MAX), }; /** diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index fd7bffb53e75..a19b537a9296 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -9017,6 +9017,40 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { }, }; +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4, 4, 0)) || \ + defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ + defined(FEATURE_WLAN_SCAN_PNO) +/** + * hdd_config_sched_scan_plans_to_wiphy() - configure sched scan plans to wiphy + * @wiphy: pointer to wiphy + * @config: pointer to config + * + * Return: None + */ +static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, + struct hdd_config *config) +{ + if (config->configPNOScanSupport) { + wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; + wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; + wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; + wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; + wiphy->max_sched_scan_plans = SIR_PNO_MAX_PLAN_REQUEST; + if (config->max_sched_scan_plan_interval) + wiphy->max_sched_scan_plan_interval = + config->max_sched_scan_plan_interval; + if (config->max_sched_scan_plan_iterations) + wiphy->max_sched_scan_plan_iterations = + config->max_sched_scan_plan_iterations; + } +} +#else +static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, + struct hdd_config *config) +{ +} +#endif + /** * hdd_cfg80211_wiphy_alloc() - Allocate wiphy context * @priv_size: Size of the hdd context. @@ -9163,17 +9197,7 @@ int wlan_hdd_cfg80211_init(struct device *dev, wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); #endif -#ifdef FEATURE_WLAN_SCAN_PNO - if (pCfg->configPNOScanSupport) { - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; - wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; - wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; - wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || defined(WITH_BACKPORTS) - wiphy->max_sched_scan_plans = SIR_PNO_MAX_PLAN_REQUEST; -#endif - } -#endif /*FEATURE_WLAN_SCAN_PNO */ + hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg); #if defined QCA_WIFI_FTM if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index c271194691a8..2ebdc1771268 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -2374,6 +2374,70 @@ static QDF_STATUS wlan_hdd_is_pno_allowed(hdd_adapter_t *adapter) } +#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || \ + defined(CFG80211_MULTI_SCAN_PLAN_BACKPORT)) && \ + defined(FEATURE_WLAN_SCAN_PNO) +/** + * hdd_config_sched_scan_plan() - configures the sched scan plans + * from the framework. + * @pno_req: pointer to PNO scan request + * @request: pointer to scan request from framework + * + * Return: None + */ +static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, + struct cfg80211_sched_scan_request *request, + hdd_context_t *hdd_ctx) +{ + /* + * As of now max 2 scan plans were supported by firmware + * if number of scan plan supported by firmware increased below logic + * must change. + */ + if (request->n_scan_plans == SIR_PNO_MAX_PLAN_REQUEST) { + pno_req->fast_scan_period = + request->scan_plans[0].interval * MSEC_PER_SEC; + pno_req->fast_scan_max_cycles = + request->scan_plans[0].iterations; + pno_req->slow_scan_period = + request->scan_plans[1].interval * MSEC_PER_SEC; + hdd_notice("Base scan interval: %d sec, scan cycles: %d, slow scan interval %d", + request->scan_plans[0].interval, + request->scan_plans[0].iterations, + request->scan_plans[1].interval); + } else if (request->n_scan_plans == 1) { + pno_req->fast_scan_period = + request->scan_plans[0].interval * MSEC_PER_SEC; + /* + * if only one scan plan is configured from framework + * then both fast and slow scan should be configured with the + * same value that is why fast scan cycles are hardcoded to one + */ + pno_req->fast_scan_max_cycles = 1; + pno_req->slow_scan_period = + request->scan_plans[0].interval * MSEC_PER_SEC; + } else { + hdd_err("Invalid number of scan plans %d !!", + request->n_scan_plans); + } +} +#else +static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, + struct cfg80211_sched_scan_request *request, + hdd_context_t *hdd_ctx) +{ + pno_req->fast_scan_period = request->interval; + pno_req->fast_scan_max_cycles = + hdd_ctx->config->configPNOScanTimerRepeatValue; + pno_req->slow_scan_period = + hdd_ctx->config->pno_slow_scan_multiplier * + pno_req->fast_scan_period; + hdd_notice("Base scan interval: %d sec PNOScanTimerRepeatValue: %d", + (request->interval / 1000), + hdd_ctx->config->configPNOScanTimerRepeatValue); +} +#endif + /** * __wlan_hdd_cfg80211_sched_scan_start() - cfg80211 scheduled scan(pno) start * @wiphy: Pointer to wiphy @@ -2600,27 +2664,7 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, * switches slow_scan_period. This is less frequent scans and firmware * shall be in slow_scan_period mode until next PNO Start. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || defined(WITH_BACKPORTS) - if (WARN_ON(request->n_scan_plans > SIR_PNO_MAX_PLAN_REQUEST)) { - ret = -EINVAL; - goto error; - } - - /* TBD: only one sched_scan plan we can support now, so we only - * retrieve the first plan and ignore the rest of them. - * If there are more than 1 sched_pan request we can support, the - * PnoRequet structure will also need to be revised. - */ - pPnoRequest->fast_scan_period = request->scan_plans[0].interval * - MSEC_PER_SEC; -#else - pPnoRequest->fast_scan_period = request->interval; -#endif - pPnoRequest->fast_scan_max_cycles = - config->configPNOScanTimerRepeatValue; - pPnoRequest->slow_scan_period = - config->pno_slow_scan_multiplier * - pPnoRequest->fast_scan_period; + hdd_config_sched_scan_plan(pPnoRequest, request, pHddCtx); hdd_info("Base scan interval: %d sec PNOScanTimerRepeatValue: %d", (pPnoRequest->fast_scan_period / 1000), diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index b72bc3707ad9..6f352fa8dbc0 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2873,7 +2873,7 @@ typedef struct sAniIbssRouteTable { /* Set PNO */ -#define SIR_PNO_MAX_PLAN_REQUEST 1 +#define SIR_PNO_MAX_PLAN_REQUEST 2 #define SIR_PNO_MAX_NETW_CHANNELS 26 #define SIR_PNO_MAX_NETW_CHANNELS_EX 60 #define SIR_PNO_MAX_SUPP_NETWORKS 16 |
