blob: 0585a08e381f597a4bdae888d16d6debf3eb737f [file] [log] [blame]
developer753619c2024-02-22 13:42:45 +08001From a7ddef79ef2ae20ebb5a590cf7f5b33a4a0c6096 Mon Sep 17 00:00:00 2001
developerbb6ddff2023-03-08 17:22:32 +08002From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
3Date: Thu, 26 Jan 2023 08:50:47 +0800
developer753619c2024-02-22 13:42:45 +08004Subject: [PATCH 1028/1048] wifi: mt76: mt7915: add vendor cmd to get available
developerda18a742023-04-06 13:44:00 +08005 color bitmap
developerbb6ddff2023-03-08 17:22:32 +08006
7Add a vendor cmd to notify user space available color bitmap.
8The OBSS BSS color bitmap is maintained in mac80211, so mt76 will make use of that.
9
10Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
11---
12 mt7915/vendor.c | 37 +++++++++++++++++++++++++++++++++++++
13 mt7915/vendor.h | 11 +++++++++++
14 2 files changed, 48 insertions(+)
15
16diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developer753619c2024-02-22 13:42:45 +080017index 8370216..9a26f7f 100644
developerbb6ddff2023-03-08 17:22:32 +080018--- a/mt7915/vendor.c
19+++ b/mt7915/vendor.c
developer753619c2024-02-22 13:42:45 +080020@@ -99,6 +99,11 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = {
developerbb6ddff2023-03-08 17:22:32 +080021 [MTK_VENDOR_ATTR_IBF_CTRL_ENABLE] = { .type = NLA_U8 },
22 };
23
24+static struct nla_policy
25+bss_color_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL] = {
26+ [MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP] = { .type = NLA_U64 },
27+};
28+
29 struct csi_null_tone {
30 u8 start;
31 u8 end;
developer753619c2024-02-22 13:42:45 +080032@@ -1295,6 +1300,27 @@ mt7915_vendor_ibf_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
developerbb6ddff2023-03-08 17:22:32 +080033 return 1;
34 }
35
36+static int
37+mt7915_vendor_bss_color_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
38+ struct sk_buff *skb, const void *data, int data_len,
39+ unsigned long *storage)
40+{
41+ struct ieee80211_vif *vif = wdev_to_ieee80211_vif(wdev);
42+ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
43+ int len = 0;
44+
45+ if (*storage == 1)
46+ return -ENOENT;
47+ *storage = 1;
48+
49+ if (nla_put_u64_64bit(skb,
50+ MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP,
developer7a520b52023-03-14 14:09:34 +080051+ ~bss_conf->used_color_bitmap, NL80211_ATTR_PAD))
developerbb6ddff2023-03-08 17:22:32 +080052+ return -ENOMEM;
53+ len += 1;
54+
55+ return len;
56+}
57
58 static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
59 {
developer753619c2024-02-22 13:42:45 +080060@@ -1401,6 +1427,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developerbb6ddff2023-03-08 17:22:32 +080061 .dumpit = mt7915_vendor_ibf_ctrl_dump,
62 .policy = ibf_ctrl_policy,
63 .maxattr = MTK_VENDOR_ATTR_IBF_CTRL_MAX,
64+ },
65+ {
66+ .info = {
67+ .vendor_id = MTK_NL80211_VENDOR_ID,
68+ .subcmd = MTK_NL80211_VENDOR_SUBCMD_BSS_COLOR_CTRL,
69+ },
70+ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
71+ WIPHY_VENDOR_CMD_NEED_RUNNING,
72+ .dumpit = mt7915_vendor_bss_color_ctrl_dump,
73+ .policy = bss_color_ctrl_policy,
74+ .maxattr = MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX,
75 }
76 };
77
78diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developer753619c2024-02-22 13:42:45 +080079index 3672420..bd1c617 100644
developerbb6ddff2023-03-08 17:22:32 +080080--- a/mt7915/vendor.h
81+++ b/mt7915/vendor.h
developer753619c2024-02-22 13:42:45 +080082@@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds {
developerbb6ddff2023-03-08 17:22:32 +080083 MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
84 MTK_NL80211_VENDOR_SUBCMD_3WIRE_CTRL = 0xc8,
85 MTK_NL80211_VENDOR_SUBCMD_IBF_CTRL = 0xc9,
86+ MTK_NL80211_VENDOR_SUBCMD_BSS_COLOR_CTRL = 0xca,
87 };
88
89
developer753619c2024-02-22 13:42:45 +080090@@ -261,4 +262,14 @@ enum mtk_vendor_attr_ibf_dump {
developerbb6ddff2023-03-08 17:22:32 +080091 NUM_MTK_VENDOR_ATTRS_IBF_DUMP - 1
92 };
93
94+enum mtk_vendor_attr_bss_color_ctrl {
95+ MTK_VENDOR_ATTR_BSS_COLOR_CTRL_UNSPEC,
96+
97+ MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP,
98+
99+ /* keep last */
100+ NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL,
101+ MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX =
102+ NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL - 1
103+};
104 #endif
105--
developerbd9fa1e2023-10-16 11:04:00 +08001062.18.0
developerbb6ddff2023-03-08 17:22:32 +0800107