Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v1] wifi: mt76: mt792x: Add MTK OUI support for wpa supplicant
@ 2026-10-30  3:17 Eason Lai
  2026-11-18  1:03 ` [PATCH v2] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI) Michael Shih
  0 siblings, 1 reply; 7+ messages in thread
From: Eason Lai @ 2026-10-30  3:17 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai,
	michael.shih, eason.lai

From: Michael Shih <michael.shih@mediatek.com>

Implement MediaTek OUI vendor command in the mt76 driver by defining a
 wiphy_vendor_command table with a GET_CHIP_INFO sub-command handler.

Signed-off-by: Michael Shih <michael.shih@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/Makefile   |  2 +-
 drivers/net/wireless/mediatek/mt76/mt792x.h   |  1 +
 .../net/wireless/mediatek/mt76/mt792x_core.c  |  2 +
 .../wireless/mediatek/mt76/mt792x_vendor.c    | 76 +++++++++++++++++++
 .../wireless/mediatek/mt76/mt792x_vendor.h    | 36 +++++++++
 5 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.h

diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile
index cacdd2b13d05..90bf68f25cfd 100644
--- a/drivers/net/wireless/mediatek/mt76/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/Makefile
@@ -38,7 +38,7 @@ mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
 mt76-connac-lib-y := mt76_connac_mcu.o mt76_connac_mac.o mt76_connac3_mac.o
 
 mt792x-lib-y := mt792x_core.o mt792x_mac.o mt792x_trace.o \
-		mt792x_debugfs.o mt792x_dma.o
+		mt792x_debugfs.o mt792x_dma.o mt792x_vendor.o
 mt792x-lib-$(CONFIG_ACPI) += mt792x_acpi_sar.o
 mt792x-usb-y := mt792x_usb.o
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index a7d71e007da0..926e2cadb023 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -538,6 +538,7 @@ int mt792x_pm_stats(struct seq_file *s, void *data);
 int mt792x_pm_idle_timeout_set(void *data, u64 val);
 int mt792x_pm_idle_timeout_get(void *data, u64 *val);
 int mt792x_init_wiphy(struct ieee80211_hw *hw);
+void mt792x_vendor_register(struct ieee80211_hw *hw);
 struct ieee80211_ops *
 mt792x_get_mac80211_ops(struct device *dev,
 			const struct ieee80211_ops *mac80211_ops,
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 3ce6c6ceac81..eb50548c4d51 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -854,6 +854,8 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
 
 	hw->max_tx_fragments = 4;
 
+	mt792x_vendor_register(hw);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mt792x_init_wiphy);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
new file mode 100644
index 000000000000..d1f1560d8641
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: ISC
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#include <linux/module.h>
+#include <net/netlink.h>
+#include <net/cfg80211.h>
+
+#include "mt792x.h"
+#include "mt792x_vendor.h"
+
+static const struct nla_policy
+mtk_vendor_chip_info_policy[MTK_VENDOR_ATTR_CHIP_INFO_MAX + 1] = {
+	[MTK_VENDOR_ATTR_CHIP_INFO_ID]  = { .type = NLA_U32 },
+	[MTK_VENDOR_ATTR_CHIP_INFO_OUI] = { .type = NLA_U32 },
+};
+
+static int
+mt792x_vendor_get_chip_info(struct wiphy *wiphy, struct wireless_dev *wdev,
+			    const void *data, int data_len)
+{
+	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+	struct mt792x_phy *phy = mt792x_hw_phy(hw);
+	struct sk_buff *skb;
+
+	/* reply payload: two u32 attributes */
+	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						  2 * (nla_total_size(sizeof(u32))));
+	if (!skb)
+		return -ENOMEM;
+
+	if (nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_ID,
+			phy->dev->mt76.rev) ||
+	    nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_OUI,
+			MTK_NL80211_VENDOR_ID)) {
+		kfree_skb(skb);
+		return -ENOBUFS;
+	}
+
+	return cfg80211_vendor_cmd_reply(skb);
+}
+
+static const struct wiphy_vendor_command mt792x_vendor_commands[] = {
+	{
+		.info = {
+			.vendor_id = MTK_NL80211_VENDOR_ID,
+			.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+		},
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+			 WIPHY_VENDOR_CMD_NEED_NETDEV,
+		.doit    = mt792x_vendor_get_chip_info,
+		.policy  = mtk_vendor_chip_info_policy,
+		.maxattr = MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	},
+};
+
+static const struct nl80211_vendor_cmd_info mt792x_vendor_events[] = {
+	[MTK_NL80211_VENDOR_EVENT_CHIP_INFO] = {
+		.vendor_id = MTK_NL80211_VENDOR_ID,
+		.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+	},
+};
+
+void mt792x_vendor_register(struct ieee80211_hw *hw)
+{
+	struct wiphy *wiphy = hw->wiphy;
+
+	wiphy->vendor_commands   = mt792x_vendor_commands;
+	wiphy->n_vendor_commands = ARRAY_SIZE(mt792x_vendor_commands);
+	wiphy->vendor_events     = mt792x_vendor_events;
+	wiphy->n_vendor_events   = ARRAY_SIZE(mt792x_vendor_events);
+
+	dev_info(wiphy->dev.parent,
+		 "mt792x: registered %u vendor cmd(s), OUI=0x%06x\n",
+		 wiphy->n_vendor_commands, MTK_NL80211_VENDOR_ID);
+}
+EXPORT_SYMBOL_GPL(mt792x_vendor_register);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
new file mode 100644
index 000000000000..ab728cfd0912
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#ifndef __MT792X_VENDOR_H
+#define __MT792X_VENDOR_H
+
+/* MediaTek nl80211 vendor OUI (24-bit OUI placed in the low 24 bits).
+ * This is the value advertised to user space (e.g. wpa_supplicant's
+ * wiphy_info_handler) via NL80211_ATTR_VENDOR_DATA in the GET_WIPHY reply.
+ */
+#define MTK_NL80211_VENDOR_ID		0x000ce7
+
+/* vendor sub-commands (defined by the vendor) */
+enum mtk_nl80211_vendor_subcmds {
+	MTK_NL80211_VENDOR_SUBCMD_UNSPEC	= 0,
+	MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO	= 1,
+};
+
+/* vendor event indexes (used by cfg80211_vendor_event*) */
+enum mtk_nl80211_vendor_events {
+	MTK_NL80211_VENDOR_EVENT_CHIP_INFO	= 0,
+};
+
+/* attributes carried in the GET_CHIP_INFO vendor command reply */
+enum mtk_vendor_attr_chip_info {
+	MTK_VENDOR_ATTR_CHIP_INFO_INVALID	= 0,
+	MTK_VENDOR_ATTR_CHIP_INFO_ID		= 1,
+	MTK_VENDOR_ATTR_CHIP_INFO_OUI		= 2,
+
+	/* keep last */
+	__MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	MTK_VENDOR_ATTR_CHIP_INFO_MAX =
+		__MTK_VENDOR_ATTR_CHIP_INFO_MAX - 1,
+};
+
+#endif /* __MT792X_VENDOR_H */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-10-30  3:17 [PATCH v1] wifi: mt76: mt792x: Add MTK OUI support for wpa supplicant Eason Lai
@ 2026-11-18  1:03 ` Michael Shih
  2026-11-18  1:17   ` [PATCH v3] " Michael Shih
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Shih @ 2026-11-18  1:03 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, eason.Lai,
	Michael Shih

Customer request MTK to support OUI for wpa supplicant.

CR-Id: BORA00080136
Signed-off-by: Michael Shih <michael.shih@mediatek.com>
---
v2: Added "CONFIG_MT792x_VENDOR_CMD" for Kconfig build flag
---
 drivers/net/wireless/mediatek/mt76/Kconfig    | 12 +++
 drivers/net/wireless/mediatek/mt76/Makefile   |  1 +
 drivers/net/wireless/mediatek/mt76/mt792x.h   |  5 ++
 .../net/wireless/mediatek/mt76/mt792x_core.c  |  2 +
 .../wireless/mediatek/mt76/mt792x_vendor.c    | 76 +++++++++++++++++++
 .../wireless/mediatek/mt76/mt792x_vendor.h    | 36 +++++++++
 6 files changed, 132 insertions(+)
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.h

diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig
index a4ece38f938d..24faee348d8d 100644
--- a/drivers/net/wireless/mediatek/mt76/Kconfig
+++ b/drivers/net/wireless/mediatek/mt76/Kconfig
@@ -33,6 +33,18 @@ config MT792x_LIB
 	tristate
 	select MT76_CONNAC_LIB
 
+config MT792x_VENDOR_CMD
+	bool "MediaTek MT792x nl80211 vendor command support"
+	depends on MT792x_LIB
+	default y
+	help
+	  Advertise the MediaTek OUI (0x000CE7) nl80211 vendor command
+	  interface, allowing user space (e.g. wpa_supplicant) to query
+	  chip information. This is a read-only query interface and has no
+	  effect unless a matching vendor command is issued from user space.
+
+	  Say N to disable the interface entirely.
+
 config MT792x_USB
 	tristate
 	select MT76_USB
diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile
index cacdd2b13d05..e7e75ab66fdd 100644
--- a/drivers/net/wireless/mediatek/mt76/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/Makefile
@@ -40,6 +40,7 @@ mt76-connac-lib-y := mt76_connac_mcu.o mt76_connac_mac.o mt76_connac3_mac.o
 mt792x-lib-y := mt792x_core.o mt792x_mac.o mt792x_trace.o \
 		mt792x_debugfs.o mt792x_dma.o
 mt792x-lib-$(CONFIG_ACPI) += mt792x_acpi_sar.o
+mt792x-lib-$(CONFIG_MT792x_VENDOR_CMD) += mt792x_vendor.o
 mt792x-usb-y := mt792x_usb.o
 
 obj-$(CONFIG_MT76x0_COMMON) += mt76x0/
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 4753ec20fe0c..d0b985d7951c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -558,6 +558,11 @@ int mt792x_pm_stats(struct seq_file *s, void *data);
 int mt792x_pm_idle_timeout_set(void *data, u64 val);
 int mt792x_pm_idle_timeout_get(void *data, u64 *val);
 int mt792x_init_wiphy(struct ieee80211_hw *hw);
+#if IS_ENABLED(CONFIG_MT792x_VENDOR_CMD)
+void mt792x_vendor_register(struct ieee80211_hw *hw);
+#else
+static inline void mt792x_vendor_register(struct ieee80211_hw *hw) {}
+#endif
 struct ieee80211_ops *
 mt792x_get_mac80211_ops(struct device *dev,
 			const struct ieee80211_ops *mac80211_ops,
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 1965e9de7099..b6183b2f5db0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -876,6 +876,8 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
 
 	hw->max_tx_fragments = 4;
 
+	mt792x_vendor_register(hw);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mt792x_init_wiphy);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
new file mode 100644
index 000000000000..d1f1560d8641
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: ISC
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#include <linux/module.h>
+#include <net/netlink.h>
+#include <net/cfg80211.h>
+
+#include "mt792x.h"
+#include "mt792x_vendor.h"
+
+static const struct nla_policy
+mtk_vendor_chip_info_policy[MTK_VENDOR_ATTR_CHIP_INFO_MAX + 1] = {
+	[MTK_VENDOR_ATTR_CHIP_INFO_ID]  = { .type = NLA_U32 },
+	[MTK_VENDOR_ATTR_CHIP_INFO_OUI] = { .type = NLA_U32 },
+};
+
+static int
+mt792x_vendor_get_chip_info(struct wiphy *wiphy, struct wireless_dev *wdev,
+			    const void *data, int data_len)
+{
+	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+	struct mt792x_phy *phy = mt792x_hw_phy(hw);
+	struct sk_buff *skb;
+
+	/* reply payload: two u32 attributes */
+	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						  2 * (nla_total_size(sizeof(u32))));
+	if (!skb)
+		return -ENOMEM;
+
+	if (nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_ID,
+			phy->dev->mt76.rev) ||
+	    nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_OUI,
+			MTK_NL80211_VENDOR_ID)) {
+		kfree_skb(skb);
+		return -ENOBUFS;
+	}
+
+	return cfg80211_vendor_cmd_reply(skb);
+}
+
+static const struct wiphy_vendor_command mt792x_vendor_commands[] = {
+	{
+		.info = {
+			.vendor_id = MTK_NL80211_VENDOR_ID,
+			.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+		},
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+			 WIPHY_VENDOR_CMD_NEED_NETDEV,
+		.doit    = mt792x_vendor_get_chip_info,
+		.policy  = mtk_vendor_chip_info_policy,
+		.maxattr = MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	},
+};
+
+static const struct nl80211_vendor_cmd_info mt792x_vendor_events[] = {
+	[MTK_NL80211_VENDOR_EVENT_CHIP_INFO] = {
+		.vendor_id = MTK_NL80211_VENDOR_ID,
+		.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+	},
+};
+
+void mt792x_vendor_register(struct ieee80211_hw *hw)
+{
+	struct wiphy *wiphy = hw->wiphy;
+
+	wiphy->vendor_commands   = mt792x_vendor_commands;
+	wiphy->n_vendor_commands = ARRAY_SIZE(mt792x_vendor_commands);
+	wiphy->vendor_events     = mt792x_vendor_events;
+	wiphy->n_vendor_events   = ARRAY_SIZE(mt792x_vendor_events);
+
+	dev_info(wiphy->dev.parent,
+		 "mt792x: registered %u vendor cmd(s), OUI=0x%06x\n",
+		 wiphy->n_vendor_commands, MTK_NL80211_VENDOR_ID);
+}
+EXPORT_SYMBOL_GPL(mt792x_vendor_register);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
new file mode 100644
index 000000000000..ab728cfd0912
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#ifndef __MT792X_VENDOR_H
+#define __MT792X_VENDOR_H
+
+/* MediaTek nl80211 vendor OUI (24-bit OUI placed in the low 24 bits).
+ * This is the value advertised to user space (e.g. wpa_supplicant's
+ * wiphy_info_handler) via NL80211_ATTR_VENDOR_DATA in the GET_WIPHY reply.
+ */
+#define MTK_NL80211_VENDOR_ID		0x000ce7
+
+/* vendor sub-commands (defined by the vendor) */
+enum mtk_nl80211_vendor_subcmds {
+	MTK_NL80211_VENDOR_SUBCMD_UNSPEC	= 0,
+	MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO	= 1,
+};
+
+/* vendor event indexes (used by cfg80211_vendor_event*) */
+enum mtk_nl80211_vendor_events {
+	MTK_NL80211_VENDOR_EVENT_CHIP_INFO	= 0,
+};
+
+/* attributes carried in the GET_CHIP_INFO vendor command reply */
+enum mtk_vendor_attr_chip_info {
+	MTK_VENDOR_ATTR_CHIP_INFO_INVALID	= 0,
+	MTK_VENDOR_ATTR_CHIP_INFO_ID		= 1,
+	MTK_VENDOR_ATTR_CHIP_INFO_OUI		= 2,
+
+	/* keep last */
+	__MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	MTK_VENDOR_ATTR_CHIP_INFO_MAX =
+		__MTK_VENDOR_ATTR_CHIP_INFO_MAX - 1,
+};
+
+#endif /* __MT792X_VENDOR_H */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-11-18  1:03 ` [PATCH v2] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI) Michael Shih
@ 2026-11-18  1:17   ` Michael Shih
  2026-11-20  8:24     ` Felix Fietkau
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Shih @ 2026-11-18  1:17 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, eason.Lai,
	Michael Shih

Customer request MTK to support OUI for wpa supplicant.

Signed-off-by: Michael Shih <michael.shih@mediatek.com>
---
v2: Added "CONFIG_MT792x_VENDOR_CMD" for Kconfig build flag
v3: Fix commit message.
---
 drivers/net/wireless/mediatek/mt76/Kconfig    | 12 +++
 drivers/net/wireless/mediatek/mt76/Makefile   |  1 +
 drivers/net/wireless/mediatek/mt76/mt792x.h   |  5 ++
 .../net/wireless/mediatek/mt76/mt792x_core.c  |  2 +
 .../wireless/mediatek/mt76/mt792x_vendor.c    | 76 +++++++++++++++++++
 .../wireless/mediatek/mt76/mt792x_vendor.h    | 36 +++++++++
 6 files changed, 132 insertions(+)
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
 create mode 100644 drivers/net/wireless/mediatek/mt76/mt792x_vendor.h

diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig
index a4ece38f938d..24faee348d8d 100644
--- a/drivers/net/wireless/mediatek/mt76/Kconfig
+++ b/drivers/net/wireless/mediatek/mt76/Kconfig
@@ -33,6 +33,18 @@ config MT792x_LIB
 	tristate
 	select MT76_CONNAC_LIB
 
+config MT792x_VENDOR_CMD
+	bool "MediaTek MT792x nl80211 vendor command support"
+	depends on MT792x_LIB
+	default y
+	help
+	  Advertise the MediaTek OUI (0x000CE7) nl80211 vendor command
+	  interface, allowing user space (e.g. wpa_supplicant) to query
+	  chip information. This is a read-only query interface and has no
+	  effect unless a matching vendor command is issued from user space.
+
+	  Say N to disable the interface entirely.
+
 config MT792x_USB
 	tristate
 	select MT76_USB
diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile
index cacdd2b13d05..e7e75ab66fdd 100644
--- a/drivers/net/wireless/mediatek/mt76/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/Makefile
@@ -40,6 +40,7 @@ mt76-connac-lib-y := mt76_connac_mcu.o mt76_connac_mac.o mt76_connac3_mac.o
 mt792x-lib-y := mt792x_core.o mt792x_mac.o mt792x_trace.o \
 		mt792x_debugfs.o mt792x_dma.o
 mt792x-lib-$(CONFIG_ACPI) += mt792x_acpi_sar.o
+mt792x-lib-$(CONFIG_MT792x_VENDOR_CMD) += mt792x_vendor.o
 mt792x-usb-y := mt792x_usb.o
 
 obj-$(CONFIG_MT76x0_COMMON) += mt76x0/
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 4753ec20fe0c..d0b985d7951c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -558,6 +558,11 @@ int mt792x_pm_stats(struct seq_file *s, void *data);
 int mt792x_pm_idle_timeout_set(void *data, u64 val);
 int mt792x_pm_idle_timeout_get(void *data, u64 *val);
 int mt792x_init_wiphy(struct ieee80211_hw *hw);
+#if IS_ENABLED(CONFIG_MT792x_VENDOR_CMD)
+void mt792x_vendor_register(struct ieee80211_hw *hw);
+#else
+static inline void mt792x_vendor_register(struct ieee80211_hw *hw) {}
+#endif
 struct ieee80211_ops *
 mt792x_get_mac80211_ops(struct device *dev,
 			const struct ieee80211_ops *mac80211_ops,
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 1965e9de7099..b6183b2f5db0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -876,6 +876,8 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
 
 	hw->max_tx_fragments = 4;
 
+	mt792x_vendor_register(hw);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mt792x_init_wiphy);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
new file mode 100644
index 000000000000..d1f1560d8641
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: ISC
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#include <linux/module.h>
+#include <net/netlink.h>
+#include <net/cfg80211.h>
+
+#include "mt792x.h"
+#include "mt792x_vendor.h"
+
+static const struct nla_policy
+mtk_vendor_chip_info_policy[MTK_VENDOR_ATTR_CHIP_INFO_MAX + 1] = {
+	[MTK_VENDOR_ATTR_CHIP_INFO_ID]  = { .type = NLA_U32 },
+	[MTK_VENDOR_ATTR_CHIP_INFO_OUI] = { .type = NLA_U32 },
+};
+
+static int
+mt792x_vendor_get_chip_info(struct wiphy *wiphy, struct wireless_dev *wdev,
+			    const void *data, int data_len)
+{
+	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+	struct mt792x_phy *phy = mt792x_hw_phy(hw);
+	struct sk_buff *skb;
+
+	/* reply payload: two u32 attributes */
+	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						  2 * (nla_total_size(sizeof(u32))));
+	if (!skb)
+		return -ENOMEM;
+
+	if (nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_ID,
+			phy->dev->mt76.rev) ||
+	    nla_put_u32(skb, MTK_VENDOR_ATTR_CHIP_INFO_OUI,
+			MTK_NL80211_VENDOR_ID)) {
+		kfree_skb(skb);
+		return -ENOBUFS;
+	}
+
+	return cfg80211_vendor_cmd_reply(skb);
+}
+
+static const struct wiphy_vendor_command mt792x_vendor_commands[] = {
+	{
+		.info = {
+			.vendor_id = MTK_NL80211_VENDOR_ID,
+			.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+		},
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+			 WIPHY_VENDOR_CMD_NEED_NETDEV,
+		.doit    = mt792x_vendor_get_chip_info,
+		.policy  = mtk_vendor_chip_info_policy,
+		.maxattr = MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	},
+};
+
+static const struct nl80211_vendor_cmd_info mt792x_vendor_events[] = {
+	[MTK_NL80211_VENDOR_EVENT_CHIP_INFO] = {
+		.vendor_id = MTK_NL80211_VENDOR_ID,
+		.subcmd    = MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO,
+	},
+};
+
+void mt792x_vendor_register(struct ieee80211_hw *hw)
+{
+	struct wiphy *wiphy = hw->wiphy;
+
+	wiphy->vendor_commands   = mt792x_vendor_commands;
+	wiphy->n_vendor_commands = ARRAY_SIZE(mt792x_vendor_commands);
+	wiphy->vendor_events     = mt792x_vendor_events;
+	wiphy->n_vendor_events   = ARRAY_SIZE(mt792x_vendor_events);
+
+	dev_info(wiphy->dev.parent,
+		 "mt792x: registered %u vendor cmd(s), OUI=0x%06x\n",
+		 wiphy->n_vendor_commands, MTK_NL80211_VENDOR_ID);
+}
+EXPORT_SYMBOL_GPL(mt792x_vendor_register);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
new file mode 100644
index 000000000000..ab728cfd0912
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_vendor.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: ISC */
+/* Copyright (C) 2026 MediaTek Inc. */
+
+#ifndef __MT792X_VENDOR_H
+#define __MT792X_VENDOR_H
+
+/* MediaTek nl80211 vendor OUI (24-bit OUI placed in the low 24 bits).
+ * This is the value advertised to user space (e.g. wpa_supplicant's
+ * wiphy_info_handler) via NL80211_ATTR_VENDOR_DATA in the GET_WIPHY reply.
+ */
+#define MTK_NL80211_VENDOR_ID		0x000ce7
+
+/* vendor sub-commands (defined by the vendor) */
+enum mtk_nl80211_vendor_subcmds {
+	MTK_NL80211_VENDOR_SUBCMD_UNSPEC	= 0,
+	MTK_NL80211_VENDOR_SUBCMD_GET_CHIP_INFO	= 1,
+};
+
+/* vendor event indexes (used by cfg80211_vendor_event*) */
+enum mtk_nl80211_vendor_events {
+	MTK_NL80211_VENDOR_EVENT_CHIP_INFO	= 0,
+};
+
+/* attributes carried in the GET_CHIP_INFO vendor command reply */
+enum mtk_vendor_attr_chip_info {
+	MTK_VENDOR_ATTR_CHIP_INFO_INVALID	= 0,
+	MTK_VENDOR_ATTR_CHIP_INFO_ID		= 1,
+	MTK_VENDOR_ATTR_CHIP_INFO_OUI		= 2,
+
+	/* keep last */
+	__MTK_VENDOR_ATTR_CHIP_INFO_MAX,
+	MTK_VENDOR_ATTR_CHIP_INFO_MAX =
+		__MTK_VENDOR_ATTR_CHIP_INFO_MAX - 1,
+};
+
+#endif /* __MT792X_VENDOR_H */
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-11-18  1:17   ` [PATCH v3] " Michael Shih
@ 2026-11-20  8:24     ` Felix Fietkau
  2026-11-22 23:49       ` Michael Shih (史君仲)
  0 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2026-11-20  8:24 UTC (permalink / raw)
  To: Michael Shih, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, eason.Lai

Hi,

On 18.11.26 02:17, Michael Shih wrote:
> Customer request MTK to support OUI for wpa supplicant.
> 
> Signed-off-by: Michael Shih <michael.shih@mediatek.com>
What is this supposed to be used for?

Thanks,

- Felix

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-11-20  8:24     ` Felix Fietkau
@ 2026-11-22 23:49       ` Michael Shih (史君仲)
  2026-11-23  8:46         ` Felix Fietkau
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Shih (史君仲) @ 2026-11-22 23:49 UTC (permalink / raw)
  To: nbd@nbd.name, lorenzo@kernel.org
  Cc: Eason Lai (賴易聖),
	Kun Wu (吳謹至), Ryder Lee,
	Quan Zhou (周全), Deren Wu (武德仁),
	Litien Chang (張立典),
	linux-wireless@vger.kernel.org, Sean Wang,
	Leon Yen (顏良儒),
	linux-mediatek@lists.infradead.org,
	JB Tsai (蔡志彬)

Hi Felix,
This is a driver patch that supports advertising MediaTek OUI vendor
command in the mt76 driver for WPA supplicant. 
This support feature will only be triggered intentionally.

Therefore, I have added build flag in Kconfig so that it will not be
enabled in upstream if not required, it is supposed to be used in
Android platforms.

I hope this will clarify your question.

Thanks,
Michael.

> Hi,
> 
> On 18.11.26 02:17, Michael Shih wrote:
> > Customer request MTK to support OUI for wpa supplicant.
> > 
> > Signed-off-by: Michael Shih <michael.shih@mediatek.com>
> What is this supposed to be used for?
> 
> Thanks,
> 
> - Felix


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-11-22 23:49       ` Michael Shih (史君仲)
@ 2026-11-23  8:46         ` Felix Fietkau
  2026-11-23 23:41           ` Michael Shih (史君仲)
  0 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2026-11-23  8:46 UTC (permalink / raw)
  To: Michael Shih (史君仲), lorenzo@kernel.org
  Cc: Eason Lai (賴易聖),
	Kun Wu (吳謹至), Ryder Lee,
	Quan Zhou (周全), Deren Wu (武德仁),
	Litien Chang (張立典),
	linux-wireless@vger.kernel.org, Sean Wang,
	Leon Yen (顏良儒),
	linux-mediatek@lists.infradead.org,
	JB Tsai (蔡志彬)

Hi Michael,

What functionality sits behind this call, and is it something that might 
be worth implementing through a proper nl80211 API?

Thanks,

- Felix

On 23.11.26 00:49, Michael Shih (史君仲) wrote:
> Hi Felix,
> This is a driver patch that supports advertising MediaTek OUI vendor
> command in the mt76 driver for WPA supplicant.
> This support feature will only be triggered intentionally.
> 
> Therefore, I have added build flag in Kconfig so that it will not be
> enabled in upstream if not required, it is supposed to be used in
> Android platforms.
> 
> I hope this will clarify your question.
> 
> Thanks,
> Michael.
> 
>> Hi,
>> 
>> On 18.11.26 02:17, Michael Shih wrote:
>> > Customer request MTK to support OUI for wpa supplicant.
>> > 
>> > Signed-off-by: Michael Shih <michael.shih@mediatek.com>
>> What is this supposed to be used for?
>> 
>> Thanks,
>> 
>> - Felix


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI)
  2026-11-23  8:46         ` Felix Fietkau
@ 2026-11-23 23:41           ` Michael Shih (史君仲)
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Shih (史君仲) @ 2026-11-23 23:41 UTC (permalink / raw)
  To: nbd@nbd.name, lorenzo@kernel.org
  Cc: Eason Lai (賴易聖),
	Kun Wu (吳謹至), Ryder Lee,
	Quan Zhou (周全), Deren Wu (武德仁),
	Litien Chang (張立典),
	linux-wireless@vger.kernel.org, Sean Wang,
	Leon Yen (顏良儒),
	linux-mediatek@lists.infradead.org,
	JB Tsai (蔡志彬)

Hi Felix,

Thanks for the review.

The handler itself is minimal (returns chip revision and the MTK OUI),
but the point of this patch isn't the sub-command — it's to advertise
the MTK OUI on the wiphy so that wpa_supplicant (and other user space)
can detect an MTK driver via the standard NL80211_ATTR_VENDOR_DATA
list, the same way it already does for QCA, Broadcom and Intel in
driver_nl80211_capa.c.

There is no standard nl80211 attribute that serves this bootstrap role
— vendor-command OUI discovery is the mechanism cfg80211 provides for
it, and mac80211_hwsim, brcmfmac and iwlwifi/mvm all follow the same
pattern in-tree. This patch simply establishes the same entry point for
MTK drivers.

Best regards,
Michael.


> Hi Michael,
> 
> What functionality sits behind this call, and is it something that
> might 
> be worth implementing through a proper nl80211 API?
> 
> Thanks,
> 
> - Felix
> 
> On 23.11.26 00:49, Michael Shih (史君仲) wrote:
> > Hi Felix,
> > This is a driver patch that supports advertising MediaTek OUI
> > vendor
> > command in the mt76 driver for WPA supplicant.
> > This support feature will only be triggered intentionally.
> > 
> > Therefore, I have added build flag in Kconfig so that it will not
> > be
> > enabled in upstream if not required, it is supposed to be used in
> > Android platforms.
> > 
> > I hope this will clarify your question.
> > 
> > Thanks,
> > Michael.
> > 
> > > Hi,
> > > 
> > > On 18.11.26 02:17, Michael Shih wrote:
> > > > Customer request MTK to support OUI for wpa supplicant.
> > > > 
> > > > Signed-off-by: Michael Shih <michael.shih@mediatek.com>
> > > What is this supposed to be used for?
> > > 
> > > Thanks,
> > > 
> > > - Felix
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-23 23:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30  3:17 [PATCH v1] wifi: mt76: mt792x: Add MTK OUI support for wpa supplicant Eason Lai
2026-11-18  1:03 ` [PATCH v2] wifi: mt76: mt7928: Add MTK OUI support for nl80211 (ALOS support for wpa_supplicant to get MTK OUI) Michael Shih
2026-11-18  1:17   ` [PATCH v3] " Michael Shih
2026-11-20  8:24     ` Felix Fietkau
2026-11-22 23:49       ` Michael Shih (史君仲)
2026-11-23  8:46         ` Felix Fietkau
2026-11-23 23:41           ` Michael Shih (史君仲)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox