Browse Source

qcacmn: Add policy for QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_STATUS

Vendor commands using nested attributes should use properly defined
policies instead of RAW_DATA and the same has been enforced since 5.4
kernel. Hence, defined a policy for the vendor command
QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_STATUS.

Change-Id: Ibdf7a19ddd533653c0706b4f0cf3ac97d31b9e40
Pooventhiran G 3 years ago
parent
commit
60533b64ea

+ 5 - 1
os_if/linux/spectral/inc/wlan_cfg80211_spectral.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2019-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
@@ -36,6 +36,10 @@ extern const struct nla_policy
 	spectral_scan_policy
 	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_MAX + 1];
 
+extern const struct nla_policy
+	spectral_scan_get_status_policy
+	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_MAX + 1];
+
 #define CONFIG_REQUESTED(type)    ((type == \
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_CONFIG))

+ 11 - 2
os_if/linux/spectral/src/wlan_cfg80211_spectral.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
@@ -93,6 +93,15 @@ const struct nla_policy spectral_scan_policy[
 							.type = NLA_U8},
 };
 
+const struct nla_policy spectral_scan_get_status_policy[
+		QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_MAX + 1] = {
+	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_IS_ENABLED] = {
+							.type = NLA_FLAG },
+	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_IS_ACTIVE] = {
+							.type = NLA_FLAG },
+	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_MODE] = { .type = NLA_U32 },
+};
+
 static void wlan_spectral_intit_config(struct spectral_config *config_req)
 {
 	config_req->ss_period =          SPECTRAL_PHYERR_PARAM_NOVAL;
@@ -909,7 +918,7 @@ int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
 			QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_MAX,
 			data,
 			data_len,
-			NULL)) {
+			spectral_scan_get_status_policy)) {
 		osif_err("Invalid Spectral Scan config ATTR");
 		return -EINVAL;
 	}