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