blob: 8e1378e94c0621b358200bc6d5950cb3e658a942 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 0623b3b87fe33c6ad8037aa01cf63b2a1ab2274f Mon Sep 17 00:00:00 2001
developere2cfb522022-12-08 18:09:45 +08002From: TomLiu <tomml.liu@mediatek.com>
3Date: Thu, 11 Aug 2022 18:09:45 -0700
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 1017/1052] wifi: mt76: mt7915: Add mu dump support
developere2cfb522022-12-08 18:09:45 +08005
developere2cfb522022-12-08 18:09:45 +08006---
developer4d581862023-02-13 16:01:56 +08007 mt7915/vendor.c | 24 ++++++++++++++++++++++++
developere2cfb522022-12-08 18:09:45 +08008 mt7915/vendor.h | 1 +
developer4d581862023-02-13 16:01:56 +08009 2 files changed, 25 insertions(+)
developere2cfb522022-12-08 18:09:45 +080010
11diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developer05f3b2b2024-08-19 19:17:34 +080012index aaa0cf1d..eb0b380d 100644
developere2cfb522022-12-08 18:09:45 +080013--- a/mt7915/vendor.c
14+++ b/mt7915/vendor.c
developer05f3b2b2024-08-19 19:17:34 +080015@@ -39,6 +39,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
developere2cfb522022-12-08 18:09:45 +080016 static const struct nla_policy
developer2c78ce72023-02-24 11:26:12 +080017 mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
18 [MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
19+ [MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
developere2cfb522022-12-08 18:09:45 +080020 };
21
22 static const struct nla_policy
developer05f3b2b2024-08-19 19:17:34 +080023@@ -1161,6 +1162,28 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
developere2cfb522022-12-08 18:09:45 +080024 return 0;
25 }
26
27+
28+static int
developer2c78ce72023-02-24 11:26:12 +080029+mt7915_vendor_mu_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
developere2cfb522022-12-08 18:09:45 +080030+ struct sk_buff *skb, const void *data, int data_len,
31+ unsigned long *storage)
32+{
33+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
34+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
developere2cfb522022-12-08 18:09:45 +080035+ int len = 0;
36+
37+ if (*storage == 1)
38+ return -ENOENT;
39+ *storage = 1;
40+
developer2c78ce72023-02-24 11:26:12 +080041+ if (nla_put_u8(skb, MTK_VENDOR_ATTR_MU_CTRL_DUMP, phy->muru_onoff))
developere2cfb522022-12-08 18:09:45 +080042+ return -ENOMEM;
43+ len += 1;
44+
45+ return len;
46+}
47+
48+
49 static int
50 mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
51 struct sk_buff *skb, const void *data, int data_len,
developer05f3b2b2024-08-19 19:17:34 +080052@@ -1347,6 +1370,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developere2cfb522022-12-08 18:09:45 +080053 .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
54 WIPHY_VENDOR_CMD_NEED_RUNNING,
developer2c78ce72023-02-24 11:26:12 +080055 .doit = mt7915_vendor_mu_ctrl,
56+ .dumpit = mt7915_vendor_mu_ctrl_dump,
57 .policy = mu_ctrl_policy,
58 .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX,
developere2cfb522022-12-08 18:09:45 +080059 },
60diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developer05f3b2b2024-08-19 19:17:34 +080061index c8d30b52..c61ba260 100644
developere2cfb522022-12-08 18:09:45 +080062--- a/mt7915/vendor.h
63+++ b/mt7915/vendor.h
developer753619c2024-02-22 13:42:45 +080064@@ -73,6 +73,7 @@ enum mtk_vendor_attr_mu_ctrl {
developer2c78ce72023-02-24 11:26:12 +080065 MTK_VENDOR_ATTR_MU_CTRL_UNSPEC,
developere2cfb522022-12-08 18:09:45 +080066
developer2c78ce72023-02-24 11:26:12 +080067 MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
68+ MTK_VENDOR_ATTR_MU_CTRL_DUMP,
developere2cfb522022-12-08 18:09:45 +080069
70 /* keep last */
developer2c78ce72023-02-24 11:26:12 +080071 NUM_MTK_VENDOR_ATTRS_MU_CTRL,
developere2cfb522022-12-08 18:09:45 +080072--
developerbd9fa1e2023-10-16 11:04:00 +0800732.18.0
developere2cfb522022-12-08 18:09:45 +080074