developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From ea8636284d9278b7053ecedb02045be768d90957 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 | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1014/1052] wifi: mt76: mt7915: add phy capability vendor |
| 5 | command |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 6 | |
| 7 | --- |
| 8 | mt7915/mt7915.h | 1 + |
| 9 | mt7915/vendor.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 10 | mt7915/vendor.h | 26 +++++++++++++++++++++++++ |
| 11 | 3 files changed, 79 insertions(+) |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 14 | index ef92b2ea..64cfa2e0 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 15 | --- 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) |
| 25 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 26 | index cf09b513..9e8d2442 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 27 | --- a/mt7915/vendor.c |
| 28 | +++ b/mt7915/vendor.c |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 29 | @@ -52,6 +52,18 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 30 | [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; |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 48 | @@ -1131,6 +1143,35 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 49 | 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 = { |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 84 | @@ -1188,6 +1229,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 85 | .doit = mt7915_vendor_mu_ctrl, |
| 86 | .policy = mu_ctrl_policy, |
| 87 | .maxattr = MTK_VENDOR_ATTR_MU_CTRL_MAX, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 88 | + }, |
| 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 | |
| 102 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 103 | index 9cb67551..e58884ce 100644 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 104 | --- a/mt7915/vendor.h |
| 105 | +++ b/mt7915/vendor.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 106 | @@ -10,6 +10,7 @@ enum mtk_nl80211_vendor_subcmds { |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 107 | MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3, |
| 108 | MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4, |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 109 | MTK_NL80211_VENDOR_SUBCMD_MU_CTRL = 0xc5, |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 110 | + MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6, |
| 111 | }; |
| 112 | |
| 113 | enum mtk_capi_control_changed { |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 114 | @@ -164,4 +165,29 @@ enum mtk_vendor_attr_mnt_dump { |
| 115 | MTK_VENDOR_ATTR_AMNT_DUMP_MAX = |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 116 | NUM_MTK_VENDOR_ATTRS_AMNT_DUMP - 1 |
| 117 | }; |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 118 | + |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 119 | +enum mtk_vendor_attr_phy_capa_ctrl { |
| 120 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_UNSPEC, |
| 121 | + |
| 122 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_SET, |
| 123 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP, |
| 124 | + |
| 125 | + /* keep last */ |
| 126 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL, |
| 127 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX = |
| 128 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL - 1 |
| 129 | +}; |
| 130 | + |
| 131 | +enum mtk_vendor_attr_phy_capa_dump { |
| 132 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_UNSPEC, |
| 133 | + |
| 134 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS, |
| 135 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA, |
| 136 | + |
| 137 | + /* keep last */ |
| 138 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP, |
| 139 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX = |
| 140 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1 |
| 141 | +}; |
| 142 | + |
| 143 | #endif |
| 144 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 145 | 2.18.0 |
developer | e2cfb52 | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 146 | |