developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From a48f497ea998ba30f4ee8ab7e5c41e0eb7738119 Mon Sep 17 00:00:00 2001 |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 3 | Date: Thu, 26 Jan 2023 08:50:47 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1025/1052] wifi: mt76: mt7915: add vendor cmd to get available |
developer | da18a74 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 5 | color bitmap |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 6 | |
| 7 | Add a vendor cmd to notify user space available color bitmap. |
| 8 | The OBSS BSS color bitmap is maintained in mac80211, so mt76 will make use of that. |
| 9 | |
| 10 | Signed-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 | |
| 16 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 17 | index 35891d49..df08704b 100644 |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 18 | --- a/mt7915/vendor.c |
| 19 | +++ b/mt7915/vendor.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 20 | @@ -100,6 +100,11 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = { |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 21 | [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; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 32 | @@ -1431,6 +1436,27 @@ mt7915_vendor_ibf_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 33 | 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, |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 51 | + ~bss_conf->used_color_bitmap, NL80211_ATTR_PAD)) |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 52 | + return -ENOMEM; |
| 53 | + len += 1; |
| 54 | + |
| 55 | + return len; |
| 56 | +} |
| 57 | |
| 58 | static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
| 59 | { |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 60 | @@ -1537,6 +1563,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 61 | .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 | |
| 78 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 79 | index f91ad695..5b8d99bf 100644 |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 80 | --- a/mt7915/vendor.h |
| 81 | +++ b/mt7915/vendor.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 82 | @@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds { |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 83 | 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 | |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 90 | @@ -274,4 +275,14 @@ enum mtk_vendor_attr_ibf_dump { |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 91 | 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 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 106 | 2.18.0 |
developer | bb6ddff | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 107 | |