blob: e3332718b42b05d1a42e693f447bffa4c25a6955 [file] [log] [blame]
developer6e3b5d12022-08-16 15:37:38 +08001From 2bfc2727beaeebe4c475f27e65a22522a47e5ec0 Mon Sep 17 00:00:00 2001
2From: TomLiu <tomml.liu@mediatek.com>
3Date: Thu, 11 Aug 2022 18:09:45 -0700
4Subject: [PATCH] mt76: HEMU: Add dump support
5
6Change-Id: I521214f3feb6f0d528a9f550255050ffd1ec96d2
7---
8 mt7915/vendor.c | 26 ++++++++++++++++++++++++++
9 mt7915/vendor.h | 1 +
10 2 files changed, 27 insertions(+)
11
12diff --git a/mt7915/vendor.c b/mt7915/vendor.c
13index 5a28a55..7acb330 100644
14--- 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
18 hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
19 [MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF] = {.type = NLA_U8 },
20+ [MTK_VENDOR_ATTR_HEMU_CTRL_DUMP] = {.type = NLA_U8 },
21 };
22
23 static const struct nla_policy
24@@ -997,6 +998,30 @@ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy,
25 return 0;
26 }
27
28+
29+static int
30+mt7915_vendor_hemu_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
31+ 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);
36+ struct mt7915_dev *dev = phy->dev;
37+ void *a;
38+ int len = 0;
39+
40+ if (*storage == 1)
41+ return -ENOENT;
42+ *storage = 1;
43+
44+ if (nla_put_u8(skb, MTK_VENDOR_ATTR_HEMU_CTRL_DUMP, dev->dbg.muru_onoff))
45+ return -ENOMEM;
46+ len += 1;
47+
48+ return len;
49+}
50+
51+
52 static int
53 mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
54 struct sk_buff *skb, const void *data, int data_len,
55@@ -1122,6 +1147,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
56 .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
57 WIPHY_VENDOR_CMD_NEED_RUNNING,
58 .doit = mt7915_vendor_hemu_ctrl,
59+ .dumpit = mt7915_vendor_hemu_ctrl_dump,
60 .policy = hemu_ctrl_policy,
61 .maxattr = MTK_VENDOR_ATTR_HEMU_CTRL_MAX,
62 },
63diff --git a/mt7915/vendor.h b/mt7915/vendor.h
64index 83c41bc..57f52f3 100644
65--- a/mt7915/vendor.h
66+++ b/mt7915/vendor.h
67@@ -58,6 +58,7 @@ enum mtk_vendor_attr_hemu_ctrl {
68 MTK_VENDOR_ATTR_HEMU_CTRL_UNSPEC,
69
70 MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF,
71+ MTK_VENDOR_ATTR_HEMU_CTRL_DUMP,
72
73 /* keep last */
74 NUM_MTK_VENDOR_ATTRS_HEMU_CTRL,
75--
762.32.0
77