Browse Source

qcacmn: Add an ini to ignore user configured sched scan params

Currently there is no mechanism in driver to decide whether
to consider the user configured number of sched scan plan or
to configure only 1 schad scan plan.
There is a requirement to configure only one sched scan plan,
add ini support to meet this requiremet.

Change-Id: Iea3bc3f18696837150ce6f4bd60416a8a45bd1d3
CRs-Fixed: 2868125
Ashish Kumar Dhanotiya 4 years ago
parent
commit
4ea435bd55

+ 18 - 15
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -150,39 +150,42 @@ 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)
 {
+	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;
+		/*
+		 * 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;
+	}
 	/*
 	 * 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) {
+	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 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 {
 		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;
 

+ 3 - 1
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
 

+ 27 - 2
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
+/*
+ * <ini>
+ * 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
+ *
+ * </ini>
+ */
+
+#define CFG_USER_CONFIG_SCHED_SCAN_PLAN CFG_INI_BOOL(\
+			"g_user_config_sched_scan_plan",\
+			true, \
+			"set user config sched scan plans")
+
 /*
  * <ini>
  * 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

+ 17 - 1
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 */
 
 /**

+ 16 - 1
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