developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 1 | From f93d67b6ae1b70d4fcf95db93951627362d174c8 Mon Sep 17 00:00:00 2001 |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <Yi-Chia.Hsieh@mediatek.com> |
| 3 | Date: Tue, 12 Jul 2022 10:04:35 -0700 |
developer | bf24a8a | 2022-11-30 14:52:20 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1120/1128] mt76: mt7915: add phy capability vendor command |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 5 | |
| 6 | --- |
developer | 071927d | 2022-08-31 20:39:29 +0800 | [diff] [blame] | 7 | mt7915/mt7915.h | 1 + |
| 8 | mt7915/vendor.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ |
| 9 | mt7915/vendor.h | 25 ++++++++++++++++++++++++ |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 10 | 3 files changed, 78 insertions(+) |
| 11 | |
| 12 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 13 | index 26bcb4e5..66695d5b 100644 |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [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 | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 25 | index c7551848..77d71e48 100644 |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 26 | --- a/mt7915/vendor.c |
| 27 | +++ b/mt7915/vendor.c |
| 28 | @@ -50,6 +50,18 @@ rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = { |
developer | 60384cf | 2022-06-21 10:26:31 -0700 | [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 | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 47 | @@ -974,6 +986,35 @@ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy, |
developer | 60384cf | 2022-06-21 10:26:31 -0700 | [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 | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 83 | @@ -1031,6 +1072,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | 60384cf | 2022-06-21 10:26:31 -0700 | [diff] [blame] | 84 | .doit = mt7915_vendor_hemu_ctrl, |
| 85 | .policy = hemu_ctrl_policy, |
| 86 | .maxattr = MTK_VENDOR_ATTR_HEMU_CTRL_MAX, |
| 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 | |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 101 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 102 | index a8e4ebf9..719b851f 100644 |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 103 | --- a/mt7915/vendor.h |
| 104 | +++ b/mt7915/vendor.h |
developer | 60384cf | 2022-06-21 10:26:31 -0700 | [diff] [blame] | 105 | @@ -9,6 +9,7 @@ enum mtk_nl80211_vendor_subcmds { |
| 106 | MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL = 0xc3, |
| 107 | MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4, |
| 108 | MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5, |
| 109 | + MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6, |
| 110 | }; |
| 111 | |
| 112 | enum mtk_capi_control_changed { |
| 113 | @@ -149,4 +150,28 @@ enum mtk_vendor_attr_mnt_dump { |
| 114 | NUM_MTK_VENDOR_ATTRS_AMNT_DUMP - 1 |
| 115 | }; |
| 116 | |
| 117 | +enum mtk_vendor_attr_phy_capa_ctrl { |
| 118 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_UNSPEC, |
| 119 | + |
| 120 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_SET, |
| 121 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_DUMP, |
| 122 | + |
| 123 | + /* keep last */ |
| 124 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL, |
| 125 | + MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX = |
| 126 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_CTRL - 1 |
| 127 | +}; |
| 128 | + |
| 129 | +enum mtk_vendor_attr_phy_capa_dump { |
| 130 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_UNSPEC, |
| 131 | + |
| 132 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_BSS, |
| 133 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA, |
| 134 | + |
| 135 | + /* keep last */ |
| 136 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP, |
| 137 | + MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX = |
| 138 | + NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1 |
| 139 | +}; |
| 140 | + |
| 141 | #endif |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 142 | -- |
developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 143 | 2.25.1 |
developer | e995440 | 2022-07-12 10:15:11 -0700 | [diff] [blame] | 144 | |