diff mbox series

[10/10] staging: wfx: allow to run nl80211 vendor commands with 'iw'

Message ID 20200526171821.934581-11-Jerome.Pouiller@silabs.com
State New
Headers show
Series [01/10] staging: wfx: drop unused variable | expand

Commit Message

Jérôme Pouiller May 26, 2020, 5:18 p.m. UTC
From: Jérôme Pouiller <jerome.pouiller@silabs.com>

In current code, the nl80211 vendor extensions provided by the driver
use the new API[1]. It requires to pack the netlink attributes into a
NLA_NESTED.

Unfortunately, it is not the way the command 'iw vendor' works.

This patch, add extra vendor commands that can be called with
'iw vendor'.

[1] see commit 901bb989185516 ("nl80211: require and validate vendor
    command policy")

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/nl80211_vendor.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/wfx/nl80211_vendor.h b/drivers/staging/wfx/nl80211_vendor.h
index 0ff3bf73f0ad3..b805b4aa951a0 100644
--- a/drivers/staging/wfx/nl80211_vendor.h
+++ b/drivers/staging/wfx/nl80211_vendor.h
@@ -23,8 +23,11 @@  int wfx_nl_pta_params(struct wiphy *wiphy, struct wireless_dev *widev,
 
 enum {
 	WFX_NL80211_SUBCMD_PS_TIMEOUT                   = 0x10,
+	WFX_NL80211_SUBCMD_PS_TIMEOUT_COMPAT            = 0x11,
 	WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK        = 0x20,
+	WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK_COMPAT = 0x21,
 	WFX_NL80211_SUBCMD_PTA_PARMS                    = 0x30,
+	WFX_NL80211_SUBCMD_PTA_PARMS_COMPAT             = 0x31,
 };
 
 enum {
@@ -53,18 +56,37 @@  static const struct wiphy_vendor_command wfx_nl80211_vendor_commands[] = {
 		.policy = wfx_nl_policy,
 		.doit = wfx_nl_ps_timeout,
 		.maxattr = WFX_NL80211_ATTR_MAX - 1,
+	}, {
+		// Compat with iw
+		.info.vendor_id = WFX_NL80211_ID,
+		.info.subcmd = WFX_NL80211_SUBCMD_PS_TIMEOUT_COMPAT,
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV,
+		.policy = VENDOR_CMD_RAW_DATA,
+		.doit = wfx_nl_ps_timeout,
 	}, {
 		.info.vendor_id = WFX_NL80211_ID,
 		.info.subcmd = WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK,
 		.policy = wfx_nl_policy,
 		.doit = wfx_nl_burn_antirollback,
 		.maxattr = WFX_NL80211_ATTR_MAX - 1,
+	}, {
+		// Compat with iw
+		.info.vendor_id = WFX_NL80211_ID,
+		.info.subcmd = WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK_COMPAT,
+		.policy = VENDOR_CMD_RAW_DATA,
+		.doit = wfx_nl_burn_antirollback,
 	}, {
 		.info.vendor_id = WFX_NL80211_ID,
 		.info.subcmd = WFX_NL80211_SUBCMD_PTA_PARMS,
 		.policy = wfx_nl_policy,
 		.doit = wfx_nl_pta_params,
 		.maxattr = WFX_NL80211_ATTR_MAX - 1,
+	}, {
+		// Compat with iw
+		.info.vendor_id = WFX_NL80211_ID,
+		.info.subcmd = WFX_NL80211_SUBCMD_PTA_PARMS_COMPAT,
+		.policy = VENDOR_CMD_RAW_DATA,
+		.doit = wfx_nl_pta_params,
 	},
 };