blob: 05cab8b5dbd468386f2e4b7de681cc01519cc44e [file] [log] [blame]
developerc634bb12023-05-02 17:31:30 +08001From 945359050d7ed6bc288a187a22f39351985c9007 Mon Sep 17 00:00:00 2001
2From: MeiChia Chiu <meichia.chiu@mediatek.com>
3Date: Thu, 27 Apr 2023 15:37:33 +0800
4Subject: [PATCH] wifi: mt76: mt7915: add muru user number debug
5 command
6
7---
8 mt7915/mt7915.h | 1 +
9 mt7915/vendor.c | 15 ++++++++++++++-
10 mt7915/vendor.h | 2 ++
11 3 files changed, 17 insertions(+), 1 deletion(-)
12
13diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
14index 2e5295b..f9922f9 100644
15--- a/mt7915/mt7915.h
16+++ b/mt7915/mt7915.h
17@@ -644,6 +644,7 @@ int mt7915_mcu_set_pulse_th(struct mt7915_dev *dev,
18 int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index,
19 const struct mt7915_dfs_pattern *pattern);
20 int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u32 val);
21+int mt7915_set_muru_cfg(struct mt7915_phy *phy, u8 mode, u8 val);
22 int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev);
23 int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
24 int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch);
25diff --git a/mt7915/vendor.c b/mt7915/vendor.c
26index af60880..a2f3f45 100644
27--- a/mt7915/vendor.c
28+++ b/mt7915/vendor.c
29@@ -45,6 +45,8 @@ static const struct nla_policy
30 mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
31 [MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
32 [MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
33+ [MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE] = { .type = NLA_U8 },
34+ [MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL] { .type = NLA_U8 },
35 };
36
37 static const struct nla_policy
38@@ -1035,9 +1037,10 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
39 int data_len)
40 {
41 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
42+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
43 struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_MU_CTRL];
44 int err;
45- u8 val8;
46+ u8 val8, mode;
47 u32 val32 = 0;
48
49 err = nla_parse(tb, MTK_VENDOR_ATTR_MU_CTRL_MAX, data, data_len,
50@@ -1051,6 +1054,16 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
51 FIELD_PREP(RATE_CFG_VAL, val8);
52 ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
53 mt7915_set_wireless_vif, &val32);
54+ } else if (tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE]) {
55+ mode = nla_get_u8(tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE]);
56+
57+ if (!tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL])
58+ return -EINVAL;
59+
60+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL]);
61+ err = mt7915_set_muru_cfg(phy, mode, val8);
62+ if (err)
63+ return err;
64 }
65
66 return 0;
67diff --git a/mt7915/vendor.h b/mt7915/vendor.h
68index 358a16f..20526ea 100644
69--- a/mt7915/vendor.h
70+++ b/mt7915/vendor.h
71@@ -102,6 +102,8 @@ enum mtk_vendor_attr_mu_ctrl {
72
73 MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
74 MTK_VENDOR_ATTR_MU_CTRL_DUMP,
75+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE,
76+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL,
77
78 /* keep last */
79 NUM_MTK_VENDOR_ATTRS_MU_CTRL,
80--
812.39.0
82