Skip to contentSkip to conversation

wifi: nxpwifi: add TX power limit configuration support

PATCH RESEND In review [email protected] 2 participants 5 messages Nov 24 – Nov 25

Subsystems (3)

v1 of 3 In review Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover wifi: nxpwifi: add TX power limit configuration support

From: Jeff Chen <[email protected]>

This series adds support for accessing firmware Transmit Rate-based Power Control (TRPC) configuration through an NL80211 vendor command.

Patch 1 adds common NXP vendor command definitions in a UAPI header.

Patch 2 adds support for the firmware TRPC command used to retrieve and update TX power limit data.

Patch 3 exposes the TRPC configuration interface to userspace through NL80211_CMD_VENDOR.

Changes in v2:
- Add a common UAPI header for NXP vendor command definitions.
- Move vendor command definitions from the driver to the UAPI header.
- Address review comments.

Jeff Chen (3):
wifi: nl80211: vendor-cmd: add NXP vendor command definitions
wifi: nxpwifi: add firmware TRPC command support
wifi: nxpwifi: add netlink vendor command for TX power limits

 drivers/net/wireless/nxp/nxpwifi/Makefile   |   1 +
 drivers/net/wireless/nxp/nxpwifi/cfg.h      |  11 ++
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c |   5 +-
 drivers/net/wireless/nxp/nxpwifi/fw.h       |   8 ++
 drivers/net/wireless/nxp/nxpwifi/main.h     |   3 +
 drivers/net/wireless/nxp/nxpwifi/sta_cfg.c  |   8 ++
 drivers/net/wireless/nxp/nxpwifi/sta_cmd.c  |  67 +++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.c   | 152 ++++++++++++++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.h   |  14 ++
 include/uapi/linux/nl80211-vnd-nxp.h        |  81 +++++++++++
 10 files changed, 349 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.c
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.h
 create mode 100644 include/uapi/linux/nl80211-vnd-nxp.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH RESEND 1/3 wifi: nl80211: vendor-cmd: add NXP vendor command definitions

From: Jeff Chen <[email protected]>

Add NXP vendor command and attribute definitions for use with NL80211_CMD_VENDOR.

The initial user of this interface is the Transmit Rate-based Power Control (TRPC) configuration command.

The TRPC table is a firmware-defined ABI that contains TX power limit data. Existing nl80211 TX power interfaces allow TX power levels to be configured, but do not provide an interface for exchanging TRPC table data between userspace and firmware.

Therefore, the TRPC configuration interface is exposed through a vendor command. The kernel does not interpret the TRPC table contents and only passes the table data between userspace and firmware.

Example use cases include:
- Reading firmware TX power limit configuration for verification.
- Updating platform-specific TX power limit tables.
- Supporting manufacturing, validation, regulatory, and platform bring-up workflows that require access to firmware-defined TX power limit data.

---
 include/uapi/linux/nl80211-vnd-nxp.h | 81 ++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 include/uapi/linux/nl80211-vnd-nxp.h
include/uapi/linux/nl80211-vnd-nxp.h new file +81 -0
new file mode 100644
index 000000000000..4e18d0f5af03
@@ -0,0 +1,81 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * NXP vendor command definitions for nl80211
+ *
+ * Copyright 2026 NXP
+ */
+
+#ifndef __VENDOR_CMD_NXP_H__
+#define __VENDOR_CMD_NXP_H__
+
+#define NXP_OUI		0x006037
+
+/**
+ * enum nxp_vendor_cmd - supported NXP vendor commands
+ *
+ * @NXP_VENDOR_CMD_TXPOWER_LIMIT: Access firmware Transmit Rate-based
+ *      Power Control (TRPC) configuration. The command uses the
+ *      attributes defined by &enum nxp_txpwrlimit_attrs.
+ *
+ *      SET operations provide TRPC table data through
+ *      %NXP_ATTR_TXPWRLIMIT_DATA. GET operations return the requested TRPC
+ *      table in %NXP_ATTR_TXPWRLIMIT_DATA.
+ *
+ *      The kernel does not interpret the TRPC table contents and only
+ *      passes the table data between userspace and firmware.
+ */
+enum nxp_vendor_cmd {
+	NXP_VENDOR_CMD_TXPOWER_LIMIT,
+};
+
+/**
+ * enum nxp_txpwrlimit_action - operation for %NXP_ATTR_TXPWRLIMIT_ACTION
+ *
+ * @NXP_TXPWRLIMIT_ACTION_GET: Retrieve the TRPC table for the selected
+ *	subband.
+ * @NXP_TXPWRLIMIT_ACTION_SET: Update the TRPC table for the selected
+ *	subband using data from %NXP_ATTR_TXPWRLIMIT_DATA.
+ */
+enum nxp_txpwrlimit_action {
+	NXP_TXPWRLIMIT_ACTION_GET,
+	NXP_TXPWRLIMIT_ACTION_SET,
+};
+
+/**
+ * enum nxp_txpwrlimit_subband - firmware TRPC subband selectors
+ *
+ * The selector values are defined by the firmware Transmit Rate-based
+ * Power Control (TRPC) interface.
+ *
+ * @NXP_TXPWRLIMIT_SUBBAND_2G: 2.4 GHz band.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_0: 5 GHz subband 0.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_1: 5 GHz subband 1.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_2: 5 GHz subband 2.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_3: 5 GHz subband 3.
+ */
+enum nxp_txpwrlimit_subband {
+	NXP_TXPWRLIMIT_SUBBAND_2G	= 0x00,
+	NXP_TXPWRLIMIT_SUBBAND_5G_0	= 0x10,
+	NXP_TXPWRLIMIT_SUBBAND_5G_1	= 0x11,
+	NXP_TXPWRLIMIT_SUBBAND_5G_2	= 0x12,
+	NXP_TXPWRLIMIT_SUBBAND_5G_3	= 0x13,
+};
+
+/**
+ * enum nxp_txpwrlimit_attrs - TX power limit vendor attributes
+ * @NXP_ATTR_TXPWRLIMIT_UNSPEC: Unspecified attribute.
+ * @NXP_ATTR_TXPWRLIMIT_ACTION: Operation from &enum nxp_txpwrlimit_action.
+ * @NXP_ATTR_TXPWRLIMIT_SUBBAND: Target subband.
+ * @NXP_ATTR_TXPWRLIMIT_DATA: Firmware-defined TRPC table data.
+ */
+enum nxp_txpwrlimit_attrs {
+	NXP_ATTR_TXPWRLIMIT_UNSPEC,
+	NXP_ATTR_TXPWRLIMIT_ACTION,
+	NXP_ATTR_TXPWRLIMIT_SUBBAND,
+	NXP_ATTR_TXPWRLIMIT_DATA,
+
+	__NXP_ATTR_TXPWRLIMIT_AFTER_LAST,
+	NXP_ATTR_TXPWRLIMIT_MAX = __NXP_ATTR_TXPWRLIMIT_AFTER_LAST - 1
+};
+
+#endif /* __VENDOR_CMD_NXP_H__ */
Signature · 1 line
2.34.1
#2 lore raw

PATCH RESEND 2/3 wifi: nxpwifi: add firmware TRPC command support

In reply to [email protected]

From: Jeff Chen <[email protected]>

Add support for the firmware TRPC configuration command used to retrieve and update TX power limit data.

---
 drivers/net/wireless/nxp/nxpwifi/cfg.h     | 11 ++++
 drivers/net/wireless/nxp/nxpwifi/fw.h      |  8 +++
 drivers/net/wireless/nxp/nxpwifi/main.h    |  2 +
 drivers/net/wireless/nxp/nxpwifi/sta_cfg.c |  8 +++
 drivers/net/wireless/nxp/nxpwifi/sta_cmd.c | 67 ++++++++++++++++++++++
 5 files changed, 96 insertions(+)
drivers/net/wireless/nxp/nxpwifi/cfg.h +11 -0
index 8627a3372978..4c0558ed483e 100644
@@ -755,6 +755,17 @@ struct nxpwifi_ds_coalesce_cfg {
 	struct nxpwifi_coalesce_rule rule[NXPWIFI_COALESCE_MAX_RULES];
 };
 
+/* Host-side helper for the channel TRPC command. */
+struct nxpwifi_ds_chan_trpc_cfg {
+	u32 len;
+	u16 action;
+	u16 subband;
+	u8 tlvbuffer[];
+};
+
+/* Upper bound on the TRPC TLV table exchanged with the firmware. */
+#define NXPWIFI_MAX_TRPC_BUF (4 * 1024)
+
 struct nxpwifi_11ax_he_cap_cfg {
 	u16 id;
 	u16 len;
drivers/net/wireless/nxp/nxpwifi/fw.h +8 -0
index 124728a72442..82641b28259f 100644
@@ -388,6 +388,7 @@ enum NXPWIFI_802_11_PRIVACY_FILTER {
 #define HOST_CMD_CAU_REG_ACCESS                    0x00ed
 #define HOST_CMD_SET_BSS_MODE                      0x00f7
 #define HOST_CMD_PCIE_DESC_DETAILS                 0x00fa
+#define HOST_CMD_CHAN_TRPC_CONFIG                  0x00fb
 #define HOST_CMD_802_11_NET_MONITOR                0x0102
 #define HOST_CMD_802_11_SCAN_EXT                   0x0107
 #define HOST_CMD_COALESCE_CFG                      0x010a
@@ -2375,6 +2376,12 @@ struct host_cmd_twt_cfg {
 	u8 val[];
 } __packed;
 
+struct host_cmd_chan_trpc_cfg {
+	__le16 action;
+	__le16 subband;
+	u8 tlvbuffer[];
+} __packed;
+
 struct host_cmd_ds_command {
 	__le16 command;
 	__le16 size;
@@ -2449,6 +2456,7 @@ struct host_cmd_ds_command {
 		struct host_cmd_11ax_cmd ax_cmd;
 		struct host_cmd_ds_802_11_net_monitor net_mon;
 		struct host_cmd_twt_cfg twt_cfg;
+		struct host_cmd_chan_trpc_cfg ch_trpc_cfg;
 	} params;
 } __packed;
 
drivers/net/wireless/nxp/nxpwifi/main.h +2 -0
index b25a6a4f2936..9ae017bdc6ca 100644
@@ -1415,6 +1415,8 @@ int nxpwifi_get_wakeup_reason(struct nxpwifi_private *priv, u16 action,
 			      struct nxpwifi_ds_wakeup_reason *wakeup_reason);
 int nxpwifi_get_chan_info(struct nxpwifi_private *priv,
 			  struct nxpwifi_channel_band *channel_band);
+int nxpwifi_chan_trpc_cfg(struct nxpwifi_private *priv, int cmd_type,
+			  struct nxpwifi_ds_chan_trpc_cfg *ch_trpc);
 void nxpwifi_coex_ampdu_rxwinsize(struct nxpwifi_adapter *adapter);
 void nxpwifi_11n_delba(struct nxpwifi_private *priv, int tid);
 int nxpwifi_send_domain_info_cmd_fw(struct wiphy *wiphy, enum nl80211_band band);
drivers/net/wireless/nxp/nxpwifi/sta_cfg.c +8 -0
index 56cf63fbf7fe..650de6156912 100644
@@ -1175,3 +1175,11 @@ int nxpwifi_get_chan_info(struct nxpwifi_private *priv,
 				HOST_ACT_GEN_GET, 0, channel_band,
 				NXPWIFI_SYNC_CMD);
 }
+
+int nxpwifi_chan_trpc_cfg(struct nxpwifi_private *priv, int cmd_type,
+			  struct nxpwifi_ds_chan_trpc_cfg *ch_trpc)
+{
+	return nxpwifi_send_cmd(priv, HOST_CMD_CHAN_TRPC_CONFIG,
+				ch_trpc->action, 0, ch_trpc,
+				cmd_type == NXPWIFI_SYNC_CMD);
+}
drivers/net/wireless/nxp/nxpwifi/sta_cmd.c +67 -0

79 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

PATCH RESEND 3/3 wifi: nxpwifi: add netlink vendor command for TX power limits

In reply to [email protected]

From: Jeff Chen <[email protected]>

Add support for the NXP TX power limit vendor command.

The command provides userspace access to firmware Transmit Rate-based Power Control (TRPC) configuration through NL80211_CMD_VENDOR.

---
 drivers/net/wireless/nxp/nxpwifi/Makefile   |   1 +
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c |   5 +-
 drivers/net/wireless/nxp/nxpwifi/main.h     |   1 +
 drivers/net/wireless/nxp/nxpwifi/vendor.c   | 152 ++++++++++++++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.h   |  14 ++
 5 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.c
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.h
drivers/net/wireless/nxp/nxpwifi/Makefile +1 -0
index 8f581429f28d..f82435253a72 100644
@@ -28,6 +28,7 @@ nxpwifi-y += sta_tx.o
 nxpwifi-y += sta_rx.o
 nxpwifi-y += uap_txrx.o
 nxpwifi-y += cfg80211.o
+nxpwifi-y += vendor.o
 nxpwifi-y += ethtool.o
 nxpwifi-y += 11h.o
 nxpwifi-$(CONFIG_DEBUG_FS) += debugfs.o
drivers/net/wireless/nxp/nxpwifi/cfg80211.c +4 -1
index ba54078b082c..b7bd10bb0a91 100644
@@ -10,6 +10,7 @@
 #include "cmdevt.h"
 #include "11n.h"
 #include "wmm.h"
+#include "vendor.h"
 
 static const struct ieee80211_iface_limit nxpwifi_ap_sta_limits[] = {
 	{
@@ -91,7 +92,7 @@ u8 nxpwifi_get_chan_type(struct nxpwifi_private *priv)
 }
 
 /* Retrieve the driver private data from the wiphy */
-static void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy)
+void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy)
 {
 	return (void *)(*(unsigned long *)wiphy_priv(wiphy));
 }
@@ -3848,6 +3849,8 @@ int nxpwifi_register_cfg80211(struct nxpwifi_adapter *adapter)
 	wiphy->cipher_suites = nxpwifi_cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(nxpwifi_cipher_suites);
 
+	nxpwifi_set_vendor_commands(wiphy);
+
 	if (adapter->regd) {
 		wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
 					   REGULATORY_DISABLE_BEACON_HINTS |
drivers/net/wireless/nxp/nxpwifi/main.h +1 -0
index 9ae017bdc6ca..bbfc4266c48d 100644
@@ -1435,4 +1435,5 @@ void nxpwifi_dev_debugfs_remove(struct nxpwifi_private *priv);
 int nxpwifi_reinit_sw(struct nxpwifi_adapter *adapter);
 void nxpwifi_shutdown_sw(struct nxpwifi_adapter *adapter);
 bool nxpwifi_is_valid_region_code(enum nxpwifi_region_code code);
+void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy);
 #endif /* !_NXPWIFI_MAIN_H_ */
drivers/net/wireless/nxp/nxpwifi/vendor.c new file +152 -0

152 lines not on this page · raw message

drivers/net/wireless/nxp/nxpwifi/vendor.h new file +14 -0
new file mode 100644
index 000000000000..fdde8e1a7a40
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * NXP Wireless LAN device driver: vendor command interface
+ *
+ * Copyright 2026 NXP
+ */
+
+#ifndef __NXPWIFI_VENDOR_H__
+#define __NXPWIFI_VENDOR_H__
+
+#include <uapi/linux/nl80211-vnd-nxp.h>
+
+void nxpwifi_set_vendor_commands(struct wiphy *wiphy);
+#endif /* __NXPWIFI_VENDOR_H__ */
Signature · 1 line
2.34.1
#4 lore raw

RE: [PATCH RESEND,wireless-next 3/3] wifi: nxpwifi: add netlink vendor command for TX power limits

drivers/net/wireless/nxp/nxpwifi/vendor.c line 30

Quoted 8 lines · [email protected] <[email protected]> wrote:
drivers/net/wireless/nxp/nxpwifi/vendor.c new file +8 -0
+static bool nxpwifi_txpwrlimit_subband_valid(u8 subband)
+{
+       switch (subband) {
+       case NXP_TXPWRLIMIT_SUBBAND_2G:
+       case NXP_TXPWRLIMIT_SUBBAND_5G_0:
+       case NXP_TXPWRLIMIT_SUBBAND_5G_1:
+       case NXP_TXPWRLIMIT_SUBBAND_5G_2:
+       case NXP_TXPWRLIMIT_SUBBAND_5G_3:

Since vendor command is discouraged, is NL80211_CMD_SET_SAR_SPECS suitable for you?