blob: 973176814a96d44ada8a25c9759494671a4f88cb [file] [log] [blame]
developera43cc482023-04-17 15:57:28 +08001From bddd3537739bd46e25e17ae6d365c836a65c9223 Mon Sep 17 00:00:00 2001
developer6a1998b2022-12-08 18:09:45 +08002From: TomLiu <tomml.liu@mediatek.com>
3Date: Thu, 11 Aug 2022 18:09:45 -0700
developera43cc482023-04-17 15:57:28 +08004Subject: [PATCH 1022/1032] wifi: mt76: mt7915: Add mu dump support
developer6a1998b2022-12-08 18:09:45 +08005
6Change-Id: I521214f3feb6f0d528a9f550255050ffd1ec96d2
7---
developer5eddc512023-02-13 16:01:56 +08008 mt7915/vendor.c | 24 ++++++++++++++++++++++++
developer6a1998b2022-12-08 18:09:45 +08009 mt7915/vendor.h | 1 +
developer5eddc512023-02-13 16:01:56 +080010 2 files changed, 25 insertions(+)
developer6a1998b2022-12-08 18:09:45 +080011
12diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developera43cc482023-04-17 15:57:28 +080013index e748ab1..6915ac8 100644
developer6a1998b2022-12-08 18:09:45 +080014--- a/mt7915/vendor.c
15+++ b/mt7915/vendor.c
16@@ -37,6 +37,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
17 static const struct nla_policy
developere0a1e0e2023-02-24 11:26:12 +080018 mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
19 [MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
20+ [MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
developer6a1998b2022-12-08 18:09:45 +080021 };
22
23 static const struct nla_policy
developere0a1e0e2023-02-24 11:26:12 +080024@@ -1004,6 +1005,28 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
developer6a1998b2022-12-08 18:09:45 +080025 return 0;
26 }
27
28+
29+static int
developere0a1e0e2023-02-24 11:26:12 +080030+mt7915_vendor_mu_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
developer6a1998b2022-12-08 18:09:45 +080031+ struct sk_buff *skb, const void *data, int data_len,
32+ unsigned long *storage)
33+{
34+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
35+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
developer6a1998b2022-12-08 18:09:45 +080036+ int len = 0;
37+
38+ if (*storage == 1)
39+ return -ENOENT;
40+ *storage = 1;
41+
developere0a1e0e2023-02-24 11:26:12 +080042+ if (nla_put_u8(skb, MTK_VENDOR_ATTR_MU_CTRL_DUMP, phy->muru_onoff))
developer6a1998b2022-12-08 18:09:45 +080043+ return -ENOMEM;
44+ len += 1;
45+
46+ return len;
47+}
48+
49+
50 static int
51 mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
52 struct sk_buff *skb, const void *data, int data_len,
developer5eddc512023-02-13 16:01:56 +080053@@ -1190,6 +1213,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developer6a1998b2022-12-08 18:09:45 +080054 .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
55 WIPHY_VENDOR_CMD_NEED_RUNNING,
developere0a1e0e2023-02-24 11:26:12 +080056 .doit = mt7915_vendor_mu_ctrl,
57+ .dumpit = mt7915_vendor_mu_ctrl_dump,
58 .policy = mu_ctrl_policy,
59 .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX,
developer6a1998b2022-12-08 18:09:45 +080060 },
61diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developera43cc482023-04-17 15:57:28 +080062index 0c96377..d8e23d3 100644
developer6a1998b2022-12-08 18:09:45 +080063--- a/mt7915/vendor.h
64+++ b/mt7915/vendor.h
developere0a1e0e2023-02-24 11:26:12 +080065@@ -72,6 +72,7 @@ enum mtk_vendor_attr_mu_ctrl {
66 MTK_VENDOR_ATTR_MU_CTRL_UNSPEC,
developer6a1998b2022-12-08 18:09:45 +080067
developere0a1e0e2023-02-24 11:26:12 +080068 MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
69+ MTK_VENDOR_ATTR_MU_CTRL_DUMP,
developer6a1998b2022-12-08 18:09:45 +080070
71 /* keep last */
developere0a1e0e2023-02-24 11:26:12 +080072 NUM_MTK_VENDOR_ATTRS_MU_CTRL,
developer6a1998b2022-12-08 18:09:45 +080073--
developera43cc482023-04-17 15:57:28 +0800742.18.0
developer6a1998b2022-12-08 18:09:45 +080075