Browse Source

qcacld-3.0: Add policy attribute to SUBCMD_ENCRYPTION_TEST

According to new changes in kernel 5.2 version onwards, driver has to
provide the policy for a NL command to be verified against while
registering wiphy to the kernel.
To satisfy kernel 5.2 requirement, add policy to following vendor
command as part of this change:
	QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST

Change-Id: I37836165dc8ff89f7179d5024cc3b1516cacf6e6
CRs-Fixed: 2633303
Srinivas Girigowda 5 years ago
parent
commit
8dfd6ad4c6
3 changed files with 23 additions and 14 deletions
  1. 2 11
      core/hdd/src/wlan_hdd_cfg80211.c
  2. 2 2
      core/hdd/src/wlan_hdd_disa.c
  3. 19 1
      core/hdd/src/wlan_hdd_disa.h

+ 2 - 11
core/hdd/src/wlan_hdd_cfg80211.c

@@ -14903,17 +14903,8 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
 		.doit = wlan_hdd_cfg80211_set_fast_roaming
 	},
-#ifdef WLAN_FEATURE_DISA
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd =
-			QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-				 WIPHY_VENDOR_CMD_NEED_NETDEV |
-				 WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_encrypt_decrypt_msg
-	},
-#endif
+	FEATURE_DISA_VENDOR_COMMANDS
+
 #ifdef FEATURE_WLAN_TDLS
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,

+ 2 - 2
core/hdd/src/wlan_hdd_disa.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 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
@@ -146,7 +146,7 @@ nla_put_failure:
 	return -EINVAL;
 }
 
-static const struct nla_policy
+const struct nla_policy
 encrypt_decrypt_policy[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION] = {
 		.type = NLA_FLAG},

+ 19 - 1
core/hdd/src/wlan_hdd_disa.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, 2020 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
@@ -21,8 +21,24 @@
 
 #include "wlan_hdd_main.h"
 #include "sir_api.h"
+#include "qca_vendor.h"
 
 #ifdef WLAN_FEATURE_DISA
+extern const struct nla_policy
+encrypt_decrypt_policy[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX + 1];
+
+#define FEATURE_DISA_VENDOR_COMMANDS                                \
+{                                                                   \
+	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
+	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST,       \
+	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
+			 WIPHY_VENDOR_CMD_NEED_NETDEV |                         \
+			 WIPHY_VENDOR_CMD_NEED_RUNNING,                         \
+	.doit = wlan_hdd_cfg80211_encrypt_decrypt_msg,                  \
+	vendor_command_policy(encrypt_decrypt_policy,                   \
+						QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX)   \
+},
+
 /**
  * wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg
  * @wiphy: Pointer to wireless phy
@@ -36,6 +52,8 @@ int wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy,
 			struct wireless_dev *wdev,
 			const void *data,
 			int data_len);
+#else
+#define FEATURE_DISA_VENDOR_COMMANDS
 #endif
 
 #endif