Selaa lähdekoodia

qcacmn: Add QCA vendor attribute to configure priority of vendor scan

Add the attribute QCA_WLAN_VENDOR_ATTR_SCAN_PRIORITY to configure the
priority of vendor scan relative to other scan requests.
Add the valid values that this attribute can take.
Also, add an API to convert NL80211-based scan priority value to internal
scan priority value.

Change-Id: I6c62166c2dd6ea0880b332496b1e4bb0b41840c6
CRs-Fixed: 3044332
Shiva Krishna Pittala 3 vuotta sitten
vanhempi
sitoutus
d0624dedd6

+ 23 - 0
os_if/linux/qca_vendor.h

@@ -2466,6 +2466,23 @@ enum qca_wlan_vendor_attr_set_scanning_mac_oui {
 		QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_AFTER_LAST - 1,
 };
 
+/**
+ * enum qca_wlan_vendor_scan_priority - Specifies the valid values that the
+ * vendor scan attribute QCA_WLAN_VENDOR_ATTR_SCAN_PRIORITY can take.
+ * @QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_LOW: Very low priority
+ * @QCA_WLAN_VENDOR_SCAN_PRIORITY_LOW: Low priority
+ * @QCA_WLAN_VENDOR_SCAN_PRIORITY_MEDIUM: Medium priority
+ * @QCA_WLAN_VENDOR_SCAN_PRIORITY_HIGH: High priority
+ * @QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_HIGH: Very high priority
+ */
+enum qca_wlan_vendor_scan_priority {
+	QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_LOW = 0,
+	QCA_WLAN_VENDOR_SCAN_PRIORITY_LOW = 1,
+	QCA_WLAN_VENDOR_SCAN_PRIORITY_MEDIUM = 2,
+	QCA_WLAN_VENDOR_SCAN_PRIORITY_HIGH = 3,
+	QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_HIGH = 4,
+};
+
 /**
  * enum qca_wlan_vendor_attr_scan - Specifies vendor scan attributes
  *
@@ -2491,6 +2508,11 @@ enum qca_wlan_vendor_attr_set_scanning_mac_oui {
  * @QCA_WLAN_VENDOR_ATTR_SCAN_DWELL_TIME: Unsigned 64-bit dwell time in
  *	microseconds. This is a common value which applies across all
  *	frequencies specified by QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES.
+ * @QCA_WLAN_VENDOR_ATTR_SCAN_PRIORITY: Priority of vendor scan relative to
+ *      other scan requests. It is a u32 attribute and takes values from enum
+ *      qca_wlan_vendor_scan_priority. This is an optional attribute.
+ *      If this attribute is not configured, the driver shall use
+ *      QCA_WLAN_VENDOR_SCAN_PRIORITY_HIGH as the priority of vendor scan.
  */
 enum qca_wlan_vendor_attr_scan {
 	QCA_WLAN_VENDOR_ATTR_SCAN_INVALID_PARAM = 0,
@@ -2506,6 +2528,7 @@ enum qca_wlan_vendor_attr_scan {
 	QCA_WLAN_VENDOR_ATTR_SCAN_MAC_MASK = 10,
 	QCA_WLAN_VENDOR_ATTR_SCAN_BSSID = 11,
 	QCA_WLAN_VENDOR_ATTR_SCAN_DWELL_TIME = 12,
+	QCA_WLAN_VENDOR_ATTR_SCAN_PRIORITY = 13,
 	QCA_WLAN_VENDOR_ATTR_SCAN_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_SCAN_MAX =
 	QCA_WLAN_VENDOR_ATTR_SCAN_AFTER_LAST - 1

+ 10 - 0
os_if/linux/scan/inc/wlan_cfg80211_scan.h

@@ -451,4 +451,14 @@ void wlan_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy,
 void wlan_cfg80211_scan_done(struct net_device *netdev,
 			     struct cfg80211_scan_request *req,
 			     bool aborted);
+
+/**
+ * convert_nl_scan_priority_to_internal() - Convert NL80211 based scan prioirty
+ * value to internal scan priority value
+ * @nl_scan_priority : Scan priority value received in vendor attribute
+ *
+ * Return: Internal scan priority value
+ */
+enum scan_priority convert_nl_scan_priority_to_internal(
+	enum qca_wlan_vendor_scan_priority nl_scan_priority);
 #endif

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

@@ -1345,6 +1345,30 @@ wlan_cfg80211_allow_simultaneous_scan(struct wlan_objmgr_psoc *psoc)
 }
 #endif
 
+enum scan_priority convert_nl_scan_priority_to_internal(
+	enum qca_wlan_vendor_scan_priority nl_scan_priority)
+{
+	switch (nl_scan_priority) {
+	case QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_LOW:
+		return SCAN_PRIORITY_VERY_LOW;
+
+	case QCA_WLAN_VENDOR_SCAN_PRIORITY_LOW:
+		return SCAN_PRIORITY_LOW;
+
+	case QCA_WLAN_VENDOR_SCAN_PRIORITY_MEDIUM:
+		return SCAN_PRIORITY_MEDIUM;
+
+	case QCA_WLAN_VENDOR_SCAN_PRIORITY_HIGH:
+		return SCAN_PRIORITY_HIGH;
+
+	case QCA_WLAN_VENDOR_SCAN_PRIORITY_VERY_HIGH:
+		return SCAN_PRIORITY_VERY_HIGH;
+
+	default:
+		return SCAN_PRIORITY_COUNT;
+	}
+}
+
 int wlan_cfg80211_scan(struct wlan_objmgr_vdev *vdev,
 		       struct cfg80211_scan_request *request,
 		       struct scan_params *params)