Преглед изворни кода

qcacmn: Modify dwell time and DBS scan based on scan request

Based on the scan request flags from kernel, modify the
adaptive dwell time and DBS scan request policy.
In high accuracy mode, disable DBS scan and adaptive dwell
time scan mode.
In a low power/span mode, enable aggressive adaptive dwell time
and DBS scan to save power and time.

Change-Id: I23498799c05a252cbc9c9f6d50b847130dd0ceac
CRs-Fixed: 2197171
gaurank kathpalia пре 7 година
родитељ
комит
74f2a30e7d

+ 42 - 0
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -1174,6 +1174,34 @@ void wlan_cfg80211_cleanup_scan_queue(struct wlan_objmgr_pdev *pdev,
 	return;
 }
 
+/**
+ * wlan_cfg80211_update_scan_policy_type_flags() - Set scan flags according to
+ * scan request
+ * @scan_req: Pointer to csr scan req
+ *
+ * Return: None
+ */
+#if defined(CFG80211_SCAN_DBS_CONTROL_SUPPORT) || \
+	   (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))
+static void wlan_cfg80211_update_scan_policy_type_flags(
+	struct cfg80211_scan_request *req,
+	struct scan_req_params *scan_req)
+{
+	if (req->flags & NL80211_SCAN_FLAG_HIGH_ACCURACY)
+		scan_req->scan_policy_high_accuracy = true;
+	if (req->flags & NL80211_SCAN_FLAG_LOW_SPAN)
+		scan_req->scan_policy_low_span = true;
+	if (req->flags & NL80211_SCAN_FLAG_LOW_POWER)
+		scan_req->scan_policy_low_power = true;
+}
+#else
+static inline void wlan_cfg80211_update_scan_policy_type_flags(
+		struct cfg80211_scan_request *req,
+		struct scan_req_params *scan_req)
+{
+}
+#endif
+
 int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev,
 		struct cfg80211_scan_request *request,
 		struct scan_params *params)
@@ -1230,6 +1258,10 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev,
 	req->scan_req.vdev_id = wlan_vdev_get_id(vdev);
 	req->scan_req.scan_id = scan_id;
 	req->scan_req.scan_req_id = req_id;
+
+	/* Update scan policy type flags according to cfg scan request */
+	wlan_cfg80211_update_scan_policy_type_flags(request,
+					     &req->scan_req);
 	/*
 	 * Even though supplicant doesn't provide any SSIDs, n_ssids is
 	 * set to 1.  Because of this, driver is assuming that this is not
@@ -1267,6 +1299,16 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev,
 
 	if (is_p2p_scan && request->no_cck)
 		req->scan_req.p2p_scan_type = SCAN_P2P_SEARCH;
+
+	/* Set dwell time mode according to scan policy type flags */
+	if (req->scan_req.scan_policy_high_accuracy)
+		req->scan_req.adaptive_dwell_time_mode =
+					SCAN_DWELL_MODE_STATIC;
+	if ((req->scan_req.scan_policy_low_power) ||
+	   (req->scan_req.scan_policy_low_span))
+		req->scan_req.adaptive_dwell_time_mode =
+					SCAN_DWELL_MODE_AGGRESSIVE;
+
 	/*
 	 * FW require at least 1 MAC to send probe request.
 	 * If MAC is all 0 set it to BC addr as this is the address on

+ 9 - 0
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -884,6 +884,15 @@ struct scan_req_params {
 		};
 		uint32_t scan_flags;
 	};
+	union {
+		struct {
+			uint32_t scan_policy_high_accuracy:1,
+				 scan_policy_low_span:1,
+				 scan_policy_low_power:1;
+		};
+		uint32_t scan_policy_type;
+	};
+
 	enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode;
 	uint32_t burst_duration;
 	uint32_t num_bssid;

+ 21 - 7
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -401,15 +401,20 @@ ucfg_scan_update_pno_config(struct pno_def_config *pno,
  * ucfg_scan_update_dbs_scan_ctrl_ext_flag() - update dbs scan ctrl flags
  * @req: pointer to scan request
  *
- * This function updates the dbs scan ctrl flags.
+ * This function sets scan_ctrl_flags_ext value depending on the type of
+ * scan and the channel lists.
+ *
  * Non-DBS scan is requested if any of the below case is met:
- * 1. HW is DBS incapable
- * 2. Directed scan
- * 3. Channel list has only few channels
- * 4. Channel list has single band channels
- * For remaining cases, dbs scan is requested.
+ *     1. HW is DBS incapable
+ *     2. Directed scan
+ *     3. Channel list has only few channels
+ *     4. Channel list has single band channels
+ *     5. A high accuracy scan request is sent by kernel.
  *
- * Return: None
+ * DBS scan is enabled for these conditions:
+ *     1. A low power or low span scan request is sent by kernel.
+ * For remaining cases DBS is enabled by default.
+ * Return: void
  */
 static void
 ucfg_scan_update_dbs_scan_ctrl_ext_flag(struct scan_start_request *req)
@@ -425,6 +430,15 @@ ucfg_scan_update_dbs_scan_ctrl_ext_flag(struct scan_start_request *req)
 			wlan_objmgr_psoc_get_dual_mac_disable(psoc))
 		goto end;
 
+	if (req->scan_req.scan_policy_high_accuracy)
+		goto end;
+
+	if ((req->scan_req.scan_policy_low_power) ||
+	    (req->scan_req.scan_policy_low_span)) {
+		scan_dbs_policy = SCAN_DBS_POLICY_IGNORE_DUTY;
+		goto end;
+	}
+
 	conn_cnt = policy_mgr_get_connection_count(psoc);
 	if (conn_cnt > 0) {
 		scm_debug("%d active connections, go for DBS scan",