linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 10/10] staging: wfx: allow to run nl80211 vendor commands with 'iw'
Date: Tue, 26 May 2020 19:18:21 +0200	[thread overview]
Message-ID: <20200526171821.934581-11-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200526171821.934581-1-Jerome.Pouiller@silabs.com>

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 --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,
 	},
 };
 
-- 
2.26.2


  parent reply	other threads:[~2020-05-26 17:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 17:18 [PATCH 00/10] staging: wfx: introduce nl80211 vendor extensions Jerome Pouiller
2020-05-26 17:18 ` [PATCH 01/10] staging: wfx: drop unused variable Jerome Pouiller
2020-05-26 17:18 ` [PATCH 02/10] staging: wfx: do not declare variables inside loops Jerome Pouiller
2020-05-26 17:18 ` [PATCH 03/10] staging: wfx: drop unused function wfx_pending_requeue() Jerome Pouiller
2020-05-26 17:18 ` [PATCH 04/10] staging: wfx: add support for tx_power_loop Jerome Pouiller
2020-05-26 17:18 ` [PATCH 05/10] staging: wfx: retrieve the PS status from the vif Jerome Pouiller
2020-05-26 17:18 ` [PATCH 06/10] staging: wfx: split wfx_get_ps_timeout() from wfx_update_pm() Jerome Pouiller
2020-05-26 17:18 ` [PATCH 07/10] staging: wfx: add support for set/get ps_timeout Jerome Pouiller
2020-05-26 17:18 ` [PATCH 08/10] staging: wfx: allow to burn prevent rollback bit Jerome Pouiller
2020-05-26 17:18 ` [PATCH 09/10] staging: wfx: allow to set PTA settings Jerome Pouiller
2020-05-26 17:18 ` Jerome Pouiller [this message]
2020-05-27  8:22 ` [PATCH 00/10] staging: wfx: introduce nl80211 vendor extensions Greg Kroah-Hartman
2020-05-27 12:34 ` Kalle Valo
2020-05-27 13:05   ` Jérôme Pouiller
2020-05-29 15:13     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200526171821.934581-11-Jerome.Pouiller@silabs.com \
    --to=jerome.pouiller@silabs.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).