blob: 013b88fff91968de061e742c3a4248a446161f7d [file] [log] [blame]
developere35b8e42023-10-16 11:04:00 +08001From ffa6ac27f043615593e71b38734e47521cb066c0 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
developere35b8e42023-10-16 11:04:00 +08004Subject: [PATCH 1020/1040] 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
developere35b8e42023-10-16 11:04:00 +080013index afba18e..0c0b47e 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
developerad9333b2023-05-22 15:16:16 +080024@@ -1006,6 +1007,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,
developerad9333b2023-05-22 15:16:16 +080053@@ -1192,6 +1215,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
developere35b8e42023-10-16 11:04:00 +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--
developere35b8e42023-10-16 11:04:00 +0800742.18.0
developer6a1998b2022-12-08 18:09:45 +080075