blob: f373601a61c12ef145e38679fc5f427bfc385e5d [file] [log] [blame]
developerbbd45e12023-05-19 08:22:06 +08001From 5b4357f01aa42091e84846490bbb453e97e2cf40 Mon Sep 17 00:00:00 2001
developere9954402022-07-12 10:15:11 -07002From: Yi-Chia Hsieh <Yi-Chia.Hsieh@mediatek.com>
3Date: Tue, 12 Jul 2022 10:04:35 -0700
developerbbd45e12023-05-19 08:22:06 +08004Subject: [PATCH 1018/1033] wifi: mt76: mt7915: add phy capability vendor
developerc9233442023-04-04 06:06:17 +08005 command
developere9954402022-07-12 10:15:11 -07006
7---
developer071927d2022-08-31 20:39:29 +08008 mt7915/mt7915.h | 1 +
9 mt7915/vendor.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
10 mt7915/vendor.h | 25 ++++++++++++++++++++++++
developere9954402022-07-12 10:15:11 -070011 3 files changed, 78 insertions(+)
12
13diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developerbbd45e12023-05-19 08:22:06 +080014index 3bfd611..fdedacf 100644
developere9954402022-07-12 10:15:11 -070015--- a/mt7915/mt7915.h
16+++ b/mt7915/mt7915.h
17@@ -11,6 +11,7 @@
18
19 #define MTK_DEBUG 1
20 #define MT7915_MAX_INTERFACES 19
21+#define MT7915_MAX_BSS 16
22 #define MT7915_WTBL_SIZE 288
23 #define MT7916_WTBL_SIZE 544
24 #define MT7915_WTBL_RESERVED (mt7915_wtbl_size(dev) - 1)
25diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developerbbd45e12023-05-19 08:22:06 +080026index df1cac3..3dbbd32 100644
developere9954402022-07-12 10:15:11 -070027--- a/mt7915/vendor.c
28+++ b/mt7915/vendor.c
29@@ -50,6 +50,18 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
developer60384cf2022-06-21 10:26:31 -070030 [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF] = { .type = NLA_U8 },
31 };
32
33+static const struct nla_policy
34+phy_capa_ctrl_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL] = {
35+ [MTK_VENDOR_ATTR_PHY_CAPA_CTRL_SET] = { .type = NLA_NESTED },
36+ [MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP] = { .type = NLA_NESTED },
37+};
38+
39+static const struct nla_policy
40+phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
41+ [MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS] = { .type = NLA_U16 },
42+ [MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA] = { .type = NLA_U16 },
43+};
44+
45 struct csi_null_tone {
46 u8 start;
47 u8 end;
developerbbd45e12023-05-19 08:22:06 +080048@@ -976,6 +988,35 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
developer60384cf2022-06-21 10:26:31 -070049 return 0;
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+ unsigned long *storage)
56+{
57+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
58+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
59+ struct mt7915_dev *dev = phy->dev;
60+ void *a;
61+ int len = 0;
62+
63+ if (*storage == 1)
64+ return -ENOENT;
65+ *storage = 1;
66+
67+ a = nla_nest_start(skb, MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP);
68+
69+ if (nla_put_u16(skb,
70+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS, MT7915_MAX_BSS) ||
71+ nla_put_u16(skb,
72+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA, MT7915_WTBL_STA))
73+ return -ENOMEM;
74+ len += 2;
75+
76+ nla_nest_end(skb, a);
77+
78+ return len;
79+}
80+
81 static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
82 {
83 .info = {
developerbbd45e12023-05-19 08:22:06 +080084@@ -1033,6 +1074,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developer57de9b72023-02-20 11:15:54 +080085 .doit = mt7915_vendor_mu_ctrl,
86 .policy = mu_ctrl_policy,
87 .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX,
developer60384cf2022-06-21 10:26:31 -070088+ },
89+ {
90+ .info = {
91+ .vendor_id = MTK_NL80211_VENDOR_ID,
92+ .subcmd = MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL,
93+ },
94+ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
95+ WIPHY_VENDOR_CMD_NEED_RUNNING,
96+ .dumpit = mt7915_vendor_phy_capa_ctrl_dump,
97+ .policy = phy_capa_ctrl_policy,
98+ .maxattr = MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX,
99 }
100 };
101
developere9954402022-07-12 10:15:11 -0700102diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developer1d9da7d2023-04-15 12:45:34 +0800103index 2be5fc8..ffdb466 100644
developere9954402022-07-12 10:15:11 -0700104--- a/mt7915/vendor.h
105+++ b/mt7915/vendor.h
developer60384cf2022-06-21 10:26:31 -0700106@@ -9,6 +9,7 @@ enum mtk_nl80211_vendor_subcmds {
107 MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3,
108 MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4,
developer57de9b72023-02-20 11:15:54 +0800109 MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5,
developer60384cf2022-06-21 10:26:31 -0700110+ MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
111 };
112
113 enum mtk_capi_control_changed {
114@@ -149,4 +150,28 @@ enum mtk_vendor_attr_mnt_dump {
115 NUM_MTK_VENDOR_ATTRS_AMNT_DUMP - 1
116 };
117
118+enum mtk_vendor_attr_phy_capa_ctrl {
119+ MTK_VENDOR_ATTR_PHY_CAPA_CTRL_UNSPEC,
120+
121+ MTK_VENDOR_ATTR_PHY_CAPA_CTRL_SET,
122+ MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP,
123+
124+ /* keep last */
125+ NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL,
126+ MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX =
127+ NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL - 1
128+};
129+
130+enum mtk_vendor_attr_phy_capa_dump {
131+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_UNSPEC,
132+
133+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS,
134+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA,
135+
136+ /* keep last */
137+ NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP,
138+ MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX =
139+ NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1
140+};
141+
142 #endif
developere9954402022-07-12 10:15:11 -0700143--
developer2324aa22023-04-12 11:30:15 +08001442.18.0
developere9954402022-07-12 10:15:11 -0700145