diff --git a/os_if/linux/scan/src/wlan_cfg80211_scan.c b/os_if/linux/scan/src/wlan_cfg80211_scan.c
index 7e8a2740c7..74c7b6e434 100644
--- a/os_if/linux/scan/src/wlan_cfg80211_scan.c
+++ b/os_if/linux/scan/src/wlan_cfg80211_scan.c
@@ -150,24 +150,14 @@ static void wlan_scan_rand_attrs(struct wlan_objmgr_vdev *vdev,
* Return: None
*/
static void
-wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req,
+wlan_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc,
+ struct pno_scan_req_params *pno_req,
struct cfg80211_sched_scan_request *request)
{
- /*
- * 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 == SCAN_PNO_MAX_PLAN_REQUEST) {
+ if (!ucfg_scan_get_user_config_sched_scan_plan(psoc) ||
+ request->n_scan_plans == 1) {
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;
- } else if (request->n_scan_plans == 1) {
- pno_req->fast_scan_period =
- request->scan_plans[0].interval * MSEC_PER_SEC;
+ 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
@@ -176,13 +166,26 @@ wlan_config_sched_scan_plan(struct pno_scan_req_params *pno_req,
pno_req->fast_scan_max_cycles = 1;
pno_req->slow_scan_period =
request->scan_plans[0].interval * MSEC_PER_SEC;
+ }
+ /*
+ * As of now max 2 scan plans were supported by firmware
+ * if number of scan plan supported by firmware increased below logic
+ * must change.
+ */
+ else if (request->n_scan_plans == SCAN_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;
} else {
osif_err("Invalid number of scan plans %d !!",
request->n_scan_plans);
}
}
#else
-#define wlan_config_sched_scan_plan(pno_req, request) \
+#define wlan_config_sched_scan_plan(psoc, pno_req, request) \
__wlan_config_sched_scan_plan(pno_req, request, psoc)
static void
@@ -566,7 +569,7 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_vdev *vdev,
* switches slow_scan_period. This is less frequent scans and firmware
* shall be in slow_scan_period mode until next PNO Start.
*/
- wlan_config_sched_scan_plan(req, request);
+ wlan_config_sched_scan_plan(psoc, req, request);
req->delay_start_time = wlan_config_sched_scan_start_delay(request);
req->scan_backoff_multiplier = scan_backoff_multiplier;
diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h
index 5a8e87131c..29c0e08e17 100644
--- a/umac/scan/core/src/wlan_scan_main.h
+++ b/umac/scan/core/src/wlan_scan_main.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -253,6 +253,7 @@ struct scan_vdev_obj {
* @pno_wake_lock: pno wake lock
* @pno_cb: callback to call on PNO completion
* @mawc_params: Configuration parameters for NLO MAWC.
+ * @user_config_sched_scan_plan: if enabled set user confing sched scan plan
*/
struct pno_def_config {
bool pno_offload_enabled;
@@ -271,6 +272,7 @@ struct pno_def_config {
qdf_wake_lock_t pno_wake_lock;
struct cb_handler pno_cb;
struct nlo_mawc_params mawc_params;
+ bool user_config_sched_scan_plan;
};
#endif
diff --git a/umac/scan/dispatcher/inc/wlan_scan_cfg.h b/umac/scan/dispatcher/inc/wlan_scan_cfg.h
index cbc0ec0cc6..c213ea5984 100644
--- a/umac/scan/dispatcher/inc/wlan_scan_cfg.h
+++ b/umac/scan/dispatcher/inc/wlan_scan_cfg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -375,6 +375,30 @@ enum scan_mode_6ghz {
"honour NL80211 scan policy flags")
#ifdef FEATURE_WLAN_SCAN_PNO
+/*
+ *
+ * g_user_config_sched_scan_plan - set user config sched scan plans.
+ * @Min: 0
+ * @Max:1
+ * @Default: 1
+ *
+ * This ini is used to decide if user config number of sched scan plan needs to
+ * be configured or only one sched scan plan needs to be configured.
+ * If this ini is enabled then user config number of sched scan plans will be
+ * configured else only one sched scan plan will be configured.
+ *
+ * Supported Feature: PNO scan
+ *
+ * Usage: External
+ *
+ *
+ */
+
+#define CFG_USER_CONFIG_SCHED_SCAN_PLAN CFG_INI_BOOL(\
+ "g_user_config_sched_scan_plan",\
+ true, \
+ "set user config sched scan plans")
+
/*
*
* g_max_sched_scan_plan_iterations - pno sched max scan plan iterations.
@@ -805,7 +829,8 @@ enum scan_mode_6ghz {
CFG(CFG_MAWC_NLO_ENABLED) \
CFG(CFG_MAWC_NLO_EXP_BACKOFF_RATIO) \
CFG(CFG_MAWC_NLO_INIT_SCAN_INTERVAL) \
- CFG(CFG_MAWC_NLO_MAX_SCAN_INTERVAL)
+ CFG(CFG_MAWC_NLO_MAX_SCAN_INTERVAL) \
+ CFG(CFG_USER_CONFIG_SCHED_SCAN_PLAN)
#else
#define CFG_SCAN_PNO
diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h
index 38d45f0ed5..dccf0960fc 100644
--- a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h
+++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -1028,6 +1028,16 @@ ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc);
uint32_t
ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc);
+/**
+ * ucfg_scan_get_user_config_sched_scan_plan() - API to get user config sched
+ * scan plan configuration value
+ * @psoc: pointer to psoc object
+ *
+ * Return: value.
+ */
+bool
+ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc);
+
#else
static inline
bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc)
@@ -1082,6 +1092,12 @@ ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc)
return 0;
}
+static inline bool
+ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc)
+{
+ return true;
+}
+
#endif /* FEATURE_WLAN_SCAN_PNO */
/**
diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c
index bb0a9c138c..72136a2694 100644
--- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c
+++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -260,6 +260,8 @@ wlan_pno_global_init(struct wlan_objmgr_psoc *psoc,
cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_INTERVAL);
pno_def->max_sched_scan_plan_iterations =
cfg_get(psoc, CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS);
+ pno_def->user_config_sched_scan_plan =
+ cfg_get(psoc, CFG_USER_CONFIG_SCHED_SCAN_PLAN);
mawc_cfg->enable = cfg_get(psoc, CFG_MAWC_NLO_ENABLED);
mawc_cfg->exp_backoff_ratio =
@@ -1804,4 +1806,17 @@ ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc)
return scan_obj->pno_cfg.max_sched_scan_plan_iterations;
}
+bool
+ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc)
+{
+ struct wlan_scan_obj *scan_obj;
+
+ scan_obj = wlan_psoc_get_scan_obj(psoc);
+ if (!scan_obj) {
+ scm_err("Failed to get scan object");
+ return cfg_default(CFG_MAX_SCHED_SCAN_PLAN_ITERATIONS);
+ }
+
+ return scan_obj->pno_cfg.user_config_sched_scan_plan;
+}
#endif