developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 1 | From 3982aaa49810c8f0b2c754bd6c7a2d2b21c45407 Mon Sep 17 00:00:00 2001 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <Yi-Chia.Hsieh@mediatek.com> |
| 3 | Date: Tue, 12 Jul 2022 10:04:35 -0700 |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 4 | Subject: [PATCH] wifi: mt76: mt7915: add phy capability vendor command |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
| 7 | mt7915/mt7915.h | 1 + |
| 8 | mt7915/vendor.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 9 | mt7915/vendor.h | 26 +++++++++++++++++++++++++ |
| 10 | 3 files changed, 79 insertions(+) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 11 | |
| 12 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 13 | index 1c1b3a1..f8ae363 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 14 | --- a/mt7915/mt7915.h |
| 15 | +++ b/mt7915/mt7915.h |
| 16 | @@ -11,6 +11,7 @@ |
| 17 | |
| 18 | #define MTK_DEBUG 1 |
| 19 | #define MT7915_MAX_INTERFACES 19 |
| 20 | +#define MT7915_MAX_BSS 16 |
| 21 | #define MT7915_WTBL_SIZE 288 |
| 22 | #define MT7916_WTBL_SIZE 544 |
| 23 | #define MT7915_WTBL_RESERVED (mt7915_wtbl_size(dev) - 1) |
| 24 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 25 | index 1beb603..e6cd79f 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 26 | --- a/mt7915/vendor.c |
| 27 | +++ b/mt7915/vendor.c |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 28 | @@ -52,6 +52,18 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 29 | [MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TXBF] = { .type = NLA_U8 }, |
| 30 | }; |
| 31 | |
| 32 | +static const struct nla_policy |
| 33 | +phy_capa_ctrl_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL] = { |
| 34 | + [MTK_VENDOR_ATTR_PHY_CAPA_CTRL_SET] = { .type = NLA_NESTED }, |
| 35 | + [MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP] = { .type = NLA_NESTED }, |
| 36 | +}; |
| 37 | + |
| 38 | +static const struct nla_policy |
| 39 | +phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = { |
| 40 | + [MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS] = { .type = NLA_U16 }, |
| 41 | + [MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA] = { .type = NLA_U16 }, |
| 42 | +}; |
| 43 | + |
| 44 | struct csi_null_tone { |
| 45 | u8 start; |
| 46 | u8 end; |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 47 | @@ -1131,6 +1143,35 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | +static int |
| 52 | +mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 53 | + struct sk_buff *skb, const void *data, int data_len, |
| 54 | + unsigned long *storage) |
| 55 | +{ |
| 56 | + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
| 57 | + struct mt7915_phy *phy = mt7915_hw_phy(hw); |
| 58 | + struct mt7915_dev *dev = phy->dev; |
| 59 | + void *a; |
| 60 | + int len = 0; |
| 61 | + |
| 62 | + if (*storage == 1) |
| 63 | + return -ENOENT; |
| 64 | + *storage = 1; |
| 65 | + |
| 66 | + a = nla_nest_start(skb, MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP); |
| 67 | + |
| 68 | + if (nla_put_u16(skb, |
| 69 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS, MT7915_MAX_BSS) || |
| 70 | + nla_put_u16(skb, |
| 71 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA, MT7915_WTBL_STA)) |
| 72 | + return -ENOMEM; |
| 73 | + len += 2; |
| 74 | + |
| 75 | + nla_nest_end(skb, a); |
| 76 | + |
| 77 | + return len; |
| 78 | +} |
| 79 | + |
| 80 | static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
| 81 | { |
| 82 | .info = { |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 83 | @@ -1188,6 +1229,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 84 | .doit = mt7915_vendor_mu_ctrl, |
| 85 | .policy = mu_ctrl_policy, |
| 86 | .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 87 | + }, |
| 88 | + { |
| 89 | + .info = { |
| 90 | + .vendor_id = MTK_NL80211_VENDOR_ID, |
| 91 | + .subcmd = MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL, |
| 92 | + }, |
| 93 | + .flags = WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 94 | + WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 95 | + .dumpit = mt7915_vendor_phy_capa_ctrl_dump, |
| 96 | + .policy = phy_capa_ctrl_policy, |
| 97 | + .maxattr = MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX, |
| 98 | } |
| 99 | }; |
| 100 | |
| 101 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 102 | index 9cb6755..e58884c 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 103 | --- a/mt7915/vendor.h |
| 104 | +++ b/mt7915/vendor.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 105 | @@ -10,6 +10,7 @@ enum mtk_nl80211_vendor_subcmds { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 106 | MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3, |
| 107 | MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4, |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 108 | MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 109 | + MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6, |
| 110 | }; |
| 111 | |
| 112 | enum mtk_capi_control_changed { |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 113 | @@ -164,4 +165,29 @@ enum mtk_vendor_attr_mnt_dump { |
| 114 | MTK_VENDOR_ATTR_AMNT_DUMP_MAX = |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 115 | NUM_MTK_VENDOR_ATTRS_AMNT_DUMP - 1 |
| 116 | }; |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame^] | 117 | + |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 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 |
| 143 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 144 | 2.18.0 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 145 | |