developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From 71155a316facf65574dc5a03cc6c70a824c3d220 Mon Sep 17 00:00:00 2001 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 2 | From: TomLiu <tomml.liu@mediatek.com> |
| 3 | Date: Wed, 14 Dec 2022 00:44:07 -0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 1023/1052] wifi: mt76: mt7915: amsdu set and get control |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame] | 7 | mt7915/mac.c | 7 +++++++ |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 8 | mt7915/mt7915.h | 1 + |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame] | 9 | mt7915/vendor.c | 30 ++++++++++++++++++++++++++++++ |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 10 | mt7915/vendor.h | 12 ++++++++++++ |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame] | 11 | 4 files changed, 50 insertions(+) |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 12 | |
| 13 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 14 | index dc75ff1f..e14b3fdd 100644 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 15 | --- a/mt7915/mac.c |
| 16 | +++ b/mt7915/mac.c |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 17 | @@ -1994,6 +1994,13 @@ static void mt7915_mac_sta_stats_work(struct mt7915_phy *phy) |
developer | 8effbd3 | 2023-04-17 15:57:28 +0800 | [diff] [blame] | 18 | spin_unlock_bh(&phy->stats_lock); |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | +void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en) { |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 22 | + if (en) |
| 23 | + ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU); |
| 24 | + else |
| 25 | + ieee80211_hw_clear(hw, SUPPORTS_AMSDU_IN_AMPDU); |
| 26 | +} |
| 27 | + |
| 28 | #ifdef CONFIG_MTK_VENDOR |
| 29 | void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta) |
| 30 | { |
| 31 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 32 | index 437cfb63..82d374eb 100644 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 33 | --- a/mt7915/mt7915.h |
| 34 | +++ b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 35 | @@ -775,6 +775,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr, |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 36 | bool pci, int *irq); |
| 37 | |
| 38 | #ifdef CONFIG_MTK_VENDOR |
| 39 | +void mt7915_set_wireless_amsdu(struct ieee80211_hw *hw, u8 en); |
| 40 | void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta); |
| 41 | void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif); |
| 42 | void mt7915_mcu_set_rfeature_starec(void *data, struct mt7915_dev *dev, |
| 43 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 44 | index b4facaaa..4848e0a1 100644 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 45 | --- a/mt7915/vendor.c |
| 46 | +++ b/mt7915/vendor.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 47 | @@ -32,10 +32,16 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = { |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 48 | [MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA] = {.type = NLA_U8 }, |
| 49 | [MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO] = {.type = NLA_U8 }, |
| 50 | [MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE] = {.type = NLA_U16 }, |
| 51 | + [MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU] = {.type = NLA_U8 }, |
| 52 | [MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA] = {.type = NLA_U8 }, |
| 53 | [MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT] = {.type = NLA_U8 }, |
| 54 | }; |
| 55 | |
| 56 | +static const struct nla_policy |
| 57 | +wireless_dump_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP] = { |
| 58 | + [MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU] = { .type = NLA_U8 }, |
| 59 | +}; |
| 60 | + |
| 61 | static const struct nla_policy |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 62 | mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = { |
| 63 | [MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 }, |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 64 | @@ -1140,11 +1146,34 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy, |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 65 | val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]); |
| 66 | mt7915_mcu_set_cfg(phy, CFGINFO_CERT_CFG, val8); /* Cert Enable for OMI */ |
| 67 | mt7915_mcu_set_bypass_smthint(phy, val8); /* Cert bypass smooth interpolation */ |
| 68 | + } else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]) { |
| 69 | + val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU]); |
| 70 | + mt7915_set_wireless_amsdu(hw, val8); |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | +static int |
| 77 | +mt7915_vendor_wireless_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 78 | + struct sk_buff *skb, const void *data, int data_len, |
| 79 | + unsigned long *storage) |
| 80 | +{ |
| 81 | + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 82 | + int len = 0; |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame] | 83 | + |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 84 | + if (*storage == 1) |
| 85 | + return -ENOENT; |
| 86 | + *storage = 1; |
| 87 | + |
| 88 | + if (nla_put_u8(skb, |
| 89 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, ieee80211_hw_check(hw, SUPPORTS_AMSDU_IN_AMPDU))) |
| 90 | + return -ENOMEM; |
| 91 | + len += 2; |
| 92 | + |
| 93 | + return len; |
| 94 | +} |
| 95 | + |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 96 | static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy, |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 97 | struct wireless_dev *wdev, |
| 98 | const void *data, |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 99 | @@ -1443,6 +1472,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 100 | .flags = WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 101 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 102 | .doit = mt7915_vendor_wireless_ctrl, |
| 103 | + .dumpit = mt7915_vendor_wireless_ctrl_dump, |
| 104 | .policy = wireless_ctrl_policy, |
| 105 | .maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX, |
| 106 | }, |
| 107 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 108 | index 24f35c8e..8a13b3a3 100644 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 109 | --- a/mt7915/vendor.h |
| 110 | +++ b/mt7915/vendor.h |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 111 | @@ -75,6 +75,7 @@ enum mtk_vendor_attr_wireless_ctrl { |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 112 | MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA, |
| 113 | MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE, |
| 114 | MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO, |
| 115 | + MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU, |
| 116 | MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT = 9, |
| 117 | |
| 118 | MTK_VENDOR_ATTR_WIRELESS_CTRL_MU_EDCA, /* reserve */ |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 119 | @@ -84,6 +85,17 @@ enum mtk_vendor_attr_wireless_ctrl { |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 120 | NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1 |
| 121 | }; |
| 122 | |
| 123 | +enum mtk_vendor_attr_wireless_dump { |
| 124 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_UNSPEC, |
| 125 | + |
| 126 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, |
| 127 | + |
| 128 | + /* keep last */ |
| 129 | + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP, |
| 130 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX = |
| 131 | + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP - 1 |
| 132 | +}; |
| 133 | + |
developer | 2c78ce7 | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 134 | enum mtk_vendor_attr_mu_ctrl { |
| 135 | MTK_VENDOR_ATTR_MU_CTRL_UNSPEC, |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 136 | |
| 137 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 138 | 2.18.0 |
developer | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 139 | |