Browse Source

qcacld-3.0: Add policy attribute to hdd_wiphy_vendor_commands

According to new changes in kernel 5.4 version onwards, driver has to
provide the policy for a NL command to ve verified against while
registering wiphy to the kernel.

To accommodate these changes, add policy for all the following
vendor commands that are being registered in the driver

	QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES
	QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES
	QCA_NL80211_VENDOR_SUBCMD_GET_LOGGER_FEATURE_SET
	QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO
	QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE
	QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG
	QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET
	QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION
	QCA_NL80211_VENDOR_SUBCMD_NAN_EXT
	QCA_NL80211_VENDOR_SUBCMD_NDP
	QCA_NL80211_VENDOR_SUBCMD_SCANNING_MAC_OUI
	QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START
	QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET
	QCA_NL80211_VENDOR_SUBCMD_ROAM
	QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER
	QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD
	QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG
	QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_SET_KEY
	QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA
	QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN

Change-Id: I714c8b21a95144f7ed8ff4c6e038782e469edf3d
CRs-Fixed: 2621308
Sourav Mohapatra 5 years ago
parent
commit
2c0cc5f4bc

+ 20 - 1
core/hdd/inc/wlan_hdd_apf.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-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
@@ -37,6 +37,7 @@
 #include "sir_api.h"
 #include "wlan_hdd_main.h"
 #include "wmi_unified_param.h"
+#include "qca_vendor.h"
 
 #define APF_CONTEXT_MAGIC 0x4575354
 
@@ -45,6 +46,22 @@
 /* APF commands wait times in msec */
 #define WLAN_WAIT_TIME_APF_READ_MEM     10000
 
+/* QCA_NL80211_VENDOR_PACKET_FILTER policy */
+extern const struct nla_policy wlan_hdd_apf_offload_policy[
+			QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_MAX + 1];
+
+#define FEATURE_APF_OFFLOAD_VENDOR_COMMANDS \
+	{ \
+		.info.vendor_id = QCA_NL80211_VENDOR_ID, \
+		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER, \
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
+			WIPHY_VENDOR_CMD_NEED_NETDEV | \
+			WIPHY_VENDOR_CMD_NEED_RUNNING, \
+		.doit = wlan_hdd_cfg80211_apf_offload, \
+		vendor_command_policy(wlan_hdd_apf_offload_policy, \
+				      QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_MAX) \
+	},
+
 /**
  * wlan_hdd_cfg80211_apf_offload() - SSR Wrapper to APF Offload
  * @wiphy:    wiphy structure pointer
@@ -90,6 +107,8 @@ void hdd_get_apf_capabilities_cb(void *hdd_context,
 				 struct sir_apf_get_offload *data);
 #else /* FEATURE_WLAN_APF */
 
+#define FEATURE_APF_OFFLOAD_VENDOR_COMMANDS
+
 static inline void hdd_apf_context_init(struct hdd_adapter *adapter)
 {
 }

+ 7 - 3
core/hdd/inc/wlan_hdd_nan.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-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
@@ -82,7 +82,9 @@ int wlan_hdd_cfg80211_nan_ext_request(struct wiphy *wiphy,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                   \
 			 WIPHY_VENDOR_CMD_NEED_NETDEV |                 \
 			 WIPHY_VENDOR_CMD_NEED_RUNNING,                 \
-		.doit = wlan_hdd_cfg80211_nan_ext_request               \
+		.doit = wlan_hdd_cfg80211_nan_ext_request,		\
+		vendor_command_policy(nan_attr_policy,			\
+				      QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX) \
 	},								\
 	{                                                               \
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,                \
@@ -90,7 +92,9 @@ int wlan_hdd_cfg80211_nan_ext_request(struct wiphy *wiphy,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                   \
 			WIPHY_VENDOR_CMD_NEED_NETDEV |                  \
 			WIPHY_VENDOR_CMD_NEED_RUNNING,                  \
-		.doit = wlan_hdd_cfg80211_process_ndp_cmd               \
+		.doit = wlan_hdd_cfg80211_process_ndp_cmd,		\
+		vendor_command_policy(vendor_attr_policy,		\
+				      QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX) \
 	},
 #else /* WLAN_FEATURE_NAN */
 #define FEATURE_NAN_VENDOR_COMMANDS

+ 1 - 2
core/hdd/src/wlan_hdd_apf.c

@@ -50,8 +50,7 @@
 #define APF_MAX \
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_MAX
 
-static const struct nla_policy
-wlan_hdd_apf_offload_policy[APF_MAX + 1] = {
+const struct nla_policy wlan_hdd_apf_offload_policy[APF_MAX + 1] = {
 	[APF_SUBCMD] = {.type = NLA_U32},
 	[APF_VERSION] = {.type = NLA_U32},
 	[APF_FILTER_ID] = {.type = NLA_U32},

+ 79 - 93
core/hdd/src/wlan_hdd_cfg80211.c

@@ -147,6 +147,8 @@
 #include "wlan_hdd_thermal.h"
 #include <ol_defines.h>
 #include "wlan_hdd_btc_chain_mode.h"
+#include "os_if_nan.h"
+#include "wlan_hdd_apf.h"
 
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
@@ -4040,9 +4042,8 @@ wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
 #define PARAM_CAND_SEL_SCORE_RSSI \
 	QCA_ATTR_ROAM_CAND_SEL_CRITERIA_SCORE_RSSI
 
-
-static const struct nla_policy
-wlan_hdd_set_roam_param_policy[MAX_ROAMING_PARAM + 1] = {
+const struct nla_policy wlan_hdd_set_roam_param_policy[
+			MAX_ROAMING_PARAM + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_ROAMING_SUBCMD] = {.type = NLA_U32},
 	[QCA_WLAN_VENDOR_ATTR_ROAMING_REQ_ID] = {.type = NLA_U32},
 	[PARAM_NUM_NW] = {.type = NLA_U32},
@@ -5417,7 +5418,7 @@ fail:
 }
 #undef PWR_SAVE_FAIL_CMD_INDEX
 
-static const struct nla_policy
+const struct nla_policy
 wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX
 				       +1] = {
 	[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 },
@@ -5927,11 +5928,14 @@ static int wlan_hdd_cfg80211_keymgmt_set_key(struct wiphy *wiphy,
 }
 #endif
 
-static const struct nla_policy qca_wlan_vendor_get_wifi_info_policy[
-			QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1] = {
-	[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 },
-	[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 },
-	[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_RADIO_INDEX] = {.type = NLA_U32 },
+const struct nla_policy qca_wlan_vendor_get_wifi_info_policy[
+	QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1] = {
+		[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {
+							.type = NLA_U8 },
+		[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {
+							.type = NLA_U8 },
+		[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_RADIO_INDEX] = {
+							.type = NLA_U32 },
 };
 
 /**
@@ -6531,9 +6535,8 @@ nla_put_failure:
 	QCA_WLAN_VENDOR_ATTR_CONFIG_RX_BLOCKSIZE_PEER_MAC
 #define RX_BLOCKSIZE_WINLIMIT \
 	QCA_WLAN_VENDOR_ATTR_CONFIG_RX_BLOCKSIZE_WINLIMIT
-static const struct nla_policy
-wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = {
-
+const struct nla_policy wlan_hdd_wifi_config_policy[
+			QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM] = {.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED] = {
 		.type = NLA_U8 },
@@ -6578,9 +6581,11 @@ wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_ENA] = {.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_CHAIN] = {.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST] = {.type = NLA_U32 },
-	[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL] = {.type = NLA_U32 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL] = {
+						.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL] = {.type = NLA_U16 },
-	[QCA_WLAN_VENDOR_ATTR_CONFIG_TOTAL_BEACON_MISS_COUNT] = {.type = NLA_U8},
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_TOTAL_BEACON_MISS_COUNT] = {
+						.type = NLA_U8},
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_ENABLE] = {.type = NLA_U8 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE] = {.type = NLA_U8},
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_GTX] = {.type = NLA_U8},
@@ -9067,10 +9072,8 @@ static int wlan_hdd_cfg80211_set_wifi_test_config(struct wiphy *wiphy,
 	return errno;
 }
 
-static const struct
-nla_policy
-qca_wlan_vendor_wifi_logger_start_policy
-[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = {
+const struct nla_policy qca_wlan_vendor_wifi_logger_start_policy[
+		QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]
 		= {.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]
@@ -9227,10 +9230,8 @@ static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy,
 	return errno;
 }
 
-static const struct
-nla_policy
-qca_wlan_vendor_wifi_logger_get_ring_data_policy
-[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = {
+const struct nla_policy qca_wlan_vendor_wifi_logger_get_ring_data_policy[
+		QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]
 		= {.type = NLA_U32 },
 };
@@ -9765,8 +9766,8 @@ static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy,
 #endif
 
 #ifdef WLAN_NS_OFFLOAD
-static const struct nla_policy
-ns_offload_set_policy[QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX + 1] = {
+const struct nla_policy ns_offload_set_policy[
+			QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_FLAG] = {.type = NLA_U8},
 };
 
@@ -9875,8 +9876,8 @@ struct weighed_pcl {
 		u32 flag;
 };
 
-static const struct nla_policy get_preferred_freq_list_policy
-		[QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX + 1] = {
+const struct nla_policy get_preferred_freq_list_policy[
+		QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_IFACE_TYPE] = {
 		.type = NLA_U32},
 };
@@ -10136,8 +10137,8 @@ static int wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 	return errno;
 }
 
-static const struct nla_policy set_probable_oper_channel_policy
-		[QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX + 1] = {
+const struct nla_policy set_probable_oper_channel_policy[
+		QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_IFACE_TYPE] = {
 		.type = NLA_U32},
 	[QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_FREQ] = {
@@ -14399,6 +14400,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 	},
 #endif
 	FEATURE_EXTSCAN_VENDOR_COMMANDS
+
+	FEATURE_LL_STATS_VENDOR_COMMANDS
+
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14408,21 +14412,6 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.doit = wlan_hdd_cfg80211_ll_stats_clear
 	},
 
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			 WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_ll_stats_set
-	},
-
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			 WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_ll_stats_get
-	},
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
 	{
@@ -14439,7 +14428,8 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_set_scanning_mac_oui
+		.doit = wlan_hdd_cfg80211_set_scanning_mac_oui,
+		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)
 	},
 
 	FEATURE_CONCURRENCY_MATRIX_VENDOR_COMMANDS
@@ -14450,7 +14440,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_disable_dfs_chan_scan
+		.doit = wlan_hdd_cfg80211_disable_dfs_chan_scan,
+		vendor_command_policy(wlan_hdd_set_no_dfs_flag_config_policy,
+				      QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14477,7 +14469,8 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV,
-		.doit = wlan_hdd_cfg80211_get_features
+		.doit = wlan_hdd_cfg80211_get_features,
+		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)
 	},
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 	{
@@ -14486,7 +14479,8 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_keymgmt_set_key
+		.doit = wlan_hdd_cfg80211_keymgmt_set_key,
+		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)
 	},
 #endif
 	{
@@ -14494,7 +14488,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			 WIPHY_VENDOR_CMD_NEED_NETDEV,
-		.doit = wlan_hdd_cfg80211_get_wifi_info
+		.doit = wlan_hdd_cfg80211_get_wifi_info,
+		vendor_command_policy(qca_wlan_vendor_get_wifi_info_policy,
+				      QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14502,7 +14498,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_wifi_configuration_set
+		.doit = wlan_hdd_cfg80211_wifi_configuration_set,
+		vendor_command_policy(wlan_hdd_wifi_config_policy,
+				      QCA_WLAN_VENDOR_ATTR_CONFIG_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14521,7 +14519,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_set_ext_roam_params
+		.doit = wlan_hdd_cfg80211_set_ext_roam_params,
+		vendor_command_policy(wlan_hdd_set_roam_param_policy,
+				      QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14529,13 +14529,19 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_wifi_logger_start
+		.doit = wlan_hdd_cfg80211_wifi_logger_start,
+		vendor_command_policy(
+				qca_wlan_vendor_wifi_logger_start_policy,
+				QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV,
-		.doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data
+		.doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data,
+		vendor_command_policy(
+			qca_wlan_vendor_wifi_logger_get_ring_data_policy,
+			QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14544,7 +14550,10 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_get_preferred_freq_list
+		.doit = wlan_hdd_cfg80211_get_preferred_freq_list,
+		vendor_command_policy(
+			get_preferred_freq_list_policy,
+			QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
@@ -14553,7 +14562,10 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			WIPHY_VENDOR_CMD_NEED_NETDEV |
 			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_set_probable_oper_channel
+		.doit = wlan_hdd_cfg80211_set_probable_oper_channel,
+		vendor_command_policy(
+				set_probable_oper_channel_policy,
+				QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX)
 	},
 #ifdef WLAN_FEATURE_TSF
 	{
@@ -14596,7 +14608,9 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			 WIPHY_VENDOR_CMD_NEED_NETDEV |
 			 WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_set_ns_offload
+		.doit = wlan_hdd_cfg80211_set_ns_offload,
+		vendor_command_policy(ns_offload_set_policy,
+				      QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX)
 	},
 #endif /* WLAN_NS_OFFLOAD */
 	{
@@ -14604,26 +14618,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_LOGGER_FEATURE_SET,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			 WIPHY_VENDOR_CMD_NEED_NETDEV,
-		.doit = wlan_hdd_cfg80211_get_logger_supp_feature
-	},
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			WIPHY_VENDOR_CMD_NEED_NETDEV |
-			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_vendor_scan
+		.doit = wlan_hdd_cfg80211_get_logger_supp_feature,
+		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)
 	},
 
+	FEATURE_TRIGGER_SCAN_VENDOR_COMMANDS
+
 	/* Vendor abort scan */
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ABORT_SCAN,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			WIPHY_VENDOR_CMD_NEED_NETDEV |
-			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_vendor_abort_scan
-	},
+	FEATURE_ABORT_SCAN_VENDOR_COMMANDS
 
 	/* OCB commands */
 	FEATURE_OCB_VENDOR_COMMANDS
@@ -14641,29 +14643,12 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 
 	FEATURE_OTA_TEST_VENDOR_COMMANDS
 
-#ifdef FEATURE_LFR_SUBNET_DETECTION
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-				WIPHY_VENDOR_CMD_NEED_NETDEV |
-				WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_set_gateway_params
-	},
-#endif /* FEATURE_LFR_SUBNET_DETECTION */
+	FEATURE_LFR_SUBNET_DETECT_VENDOR_COMMANDS
 
 	FEATURE_TX_POWER_VENDOR_COMMANDS
 
-#ifdef FEATURE_WLAN_APF
-	{
-		.info.vendor_id = QCA_NL80211_VENDOR_ID,
-		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER,
-		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			WIPHY_VENDOR_CMD_NEED_NETDEV |
-			WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_apf_offload
-	},
-#endif /* FEATURE_WLAN_APF */
+	FEATURE_APF_OFFLOAD_VENDOR_COMMANDS
+
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY,
@@ -14717,7 +14702,8 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
 			 WIPHY_VENDOR_CMD_NEED_NETDEV |
 			 WIPHY_VENDOR_CMD_NEED_RUNNING,
-		.doit = wlan_hdd_cfg80211_get_bus_size
+		.doit = wlan_hdd_cfg80211_get_bus_size,
+		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)
 	},
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,

+ 36 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -32,6 +32,42 @@
 
 struct hdd_context;
 
+/* QCA_NL80211_VENDOR_SUBCMD_ROAM policy */
+extern const struct nla_policy wlan_hdd_set_roam_param_policy[
+			QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO policy */
+extern const struct nla_policy qca_wlan_vendor_get_wifi_info_policy[
+			QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION policy */
+extern const struct nla_policy wlan_hdd_wifi_config_policy[
+			QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START policy */
+extern const struct nla_policy qca_wlan_vendor_wifi_logger_start_policy[
+			QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD policy */
+extern const struct nla_policy ns_offload_set_policy[
+			QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST policy */
+extern const struct nla_policy get_preferred_freq_list_policy[
+			QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_SET_PROBABLE_OPER_CHANNEL policy */
+extern const struct nla_policy set_probable_oper_channel_policy[
+			QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG policy */
+extern const struct nla_policy wlan_hdd_set_no_dfs_flag_config_policy[
+			QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA policy */
+extern const struct nla_policy qca_wlan_vendor_wifi_logger_get_ring_data_policy[
+			QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1];
+
 /* value for initial part of frames and number of bytes to be compared */
 #define GAS_INITIAL_REQ "\x04\x0a"
 #define GAS_INITIAL_REQ_SIZE 2

+ 5 - 1
core/hdd/src/wlan_hdd_scan.c

@@ -925,7 +925,7 @@ static int wlan_hdd_vendor_scan_random_attr(struct wiphy *wiphy,
 }
 #endif
 
-static const
+const
 struct nla_policy scan_policy[QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_SCAN_FLAGS] = {.type = NLA_U32},
 	[QCA_WLAN_VENDOR_ATTR_SCAN_TX_NO_CCK_RATE] = {.type = NLA_FLAG},
@@ -936,6 +936,10 @@ struct nla_policy scan_policy[QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1] = {
 					   .len = QDF_MAC_ADDR_SIZE},
 	[QCA_WLAN_VENDOR_ATTR_SCAN_MAC_MASK] = {.type = NLA_UNSPEC,
 						.len = QDF_MAC_ADDR_SIZE},
+	[QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES] = {.type = NLA_NESTED},
+	[QCA_WLAN_VENDOR_ATTR_SCAN_SSIDS] = {.type = NLA_NESTED},
+	[QCA_WLAN_VENDOR_ATTR_SCAN_SUPP_RATES] = {.type = NLA_NESTED},
+	[QCA_WLAN_VENDOR_ATTR_SCAN_BSSID] = {.type = NLA_BINARY},
 };
 
 /**

+ 16 - 0
core/hdd/src/wlan_hdd_scan.h

@@ -29,6 +29,22 @@
 #include "wlan_hdd_main.h"
 #include "csr_inside_api.h"
 #include <wlan_cfg80211_scan.h>
+#include "qca_vendor.h"
+
+extern const struct nla_policy scan_policy[
+			QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1];
+
+#define FEATURE_TRIGGER_SCAN_VENDOR_COMMANDS \
+{ \
+	.info.vendor_id = QCA_NL80211_VENDOR_ID, \
+	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN, \
+	.flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
+		WIPHY_VENDOR_CMD_NEED_NETDEV | \
+		WIPHY_VENDOR_CMD_NEED_RUNNING, \
+	.doit = wlan_hdd_cfg80211_vendor_scan, \
+	vendor_command_policy(scan_policy, \
+			      QCA_WLAN_VENDOR_ATTR_SCAN_MAX) \
+},
 
 #define EXTSCAN_PARAM_MAX QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
 

+ 8 - 10
core/hdd/src/wlan_hdd_stats.c

@@ -1201,13 +1201,12 @@ void hdd_lost_link_info_cb(hdd_handle_t hdd_handle,
 	hdd_debug("rssi on disconnect %d", adapter->rssi_on_disconnect);
 }
 
-const struct
-nla_policy
-	qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1] = {
-	[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = {
-						.type = NLA_U32},
-	[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = {
-						.type = NLA_U32},
+const struct nla_policy qca_wlan_vendor_ll_set_policy[
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1] = {
+	[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]
+						= { .type = NLA_U32 },
+	[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]
+						= { .type = NLA_U32 },
 };
 
 /**
@@ -1329,9 +1328,8 @@ int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
 	return errno;
 }
 
-const struct
-nla_policy
-	qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1] = {
+const struct nla_policy qca_wlan_vendor_ll_get_policy[
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1] = {
 	/* Unsigned 32bit value provided by the caller issuing the GET stats
 	 * command. When reporting
 	 * the stats results, the driver uses the same value to indicate

+ 36 - 0
core/hdd/src/wlan_hdd_stats.h

@@ -41,6 +41,42 @@
 
 extern const struct nla_policy qca_wlan_vendor_ll_ext_policy[
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_EXT_MAX + 1];
+
+#ifdef WLAN_FEATURE_LINK_LAYER_STATS
+/* QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET */
+extern const struct nla_policy qca_wlan_vendor_ll_set_policy[
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_NDP */
+extern const struct nla_policy qca_wlan_vendor_ll_get_policy[
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1];
+
+#define FEATURE_LL_STATS_VENDOR_COMMANDS                                \
+{                                                                       \
+	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
+	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET,          \
+	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
+		 WIPHY_VENDOR_CMD_NEED_NETDEV |                         \
+		 WIPHY_VENDOR_CMD_NEED_RUNNING,                         \
+	.doit = wlan_hdd_cfg80211_ll_stats_set,                         \
+	vendor_command_policy(qca_wlan_vendor_ll_set_policy,            \
+			      QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX)    \
+},                                                                      \
+                                                                        \
+{                                                                       \
+	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
+	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET,          \
+	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
+		 WIPHY_VENDOR_CMD_NEED_NETDEV |                         \
+		 WIPHY_VENDOR_CMD_NEED_RUNNING,                         \
+	.doit = wlan_hdd_cfg80211_ll_stats_get,                         \
+	vendor_command_policy(qca_wlan_vendor_ll_get_policy,            \
+			      QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX)    \
+},
+#else
+#define FEATURE_LL_STATS_VENDOR_COMMANDS
+#endif
+
 /**
  * struct index_vht_data_rate_type - vht data rate type
  * @beacon_rate_index: Beacon rate index

+ 6 - 6
core/hdd/src/wlan_hdd_subnet_detect.c

@@ -41,17 +41,17 @@
 #define PARAM_IPV4_ADDR QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_IPV4_ADDR
 #define PARAM_IPV6_ADDR QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_IPV6_ADDR
 
-static const struct nla_policy
-	policy[QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_MAX + 1] = {
-		[PARAM_MAC_ADDR] = {
+const struct nla_policy subnet_detect_policy[
+			QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_MAX + 1] = {
+		[QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_GW_MAC_ADDR] = {
 				.type = NLA_UNSPEC,
 				.len = QDF_MAC_ADDR_SIZE
 		},
-		[PARAM_IPV4_ADDR] = {
+		[QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_IPV4_ADDR] = {
 				.type = NLA_UNSPEC,
 				.len = QDF_IPV4_ADDR_SIZE
 		},
-		[PARAM_IPV6_ADDR] = {
+		[QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_IPV6_ADDR] = {
 				.type = NLA_UNSPEC,
 				.len = QDF_IPV6_ADDR_SIZE
 		}
@@ -114,7 +114,7 @@ static int __wlan_hdd_cfg80211_set_gateway_params(struct wiphy *wiphy,
 	 */
 	if (wlan_cfg80211_nla_parse(tb,
 				    QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_MAX,
-				    data, data_len, policy)) {
+				    data, data_len, subnet_detect_policy)) {
 		hdd_err("Invalid ATTR list");
 		return -EINVAL;
 	}

+ 17 - 1
core/hdd/src/wlan_hdd_subnet_detect.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015,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
@@ -29,6 +29,22 @@
 struct wiphy;
 struct wireless_dev;
 
+/* QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG policy */
+extern const struct nla_policy subnet_detect_policy[
+			QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_MAX + 1];
+
+#define FEATURE_LFR_SUBNET_DETECT_VENDOR_COMMANDS \
+	{ \
+		.info.vendor_id = QCA_NL80211_VENDOR_ID, \
+		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG, \
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
+				WIPHY_VENDOR_CMD_NEED_NETDEV | \
+				WIPHY_VENDOR_CMD_NEED_RUNNING, \
+		.doit = wlan_hdd_cfg80211_set_gateway_params, \
+		vendor_command_policy(subnet_detect_policy, \
+				      QCA_WLAN_VENDOR_ATTR_GW_PARAM_CONFIG_MAX)\
+	},
+
 int wlan_hdd_cfg80211_set_gateway_params(struct wiphy *wiphy,
 	struct wireless_dev *wdev, const void *data, int data_len);
 #endif /* FEATURE_LFR_SUBNET_DETECTION */

+ 10 - 1
os_if/nan/inc/os_if_nan.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-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
@@ -27,6 +27,15 @@
 #ifdef WLAN_FEATURE_NAN
 #include "nan_public_structs.h"
 #include "nan_ucfg_api.h"
+#include "qca_vendor.h"
+
+/* QCA_NL80211_VENDOR_SUBCMD_NAN_EXT policy */
+extern const struct nla_policy nan_attr_policy[
+			QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX + 1];
+
+/* QCA_NL80211_VENDOR_SUBCMD_NDP policy */
+extern const struct nla_policy vendor_attr_policy[
+			QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1];
 
 /**
  * struct ndi_find_vdev_filter - find vdev filter object. this can be extended

+ 4 - 4
os_if/nan/src/os_if_nan.c

@@ -40,8 +40,8 @@
 #define NAN_CMD_MAX_SIZE 2048
 
 /* NLA policy */
-static const struct nla_policy
-nan_attr_policy[QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX + 1] = {
+const struct nla_policy nan_attr_policy[
+			QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA] = {
 						.type = NLA_BINARY,
 						.len = NAN_CMD_MAX_SIZE
@@ -61,8 +61,8 @@ nan_attr_policy[QCA_WLAN_VENDOR_ATTR_NAN_PARAMS_MAX + 1] = {
 };
 
 /* NLA policy */
-static const struct nla_policy
-vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
+const struct nla_policy vendor_attr_policy[
+			QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD] = {
 						.type = NLA_U32,
 						.len = sizeof(uint32_t)