developer | a43cc48 | 2023-04-17 15:57:28 +0800 | [diff] [blame^] | 1 | From 7c4fae95d00e39603ac209413b6f042065923bd7 Mon Sep 17 00:00:00 2001 |
developer | f8871e8 | 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 | a43cc48 | 2023-04-17 15:57:28 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 1031/1032] wifi: mt76: mt7915: add vendor cmd to get available |
developer | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 5 | color bitmap |
developer | f8871e8 | 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 | a43cc48 | 2023-04-17 15:57:28 +0800 | [diff] [blame^] | 17 | index 3b7ac09..b021bd5 100644 |
developer | f8871e8 | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 18 | --- a/mt7915/vendor.c |
| 19 | +++ b/mt7915/vendor.c |
developer | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 20 | @@ -98,6 +98,11 @@ ibf_ctrl_policy[NUM_MTK_VENDOR_ATTRS_IBF_CTRL] = { |
developer | f8871e8 | 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 | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 32 | @@ -1275,6 +1280,27 @@ mt7915_vendor_ibf_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
developer | f8871e8 | 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 | 81e9eb7 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 51 | + ~bss_conf->used_color_bitmap, NL80211_ATTR_PAD)) |
developer | f8871e8 | 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 | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 60 | @@ -1381,6 +1407,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | f8871e8 | 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 | a43cc48 | 2023-04-17 15:57:28 +0800 | [diff] [blame^] | 79 | index 6001ce4..358a16f 100644 |
developer | f8871e8 | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 80 | --- a/mt7915/vendor.h |
| 81 | +++ b/mt7915/vendor.h |
| 82 | @@ -14,6 +14,7 @@ enum mtk_nl80211_vendor_subcmds { |
| 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 | 78848c6 | 2023-04-06 13:44:00 +0800 | [diff] [blame] | 90 | @@ -258,4 +259,14 @@ enum mtk_vendor_attr_ibf_dump { |
developer | f8871e8 | 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 | a43cc48 | 2023-04-17 15:57:28 +0800 | [diff] [blame^] | 106 | 2.18.0 |
developer | f8871e8 | 2023-03-08 17:22:32 +0800 | [diff] [blame] | 107 | |