Browse Source

qcacmn: Add support for scanband config for cfg80211 scan

cfg80211tool athX scanband <val> config is used to
select a specific band to scan (i.e., 2.4GHz and/or
5GHz). The initial support for this command was
added as an iwpriv for WEXT-based scanning through
IOCTL. However, on bringing up cfg80211 support,
support for not extended for the cfg80211-based
vendor scan.

Add support to ensure that this command will
control band configuration for scanning for cfg80211
vendor scanning.

CRs-Fixed: 2969914
Change-Id: Ie3b7140ea78f15533e73fbe6251e670e6faa6d29
Aditya Sathish 4 years ago
parent
commit
6b048962f6
2 changed files with 32 additions and 12 deletions
  1. 5 1
      os_if/linux/scan/inc/wlan_cfg80211_scan.h
  2. 27 11
      os_if/linux/scan/src/wlan_cfg80211_scan.c

+ 5 - 1
os_if/linux/scan/inc/wlan_cfg80211_scan.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
@@ -153,6 +153,8 @@ struct scan_req {
  * inapplicable.
  * @dwell_time_passive_6g: 6 GHz specific passive dwell time. Ignored if zero or
  * inapplicable.
+ * @scan_f_2ghz: Scan only 2GHz channels
+ * @scan_f_5ghz: Scan only 5+6GHz channels
  */
 struct scan_params {
 	uint8_t source;
@@ -167,6 +169,8 @@ struct scan_params {
 	uint32_t dwell_time_passive;
 	uint32_t dwell_time_active_6g;
 	uint32_t dwell_time_passive_6g;
+	bool scan_f_2ghz;
+	bool scan_f_5ghz;
 };
 
 /**

+ 27 - 11
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -1512,6 +1512,14 @@ int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
 	if (qdf_is_macaddr_zero(&req->scan_req.bssid_list[0]))
 		qdf_set_macaddr_broadcast(&req->scan_req.bssid_list[0]);
 
+	if (params->scan_f_2ghz && !params->scan_f_5ghz) {
+		req->scan_req.scan_f_2ghz = true;
+		req->scan_req.scan_f_5ghz = false;
+	} else if (!params->scan_f_2ghz && params->scan_f_5ghz) {
+		req->scan_req.scan_f_2ghz = false;
+		req->scan_req.scan_f_5ghz = true;
+	}
+
 	if (request->n_channels) {
 #ifdef WLAN_POLICY_MGR_ENABLE
 		bool ap_or_go_present =
@@ -1540,17 +1548,25 @@ int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
 					continue;
 			}
 #endif
-			req->scan_req.chan_list.chan[num_chan].freq = c_freq;
-			band = util_scan_scm_freq_to_band(c_freq);
-			if (band == WLAN_BAND_2_4_GHZ)
-				req->scan_req.chan_list.chan[num_chan].phymode =
-					SCAN_PHY_MODE_11G;
-			else
-				req->scan_req.chan_list.chan[num_chan].phymode =
-					SCAN_PHY_MODE_11A;
-			num_chan++;
-			if (num_chan >= NUM_CHANNELS)
-				break;
+
+			if ((req->scan_req.scan_f_2ghz &&
+			     WLAN_REG_IS_24GHZ_CH_FREQ(c_freq)) ||
+			    (req->scan_req.scan_f_5ghz &&
+			     (WLAN_REG_IS_5GHZ_CH_FREQ(c_freq) ||
+			      WLAN_REG_IS_6GHZ_CHAN_FREQ(c_freq)))) {
+				req->scan_req.chan_list.chan[num_chan].freq =
+									c_freq;
+				band = util_scan_scm_freq_to_band(c_freq);
+				if (band == WLAN_BAND_2_4_GHZ)
+					req->scan_req.chan_list.chan[num_chan].phymode =
+						SCAN_PHY_MODE_11G;
+				else
+					req->scan_req.chan_list.chan[num_chan].phymode =
+						SCAN_PHY_MODE_11A;
+				num_chan++;
+				if (num_chan >= NUM_CHANNELS)
+					break;
+			}
 		}
 	}
 	if (!num_chan) {