developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From ca4c360d853ec0678da7b08c9b524334b931eeda Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 3 | Date: Mon, 27 Nov 2023 10:43:34 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 079/223] mtk: mt76: mt7996: switch to per-link data structure |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 5 | of sta |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 6 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 7 | Introduce struct mt7996_link_sta, data structure for per-link STA. |
| 8 | Note that mt7996_sta now represents a peer legacy or MLD device. |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 9 | This is a preliminary patch to add MLO support for mt7996 chipsets. |
| 10 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 11 | Change-Id: I3929a2e3d1bd092581175f60fb900690f22b57d6 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 12 | Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| 13 | Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| 14 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 15 | --- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 16 | mt7996/debugfs.c | 20 ++- |
| 17 | mt7996/mac.c | 109 ++++++------ |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 18 | mt7996/main.c | 220 +++++++++++++++--------- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 19 | mt7996/mcu.c | 430 ++++++++++++++++++++++++---------------------- |
| 20 | mt7996/mt7996.h | 44 +++-- |
| 21 | mt7996/testmode.c | 6 +- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 22 | 6 files changed, 461 insertions(+), 368 deletions(-) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 23 | |
| 24 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 25 | index 792ace03..786bdc38 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 26 | --- a/mt7996/debugfs.c |
| 27 | +++ b/mt7996/debugfs.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 28 | @@ -726,14 +726,15 @@ static void |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 29 | mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta) |
| 30 | { |
| 31 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 32 | + struct mt7996_link_sta *mlink = &msta->deflink; |
| 33 | struct mt7996_dev *dev = msta->vif->deflink.phy->dev; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 34 | struct seq_file *s = data; |
| 35 | u8 ac; |
| 36 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 37 | for (ac = 0; ac < 4; ac++) { |
| 38 | u32 qlen, ctrl, val; |
| 39 | - u32 idx = msta->wcid.idx >> 5; |
| 40 | - u8 offs = msta->wcid.idx & GENMASK(4, 0); |
| 41 | + u32 idx = mlink->wcid.idx >> 5; |
| 42 | + u8 offs = mlink->wcid.idx & GENMASK(4, 0); |
| 43 | |
| 44 | ctrl = BIT(31) | BIT(11) | (ac << 24); |
| 45 | val = mt76_rr(dev, MT_PLE_AC_QEMPTY(ac, idx)); |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 46 | @@ -741,11 +742,11 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 47 | if (val & BIT(offs)) |
| 48 | continue; |
| 49 | |
| 50 | - mt76_wr(dev, MT_FL_Q0_CTRL, ctrl | msta->wcid.idx); |
| 51 | + mt76_wr(dev, MT_FL_Q0_CTRL, ctrl | mlink->wcid.idx); |
| 52 | qlen = mt76_get_field(dev, MT_FL_Q3_CTRL, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 53 | GENMASK(11, 0)); |
| 54 | seq_printf(s, "\tSTA %pM wcid %d: AC%d%d queued:%d\n", |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 55 | - sta->addr, msta->wcid.idx, |
| 56 | + sta->addr, mlink->wcid.idx, |
| 57 | msta->vif->deflink.mt76.wmm_idx, ac, qlen); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 58 | } |
| 59 | } |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 60 | @@ -1028,7 +1029,7 @@ mt7996_airtime_read(struct seq_file *s, void *data) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 61 | struct mt76_dev *mdev = &dev->mt76; |
| 62 | struct mt76_sta_stats *stats; |
| 63 | struct ieee80211_sta *sta; |
| 64 | - struct mt7996_sta *msta; |
| 65 | + struct mt7996_link_sta *mlink; |
| 66 | struct mt76_wcid *wcid; |
| 67 | struct mt76_vif *vif; |
| 68 | u16 i; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 69 | @@ -1040,9 +1041,9 @@ mt7996_airtime_read(struct seq_file *s, void *data) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 70 | if (!wcid || !wcid->sta) |
| 71 | continue; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 72 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 73 | - msta = container_of(wcid, struct mt7996_sta, wcid); |
| 74 | - sta = container_of((void *)msta, struct ieee80211_sta, drv_priv); |
| 75 | - vif = &msta->vif->deflink.mt76; |
| 76 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 77 | + sta = container_of((void *)mlink->sta, struct ieee80211_sta, drv_priv); |
| 78 | + vif = &mlink->sta->vif->deflink.mt76; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 79 | stats = &wcid->stats; |
| 80 | |
| 81 | seq_printf(s, "%pM WCID: %hu BandIdx: %hhu OmacIdx: 0x%hhx\t" |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 82 | @@ -1217,6 +1218,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 83 | #define LONG_PREAMBLE 1 |
| 84 | struct ieee80211_sta *sta = file->private_data; |
| 85 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 86 | + struct mt7996_link_sta *mlink = &msta->deflink; |
| 87 | struct mt7996_dev *dev = msta->vif->deflink.phy->dev; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 88 | struct ra_rate phy = {}; |
| 89 | char buf[100]; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 90 | @@ -1252,7 +1254,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 91 | goto out; |
| 92 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 93 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 94 | - phy.wlan_idx = cpu_to_le16(msta->wcid.idx); |
| 95 | + phy.wlan_idx = cpu_to_le16(mlink->wcid.idx); |
| 96 | phy.gi = cpu_to_le16(gi); |
| 97 | phy.ltf = cpu_to_le16(ltf); |
| 98 | phy.ldpc = phy.ldpc ? 7 : 0; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 99 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 100 | index 8f743125..8b682842 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 101 | --- a/mt7996/mac.c |
| 102 | +++ b/mt7996/mac.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 103 | @@ -54,7 +54,7 @@ static const struct mt7996_dfs_radar_spec jp_radar_specs = { |
| 104 | static struct mt76_wcid *mt7996_rx_get_wcid(struct mt7996_dev *dev, |
| 105 | u16 idx, bool unicast) |
| 106 | { |
| 107 | - struct mt7996_sta *sta; |
| 108 | + struct mt7996_link_sta *mlink; |
| 109 | struct mt76_wcid *wcid; |
| 110 | |
| 111 | if (idx >= ARRAY_SIZE(dev->mt76.wcid)) |
| 112 | @@ -67,11 +67,11 @@ static struct mt76_wcid *mt7996_rx_get_wcid(struct mt7996_dev *dev, |
| 113 | if (!wcid->sta) |
| 114 | return NULL; |
| 115 | |
| 116 | - sta = container_of(wcid, struct mt7996_sta, wcid); |
| 117 | - if (!sta->vif) |
| 118 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 119 | + if (!mlink->sta->vif) |
| 120 | return NULL; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 121 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 122 | - return &sta->vif->sta.wcid; |
| 123 | + return &mlink->wcid; |
| 124 | } |
| 125 | |
| 126 | bool mt7996_mac_wtbl_update(struct mt7996_dev *dev, int idx, u32 mask) |
| 127 | @@ -92,12 +92,11 @@ u32 mt7996_mac_wtbl_lmac_addr(struct mt7996_dev *dev, u16 wcid, u8 dw) |
| 128 | } |
| 129 | |
| 130 | void mt7996_mac_enable_rtscts(struct mt7996_dev *dev, |
| 131 | - struct ieee80211_vif *vif, bool enable) |
| 132 | + struct mt7996_link_sta *mlink, bool enable) |
| 133 | { |
| 134 | - struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 135 | u32 addr; |
| 136 | |
| 137 | - addr = mt7996_mac_wtbl_lmac_addr(dev, mvif->sta.wcid.idx, 5); |
| 138 | + addr = mt7996_mac_wtbl_lmac_addr(dev, mlink->wcid.idx, 5); |
| 139 | if (enable) |
| 140 | mt76_set(dev, addr, BIT(5)); |
| 141 | else |
| 142 | @@ -349,7 +348,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q, |
| 143 | __le16 fc = 0; |
| 144 | int idx; |
| 145 | u8 hw_aggr = false; |
| 146 | - struct mt7996_sta *msta = NULL; |
| 147 | + struct mt7996_link_sta *mlink = NULL; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 148 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 149 | hw_aggr = status->aggr; |
| 150 | memset(status, 0, sizeof(*status)); |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 151 | @@ -378,10 +377,10 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 152 | status->wcid = mt7996_rx_get_wcid(dev, idx, unicast); |
| 153 | |
| 154 | if (status->wcid) { |
| 155 | - msta = container_of(status->wcid, struct mt7996_sta, wcid); |
| 156 | + mlink = container_of(status->wcid, struct mt7996_link_sta, wcid); |
| 157 | spin_lock_bh(&dev->mt76.sta_poll_lock); |
| 158 | - if (list_empty(&msta->wcid.poll_list)) |
| 159 | - list_add_tail(&msta->wcid.poll_list, |
| 160 | + if (list_empty(&mlink->wcid.poll_list)) |
| 161 | + list_add_tail(&mlink->wcid.poll_list, |
| 162 | &dev->mt76.sta_poll_list); |
| 163 | spin_unlock_bh(&dev->mt76.sta_poll_lock); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 164 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 165 | @@ -588,7 +587,7 @@ mt7996_mac_fill_rx(struct mt7996_dev *dev, enum mt76_rxq_id q, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 166 | #endif |
| 167 | } else { |
| 168 | status->flag |= RX_FLAG_8023; |
| 169 | - mt7996_wed_check_ppe(dev, &dev->mt76.q_rx[q], msta, skb, |
| 170 | + mt7996_wed_check_ppe(dev, &dev->mt76.q_rx[q], mlink ? mlink->sta : NULL, skb, |
| 171 | *info); |
| 172 | } |
| 173 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 174 | @@ -957,6 +956,7 @@ static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 175 | mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb) |
| 176 | { |
| 177 | struct mt7996_sta *msta; |
| 178 | + struct mt7996_link_sta *mlink; |
| 179 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 180 | bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; |
| 181 | u16 fc, tid; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 182 | @@ -985,7 +985,8 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 183 | return; |
| 184 | |
| 185 | msta = (struct mt7996_sta *)sta->drv_priv; |
| 186 | - if (!test_and_set_bit(tid, &msta->wcid.ampdu_state)) |
| 187 | + mlink = rcu_dereference(msta->link[0]); |
| 188 | + if (!test_and_set_bit(tid, &mlink->wcid.ampdu_state)) |
| 189 | ieee80211_start_tx_ba_session(sta, tid, 0); |
| 190 | } |
| 191 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 192 | @@ -1063,7 +1064,7 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 193 | */ |
| 194 | info = le32_to_cpu(*cur_info); |
| 195 | if (info & MT_TXFREE_INFO_PAIR) { |
| 196 | - struct mt7996_sta *msta; |
| 197 | + struct mt7996_link_sta *mlink; |
| 198 | u16 idx; |
| 199 | |
| 200 | idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 201 | @@ -1072,10 +1073,10 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 202 | if (!sta) |
| 203 | continue; |
| 204 | |
| 205 | - msta = container_of(wcid, struct mt7996_sta, wcid); |
| 206 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 207 | spin_lock_bh(&mdev->sta_poll_lock); |
| 208 | - if (list_empty(&msta->wcid.poll_list)) |
| 209 | - list_add_tail(&msta->wcid.poll_list, |
| 210 | + if (list_empty(&mlink->wcid.poll_list)) |
| 211 | + list_add_tail(&mlink->wcid.poll_list, |
| 212 | &mdev->sta_poll_list); |
| 213 | spin_unlock_bh(&mdev->sta_poll_lock); |
| 214 | continue; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 215 | @@ -1280,7 +1281,7 @@ out: |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 216 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 217 | static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 218 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 219 | - struct mt7996_sta *msta = NULL; |
| 220 | + struct mt7996_link_sta *mlink; |
| 221 | struct mt76_wcid *wcid; |
| 222 | __le32 *txs_data = data; |
| 223 | u16 wcidx; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 224 | @@ -1301,16 +1302,15 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 225 | if (!wcid) |
| 226 | goto out; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 227 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 228 | - msta = container_of(wcid, struct mt7996_sta, wcid); |
| 229 | - |
| 230 | mt7996_mac_add_txs_skb(dev, wcid, pid, txs_data); |
| 231 | |
| 232 | if (!wcid->sta) |
| 233 | goto out; |
| 234 | |
| 235 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 236 | spin_lock_bh(&dev->mt76.sta_poll_lock); |
| 237 | - if (list_empty(&msta->wcid.poll_list)) |
| 238 | - list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list); |
| 239 | + if (list_empty(&mlink->wcid.poll_list)) |
| 240 | + list_add_tail(&mlink->wcid.poll_list, &dev->mt76.sta_poll_list); |
| 241 | spin_unlock_bh(&dev->mt76.sta_poll_lock); |
| 242 | |
| 243 | out: |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 244 | @@ -2254,8 +2254,9 @@ void mt7996_mac_sta_rc_work(struct work_struct *work) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 245 | struct ieee80211_sta *sta; |
| 246 | struct ieee80211_vif *vif; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 247 | struct ieee80211_bss_conf *conf; |
| 248 | + struct ieee80211_link_sta *link_sta; |
| 249 | struct mt7996_bss_conf *mconf; |
| 250 | - struct mt7996_sta *msta; |
| 251 | + struct mt7996_link_sta *mlink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 252 | u32 changed; |
| 253 | LIST_HEAD(list); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 254 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 255 | @@ -2263,24 +2264,25 @@ void mt7996_mac_sta_rc_work(struct work_struct *work) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 256 | list_splice_init(&dev->sta_rc_list, &list); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 257 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 258 | while (!list_empty(&list)) { |
| 259 | - msta = list_first_entry(&list, struct mt7996_sta, rc_list); |
| 260 | - list_del_init(&msta->rc_list); |
| 261 | - changed = msta->changed; |
| 262 | - msta->changed = 0; |
| 263 | + mlink = list_first_entry(&list, struct mt7996_link_sta, rc_list); |
| 264 | + list_del_init(&mlink->rc_list); |
| 265 | + changed = mlink->changed; |
| 266 | + mlink->changed = 0; |
| 267 | spin_unlock_bh(&dev->mt76.sta_poll_lock); |
| 268 | |
| 269 | - sta = container_of((void *)msta, struct ieee80211_sta, drv_priv); |
| 270 | - vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv); |
| 271 | + sta = container_of((void *)mlink->sta, struct ieee80211_sta, drv_priv); |
| 272 | + link_sta = &sta->deflink; |
| 273 | + vif = container_of((void *)mlink->sta->vif, struct ieee80211_vif, drv_priv); |
| 274 | conf = &vif->bss_conf; |
| 275 | - mconf = &msta->vif->deflink; |
| 276 | + mconf = &mlink->sta->vif->deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 277 | |
| 278 | if (changed & (IEEE80211_RC_SUPP_RATES_CHANGED | |
| 279 | IEEE80211_RC_NSS_CHANGED | |
| 280 | IEEE80211_RC_BW_CHANGED)) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 281 | - mt7996_mcu_add_rate_ctrl(dev, conf, mconf, sta, true); |
| 282 | + mt7996_mcu_add_rate_ctrl(dev, conf, mconf, link_sta, mlink, true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 283 | |
| 284 | if (changed & IEEE80211_RC_SMPS_CHANGED) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 285 | - mt7996_mcu_set_fixed_field(dev, mconf, sta, NULL, |
| 286 | + mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, NULL, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 287 | RATE_PARAM_MMPS_UPDATE); |
| 288 | |
| 289 | spin_lock_bh(&dev->mt76.sta_poll_lock); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 290 | @@ -2573,7 +2575,7 @@ static int mt7996_mac_check_twt_req(struct ieee80211_twt_setup *twt) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | static bool |
| 294 | -mt7996_mac_twt_param_equal(struct mt7996_sta *msta, |
| 295 | +mt7996_mac_twt_param_equal(struct mt7996_link_sta *mlink, |
| 296 | struct ieee80211_twt_params *twt_agrt) |
| 297 | { |
| 298 | u16 type = le16_to_cpu(twt_agrt->req_type); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 299 | @@ -2584,10 +2586,10 @@ mt7996_mac_twt_param_equal(struct mt7996_sta *msta, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 300 | for (i = 0; i < MT7996_MAX_STA_TWT_AGRT; i++) { |
| 301 | struct mt7996_twt_flow *f; |
| 302 | |
| 303 | - if (!(msta->twt.flowid_mask & BIT(i))) |
| 304 | + if (!(mlink->twt.flowid_mask & BIT(i))) |
| 305 | continue; |
| 306 | |
| 307 | - f = &msta->twt.flow[i]; |
| 308 | + f = &mlink->twt.flow[i]; |
| 309 | if (f->duration == twt_agrt->min_twt_dur && |
| 310 | f->mantissa == twt_agrt->mantissa && |
| 311 | f->exp == exp && |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 312 | @@ -2606,6 +2608,7 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 313 | { |
| 314 | enum ieee80211_twt_setup_cmd setup_cmd = TWT_SETUP_CMD_REJECT; |
| 315 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 316 | + struct mt7996_link_sta *mlink; |
| 317 | struct ieee80211_twt_params *twt_agrt = (void *)twt->params; |
| 318 | u16 req_type = le16_to_cpu(twt_agrt->req_type); |
| 319 | enum ieee80211_twt_setup_cmd sta_setup_cmd; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 320 | @@ -2617,11 +2620,12 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 321 | goto out; |
| 322 | |
| 323 | mutex_lock(&dev->mt76.mutex); |
| 324 | + mlink = mlink_dereference_protected(msta, 0); |
| 325 | |
| 326 | if (dev->twt.n_agrt == MT7996_MAX_TWT_AGRT) |
| 327 | goto unlock; |
| 328 | |
| 329 | - if (hweight8(msta->twt.flowid_mask) == ARRAY_SIZE(msta->twt.flow)) |
| 330 | + if (hweight8(mlink->twt.flowid_mask) == ARRAY_SIZE(mlink->twt.flow)) |
| 331 | goto unlock; |
| 332 | |
| 333 | if (twt_agrt->min_twt_dur < MT7996_MIN_TWT_DUR) { |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 334 | @@ -2630,10 +2634,10 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 335 | goto unlock; |
| 336 | } |
| 337 | |
| 338 | - if (mt7996_mac_twt_param_equal(msta, twt_agrt)) |
| 339 | + if (mt7996_mac_twt_param_equal(mlink, twt_agrt)) |
| 340 | goto unlock; |
| 341 | |
| 342 | - flowid = ffs(~msta->twt.flowid_mask) - 1; |
| 343 | + flowid = ffs(~mlink->twt.flowid_mask) - 1; |
| 344 | twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_FLOWID); |
| 345 | twt_agrt->req_type |= le16_encode_bits(flowid, |
| 346 | IEEE80211_TWT_REQTYPE_FLOWID); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 347 | @@ -2642,10 +2646,10 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 348 | exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, req_type); |
| 349 | sta_setup_cmd = FIELD_GET(IEEE80211_TWT_REQTYPE_SETUP_CMD, req_type); |
| 350 | |
| 351 | - flow = &msta->twt.flow[flowid]; |
| 352 | + flow = &mlink->twt.flow[flowid]; |
| 353 | memset(flow, 0, sizeof(*flow)); |
| 354 | INIT_LIST_HEAD(&flow->list); |
| 355 | - flow->wcid = msta->wcid.idx; |
| 356 | + flow->wcid = mlink->wcid.idx; |
| 357 | flow->table_id = table_id; |
| 358 | flow->id = flowid; |
| 359 | flow->duration = twt_agrt->min_twt_dur; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 360 | @@ -2663,7 +2667,7 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 361 | |
| 362 | flow->sched = true; |
| 363 | flow->start_tsf = mt7996_mac_twt_sched_list_add(dev, flow); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 364 | - curr_tsf = __mt7996_get_tsf(hw, &msta->vif->deflink); |
| 365 | + curr_tsf = __mt7996_get_tsf(hw, &mlink->sta->vif->deflink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 366 | div_u64_rem(curr_tsf - flow->start_tsf, interval, &rem); |
| 367 | flow_tsf = curr_tsf + interval - rem; |
| 368 | twt_agrt->twt = cpu_to_le64(flow_tsf); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 369 | @@ -2672,13 +2676,13 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 370 | } |
| 371 | flow->tsf = le64_to_cpu(twt_agrt->twt); |
| 372 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 373 | - if (mt7996_mcu_twt_agrt_update(dev, &msta->vif->deflink, flow, |
| 374 | + if (mt7996_mcu_twt_agrt_update(dev, &mlink->sta->vif->deflink, flow, |
| 375 | MCU_TWT_AGRT_ADD)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 376 | goto unlock; |
| 377 | |
| 378 | setup_cmd = TWT_SETUP_CMD_ACCEPT; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 379 | dev->twt.table_mask |= BIT(table_id); |
| 380 | - msta->twt.flowid_mask |= BIT(flowid); |
| 381 | + mlink->twt.flowid_mask |= BIT(flowid); |
| 382 | dev->twt.n_agrt++; |
| 383 | |
| 384 | unlock: |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 385 | @@ -2691,26 +2695,25 @@ out: |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev, |
| 389 | - struct mt7996_sta *msta, |
| 390 | - u8 flowid) |
| 391 | + struct mt7996_link_sta *mlink, u8 flowid) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 392 | { |
| 393 | struct mt7996_twt_flow *flow; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 394 | - struct mt7996_bss_conf *mconf = mconf_dereference_protected(msta->vif, 0); |
| 395 | + struct mt7996_bss_conf *mconf = mconf_dereference_protected(mlink->sta->vif, 0); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 396 | |
| 397 | lockdep_assert_held(&dev->mt76.mutex); |
| 398 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 399 | - if (flowid >= ARRAY_SIZE(msta->twt.flow)) |
| 400 | + if (flowid >= ARRAY_SIZE(mlink->twt.flow)) |
| 401 | return; |
| 402 | |
| 403 | - if (!(msta->twt.flowid_mask & BIT(flowid))) |
| 404 | + if (!(mlink->twt.flowid_mask & BIT(flowid))) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 405 | return; |
| 406 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 407 | - flow = &msta->twt.flow[flowid]; |
| 408 | + flow = &mlink->twt.flow[flowid]; |
| 409 | if (mt7996_mcu_twt_agrt_update(dev, mconf, flow, MCU_TWT_AGRT_DELETE)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 410 | return; |
| 411 | |
| 412 | list_del_init(&flow->list); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 413 | - msta->twt.flowid_mask &= ~BIT(flowid); |
| 414 | + mlink->twt.flowid_mask &= ~BIT(flowid); |
| 415 | dev->twt.table_mask &= ~BIT(flow->table_id); |
| 416 | dev->twt.n_agrt--; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 417 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 418 | @@ -2723,7 +2726,7 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 419 | struct cfg80211_scan_request *req = phy->scan_req; |
| 420 | struct ieee80211_vif *vif = phy->scan_vif; |
| 421 | struct mt7996_vif *mvif; |
| 422 | - struct mt76_wcid *wcid; |
| 423 | + struct mt7996_link_sta *mlink; |
| 424 | struct ieee80211_tx_info *info; |
| 425 | struct sk_buff *skb; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 426 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 427 | @@ -2731,7 +2734,6 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 428 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 429 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 430 | mvif = (struct mt7996_vif *)vif->drv_priv; |
| 431 | - wcid = &mvif->sta.wcid; |
| 432 | |
| 433 | skb = ieee80211_probereq_get(hw, vif->addr, |
| 434 | ssid->ssid, ssid->ssid_len, req->ie_len); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 435 | @@ -2764,7 +2766,8 @@ mt7996_scan_send_probe(struct mt7996_phy *phy, struct cfg80211_ssid *ssid, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 436 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 437 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 438 | local_bh_disable(); |
| 439 | - mt76_tx(phy->mt76, NULL, wcid, skb); |
| 440 | + mlink = rcu_dereference(mvif->sta.link[0]); |
| 441 | + mt76_tx(phy->mt76, NULL, &mlink->wcid, skb); |
| 442 | local_bh_enable(); |
| 443 | |
| 444 | rcu_read_unlock(); |
| 445 | diff --git a/mt7996/main.c b/mt7996/main.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 446 | index 8d919dd0..98afb057 100644 |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 447 | --- a/mt7996/main.c |
| 448 | +++ b/mt7996/main.c |
| 449 | @@ -229,6 +229,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, |
| 450 | struct ieee80211_bss_conf *conf = &vif->bss_conf; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 451 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 452 | struct mt7996_bss_conf *mconf = &mvif->deflink; |
| 453 | + struct mt7996_link_sta *mlink = &mvif->sta.deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 454 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 455 | struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| 456 | struct mt76_txq *mtxq; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 457 | @@ -268,14 +269,15 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 458 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 459 | idx = MT7996_WTBL_RESERVED - mconf->mt76.idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 460 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 461 | - INIT_LIST_HEAD(&mvif->sta.rc_list); |
| 462 | - INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); |
| 463 | - mvif->sta.wcid.idx = idx; |
| 464 | - mvif->sta.wcid.phy_idx = band_idx; |
| 465 | - mvif->sta.wcid.hw_key_idx = -1; |
| 466 | - mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; |
| 467 | - mvif->sta.vif = mvif; |
| 468 | - mt76_wcid_init(&mvif->sta.wcid); |
| 469 | + INIT_LIST_HEAD(&mlink->rc_list); |
| 470 | + INIT_LIST_HEAD(&mlink->wcid.poll_list); |
| 471 | + mlink->wcid.idx = idx; |
| 472 | + mlink->wcid.phy_idx = band_idx; |
| 473 | + mlink->wcid.hw_key_idx = -1; |
| 474 | + mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; |
| 475 | + mlink->sta = &mvif->sta; |
| 476 | + mlink->sta->vif = mvif; |
| 477 | + mt76_wcid_init(&mlink->wcid); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 478 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 479 | mt7996_mac_wtbl_update(dev, idx, |
| 480 | MT_WTBL_UPDATE_ADM_COUNT_CLEAR); |
| 481 | @@ -297,14 +299,15 @@ static int mt7996_add_interface(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 482 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 483 | mt7996_init_bitrate_mask(mconf); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 484 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 485 | - mt7996_mcu_add_bss_info(phy, conf, mconf, true); |
| 486 | + mt7996_mcu_add_bss_info(phy, conf, mconf, mlink, true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 487 | /* defer the first STA_REC of BMC entry to BSS_CHANGED_BSSID for STA |
| 488 | * interface, since firmware only records BSSID when the entry is new |
| 489 | */ |
| 490 | if (vif->type != NL80211_IFTYPE_STATION) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 491 | - mt7996_mcu_add_sta(dev, conf, mconf, NULL, true, true); |
| 492 | - rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); |
| 493 | + mt7996_mcu_add_sta(dev, conf, mconf, NULL, mlink, true, true); |
| 494 | + rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid); |
| 495 | rcu_assign_pointer(mvif->link[0], mconf); |
| 496 | + rcu_assign_pointer(mvif->sta.link[0], mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 497 | |
| 498 | out: |
| 499 | mutex_unlock(&dev->mt76.mutex); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 500 | @@ -318,10 +321,10 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, |
| 501 | struct ieee80211_bss_conf *conf; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 502 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 503 | struct mt7996_bss_conf *mconf; |
| 504 | - struct mt7996_sta *msta = &mvif->sta; |
| 505 | + struct mt7996_link_sta *mlink = &mvif->sta.deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 506 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 507 | struct mt7996_phy *phy = mt7996_hw_phy(hw); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 508 | - int idx = msta->wcid.idx; |
| 509 | + int idx = mlink->wcid.idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 510 | |
| 511 | cancel_delayed_work_sync(&phy->scan_work); |
| 512 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 513 | @@ -329,8 +332,8 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, |
| 514 | |
| 515 | conf = link_conf_dereference_protected(vif, 0); |
| 516 | mconf = mconf_dereference_protected(mvif, 0); |
| 517 | - mt7996_mcu_add_sta(dev, conf, mconf, NULL, false, false); |
| 518 | - mt7996_mcu_add_bss_info(phy, conf, mconf, false); |
| 519 | + mt7996_mcu_add_sta(dev, conf, mconf, NULL, mlink, false, false); |
| 520 | + mt7996_mcu_add_bss_info(phy, conf, mconf, mlink, false); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 521 | |
| 522 | if (vif == phy->monitor_vif) |
| 523 | phy->monitor_vif = NULL; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 524 | @@ -343,12 +346,13 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw, |
| 525 | phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 526 | |
| 527 | spin_lock_bh(&dev->mt76.sta_poll_lock); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 528 | - if (!list_empty(&msta->wcid.poll_list)) |
| 529 | - list_del_init(&msta->wcid.poll_list); |
| 530 | + if (!list_empty(&mlink->wcid.poll_list)) |
| 531 | + list_del_init(&mlink->wcid.poll_list); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 532 | spin_unlock_bh(&dev->mt76.sta_poll_lock); |
| 533 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 534 | - mt76_wcid_cleanup(&dev->mt76, &msta->wcid); |
| 535 | + mt76_wcid_cleanup(&dev->mt76, &mlink->wcid); |
| 536 | rcu_assign_pointer(mvif->link[0], NULL); |
| 537 | + rcu_assign_pointer(mvif->sta.link[0], NULL); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 538 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 539 | mutex_unlock(&dev->mt76.mutex); |
| 540 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 541 | @@ -445,10 +449,10 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 542 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 543 | struct mt7996_sta *msta = sta ? (struct mt7996_sta *)sta->drv_priv : |
| 544 | &mvif->sta; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 545 | - struct mt76_wcid *wcid = &msta->wcid; |
| 546 | struct mt7996_bss_conf *mconf; |
| 547 | + struct mt7996_link_sta *mlink; |
| 548 | struct ieee80211_bss_conf *conf; |
| 549 | - u8 *wcid_keyidx = &wcid->hw_key_idx; |
| 550 | + u8 *wcid_keyidx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 551 | int idx = key->keyidx; |
| 552 | int err = 0; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 553 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 554 | @@ -462,6 +466,12 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 555 | !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) |
| 556 | return -EOPNOTSUPP; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 557 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 558 | + mutex_lock(&dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 559 | + conf = link_conf_dereference_protected(vif, 0); |
| 560 | + mconf = mconf_dereference_protected(mvif, 0); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 561 | + mlink = mlink_dereference_protected(msta, 0); |
| 562 | + wcid_keyidx = &mlink->wcid.hw_key_idx; |
| 563 | + |
| 564 | /* fall back to sw encryption for unsupported ciphers */ |
| 565 | switch (key->cipher) { |
| 566 | case WLAN_CIPHER_SUITE_TKIP: |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 567 | @@ -484,16 +494,13 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 568 | case WLAN_CIPHER_SUITE_WEP40: |
| 569 | case WLAN_CIPHER_SUITE_WEP104: |
| 570 | default: |
| 571 | + mutex_unlock(&dev->mt76.mutex); |
| 572 | return -EOPNOTSUPP; |
| 573 | } |
| 574 | |
| 575 | - mutex_lock(&dev->mt76.mutex); |
| 576 | - |
| 577 | - conf = link_conf_dereference_protected(vif, 0); |
| 578 | - mconf = mconf_dereference_protected(mvif, 0); |
| 579 | if (cmd == SET_KEY && !sta && !mconf->mt76.cipher) { |
| 580 | mconf->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher); |
| 581 | - mt7996_mcu_add_bss_info(phy, conf, mconf, true); |
| 582 | + mt7996_mcu_add_bss_info(phy, conf, mconf, mlink, true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | if (cmd == SET_KEY) { |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 586 | @@ -504,14 +511,14 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 587 | goto out; |
| 588 | } |
| 589 | |
| 590 | - mt76_wcid_key_setup(&dev->mt76, wcid, key); |
| 591 | + mt76_wcid_key_setup(&dev->mt76, &mlink->wcid, key); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 592 | |
| 593 | if (key->keyidx == 6 || key->keyidx == 7) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 594 | - err = mt7996_mcu_bcn_prot_enable(dev, conf, mconf, key); |
| 595 | + err = mt7996_mcu_bcn_prot_enable(dev, conf, mconf, mlink, key); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 596 | else |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 597 | err = mt7996_mcu_add_key(&dev->mt76, mconf, key, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 598 | MCU_WMWA_UNI_CMD(STA_REC_UPDATE), |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 599 | - &msta->wcid, cmd); |
| 600 | + &mlink->wcid, cmd); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 601 | out: |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 602 | mutex_unlock(&dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 603 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 604 | @@ -714,25 +721,27 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 605 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 606 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 607 | struct mt7996_bss_conf *mconf; |
| 608 | + struct mt7996_link_sta *mlink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 609 | struct mt7996_phy *phy = mt7996_hw_phy(hw); |
| 610 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 611 | |
| 612 | mutex_lock(&dev->mt76.mutex); |
| 613 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 614 | mconf = mconf_dereference_protected(mvif, 0); |
| 615 | + mlink = mlink_dereference_protected(&mvif->sta, 0); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 616 | /* station mode uses BSSID to map the wlan entry to a peer, |
| 617 | * and then peer references bss_info_rfch to set bandwidth cap. |
| 618 | */ |
| 619 | if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) || |
| 620 | (changed & BSS_CHANGED_ASSOC && vif->cfg.assoc) || |
| 621 | (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 622 | - mt7996_mcu_add_bss_info(phy, info, mconf, true); |
| 623 | - mt7996_mcu_add_sta(dev, info, mconf, NULL, true, |
| 624 | + mt7996_mcu_add_bss_info(phy, info, mconf, mlink, true); |
| 625 | + mt7996_mcu_add_sta(dev, info, mconf, NULL, mlink, true, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 626 | !!(changed & BSS_CHANGED_BSSID)); |
| 627 | } |
| 628 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 629 | if (changed & BSS_CHANGED_ERP_CTS_PROT) |
| 630 | - mt7996_mac_enable_rtscts(dev, vif, info->use_cts_prot); |
| 631 | + mt7996_mac_enable_rtscts(dev, mlink, info->use_cts_prot); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 632 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 633 | if (changed & BSS_CHANGED_ERP_SLOT) { |
| 634 | int slottime = info->use_short_slot ? 9 : 20; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 635 | @@ -803,6 +812,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 636 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 637 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 638 | struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0); |
| 639 | + struct mt7996_link_sta *mlink = &msta->deflink; |
| 640 | u8 band_idx = mconf->phy->mt76->band_idx; |
| 641 | int idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 642 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 643 | @@ -814,13 +824,16 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 644 | if (idx < 0) |
| 645 | return -ENOSPC; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 646 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 647 | - INIT_LIST_HEAD(&msta->rc_list); |
| 648 | - INIT_LIST_HEAD(&msta->wcid.poll_list); |
| 649 | + INIT_LIST_HEAD(&mlink->rc_list); |
| 650 | + INIT_LIST_HEAD(&mlink->wcid.poll_list); |
| 651 | msta->vif = mvif; |
| 652 | - msta->wcid.sta = 1; |
| 653 | - msta->wcid.idx = idx; |
| 654 | - msta->wcid.phy_idx = band_idx; |
| 655 | - msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; |
| 656 | + mlink->wcid.sta = 1; |
| 657 | + mlink->wcid.idx = idx; |
| 658 | + mlink->wcid.phy_idx = band_idx; |
| 659 | + mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; |
| 660 | + mlink->sta = msta; |
| 661 | + |
| 662 | + rcu_assign_pointer(msta->link[0], mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 663 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 664 | #ifdef CONFIG_MTK_VENDOR |
| 665 | mt7996_vendor_amnt_sta_remove(mconf->phy, sta); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 666 | @@ -853,7 +866,9 @@ int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 667 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 668 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 669 | struct mt7996_bss_conf *mconf; |
| 670 | + struct mt7996_link_sta *mlink; |
| 671 | struct ieee80211_bss_conf *conf; |
| 672 | + struct ieee80211_link_sta *link_sta; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 673 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 674 | mutex_lock(&dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 675 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 676 | @@ -863,10 +878,17 @@ int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 677 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 678 | conf = link_conf_dereference_protected(vif, 0); |
| 679 | mconf = mconf_dereference_protected(mvif, 0); |
| 680 | - mt7996_mcu_add_sta(dev, conf, mconf, sta, true, true); |
| 681 | - mt7996_mcu_add_rate_ctrl(dev, conf, mconf, sta, false); |
| 682 | + link_sta = link_sta_dereference_protected(sta, 0); |
| 683 | + mlink = mlink_dereference_protected(msta, 0); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 684 | + |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 685 | + mt7996_mac_wtbl_update(dev, mlink->wcid.idx, |
| 686 | + MT_WTBL_UPDATE_ADM_COUNT_CLEAR); |
| 687 | |
| 688 | - ewma_avg_signal_init(&msta->avg_ack_signal); |
| 689 | + mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, true, true); |
| 690 | + mt7996_mcu_add_rate_ctrl(dev, conf, mconf, link_sta, mlink, false); |
| 691 | + mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 692 | + |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 693 | + ewma_avg_signal_init(&mlink->avg_ack_signal); |
| 694 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 695 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 696 | mutex_unlock(&dev->mt76.mutex); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 697 | @@ -879,25 +901,31 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 698 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 699 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 700 | struct mt7996_bss_conf *mconf; |
| 701 | + struct mt7996_link_sta *mlink; |
| 702 | struct ieee80211_bss_conf *conf; |
| 703 | + struct ieee80211_link_sta *link_sta; |
| 704 | int i; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 705 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 706 | conf = link_conf_dereference_protected(vif, 0); |
| 707 | mconf = mconf_dereference_protected(mvif, 0); |
| 708 | - mt7996_mcu_add_sta(dev, conf, mconf, sta, false, false); |
| 709 | + link_sta = link_sta_dereference_protected(sta, 0); |
| 710 | + mlink = mlink_dereference_protected(msta, 0); |
| 711 | + mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, false, false); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 712 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 713 | - mt7996_mac_wtbl_update(dev, msta->wcid.idx, |
| 714 | + mt7996_mac_wtbl_update(dev, mlink->wcid.idx, |
| 715 | MT_WTBL_UPDATE_ADM_COUNT_CLEAR); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 716 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 717 | - for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++) |
| 718 | - mt7996_mac_twt_teardown_flow(dev, msta, i); |
| 719 | + for (i = 0; i < ARRAY_SIZE(mlink->twt.flow); i++) |
| 720 | + mt7996_mac_twt_teardown_flow(dev, mlink, i); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 721 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 722 | spin_lock_bh(&mdev->sta_poll_lock); |
| 723 | - if (!list_empty(&msta->wcid.poll_list)) |
| 724 | - list_del_init(&msta->wcid.poll_list); |
| 725 | - if (!list_empty(&msta->rc_list)) |
| 726 | - list_del_init(&msta->rc_list); |
| 727 | + if (!list_empty(&mlink->wcid.poll_list)) |
| 728 | + list_del_init(&mlink->wcid.poll_list); |
| 729 | + if (!list_empty(&mlink->rc_list)) |
| 730 | + list_del_init(&mlink->rc_list); |
| 731 | spin_unlock_bh(&mdev->sta_poll_lock); |
| 732 | + |
| 733 | + rcu_assign_pointer(msta->link[0], NULL); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 734 | } |
| 735 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 736 | static void mt7996_tx(struct ieee80211_hw *hw, |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 737 | @@ -909,19 +937,22 @@ static void mt7996_tx(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 738 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 739 | struct ieee80211_vif *vif = info->control.vif; |
| 740 | struct mt76_wcid *wcid = &dev->mt76.global_wcid; |
| 741 | + struct mt7996_link_sta *mlink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 742 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 743 | if (control->sta) { |
| 744 | - struct mt7996_sta *sta; |
| 745 | + struct mt7996_sta *msta; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 746 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 747 | - sta = (struct mt7996_sta *)control->sta->drv_priv; |
| 748 | - wcid = &sta->wcid; |
| 749 | + msta = (struct mt7996_sta *)control->sta->drv_priv; |
| 750 | + mlink = rcu_dereference(msta->link[0]); |
| 751 | + wcid = &mlink->wcid; |
| 752 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 753 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 754 | if (vif && !control->sta) { |
| 755 | struct mt7996_vif *mvif; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 756 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 757 | mvif = (struct mt7996_vif *)vif->drv_priv; |
| 758 | - wcid = &mvif->sta.wcid; |
| 759 | + mlink = rcu_dereference(mvif->sta.link[0]); |
| 760 | + wcid = &mlink->wcid; |
| 761 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 762 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 763 | mt76_tx(mphy, control->sta, wcid, skb); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 764 | @@ -948,6 +979,7 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 765 | struct ieee80211_sta *sta = params->sta; |
| 766 | struct ieee80211_txq *txq = sta->txq[params->tid]; |
| 767 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 768 | + struct mt7996_link_sta *mlink; |
| 769 | u16 tid = params->tid; |
| 770 | u16 ssn = params->ssn; |
| 771 | struct mt76_txq *mtxq; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 772 | @@ -959,14 +991,15 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 773 | mtxq = (struct mt76_txq *)txq->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 774 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 775 | mutex_lock(&dev->mt76.mutex); |
| 776 | + mlink = mlink_dereference_protected(msta, 0); |
| 777 | switch (action) { |
| 778 | case IEEE80211_AMPDU_RX_START: |
| 779 | - mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, |
| 780 | + mt76_rx_aggr_start(&dev->mt76, &mlink->wcid, tid, ssn, |
| 781 | params->buf_size); |
| 782 | ret = mt7996_mcu_add_rx_ba(dev, params, true); |
| 783 | break; |
| 784 | case IEEE80211_AMPDU_RX_STOP: |
| 785 | - mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); |
| 786 | + mt76_rx_aggr_stop(&dev->mt76, &mlink->wcid, tid); |
| 787 | ret = mt7996_mcu_add_rx_ba(dev, params, false); |
| 788 | break; |
| 789 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 790 | @@ -977,16 +1010,16 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 791 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
| 792 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
| 793 | mtxq->aggr = false; |
| 794 | - clear_bit(tid, &msta->wcid.ampdu_state); |
| 795 | + clear_bit(tid, &mlink->wcid.ampdu_state); |
| 796 | ret = mt7996_mcu_add_tx_ba(dev, params, false); |
| 797 | break; |
| 798 | case IEEE80211_AMPDU_TX_START: |
| 799 | - set_bit(tid, &msta->wcid.ampdu_state); |
| 800 | + set_bit(tid, &mlink->wcid.ampdu_state); |
| 801 | ret = IEEE80211_AMPDU_TX_START_IMMEDIATE; |
| 802 | break; |
| 803 | case IEEE80211_AMPDU_TX_STOP_CONT: |
| 804 | mtxq->aggr = false; |
| 805 | - clear_bit(tid, &msta->wcid.ampdu_state); |
| 806 | + clear_bit(tid, &mlink->wcid.ampdu_state); |
| 807 | ret = mt7996_mcu_add_tx_ba(dev, params, false); |
| 808 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
| 809 | break; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 810 | @@ -1165,10 +1198,19 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 811 | struct ieee80211_sta *sta, |
| 812 | struct station_info *sinfo) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 813 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 814 | + struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 815 | struct mt7996_phy *phy = mt7996_hw_phy(hw); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 816 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 817 | - struct rate_info *txrate = &msta->wcid.rate; |
| 818 | + struct mt7996_link_sta *mlink; |
| 819 | + struct rate_info *txrate; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 820 | + |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 821 | + /* TODO: support per-link rate report */ |
| 822 | + mutex_lock(&dev->mt76.mutex); |
| 823 | + mlink = mlink_dereference_protected(msta, 0); |
| 824 | + if (!mlink) |
| 825 | + goto out; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 826 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 827 | + txrate = &mlink->wcid.rate; |
| 828 | if (txrate->legacy || txrate->flags) { |
| 829 | if (txrate->legacy) { |
| 830 | sinfo->txrate.legacy = txrate->legacy; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 831 | @@ -1187,44 +1229,52 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 832 | sinfo->txrate.flags = txrate->flags; |
| 833 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 834 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 835 | - sinfo->tx_failed = msta->wcid.stats.tx_failed; |
| 836 | + sinfo->tx_failed = mlink->wcid.stats.tx_failed; |
| 837 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 838 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 839 | - sinfo->tx_retries = msta->wcid.stats.tx_retries; |
| 840 | + sinfo->tx_retries = mlink->wcid.stats.tx_retries; |
| 841 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 842 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 843 | - sinfo->ack_signal = (s8)msta->ack_signal; |
| 844 | + sinfo->ack_signal = (s8)mlink->ack_signal; |
| 845 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 846 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 847 | - sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal); |
| 848 | + sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&mlink->avg_ack_signal); |
| 849 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 850 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 851 | if (mtk_wed_device_active(&phy->dev->mt76.mmio.wed)) { |
| 852 | - sinfo->tx_bytes = msta->wcid.stats.tx_bytes; |
| 853 | + sinfo->tx_bytes = mlink->wcid.stats.tx_bytes; |
| 854 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 855 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 856 | - sinfo->rx_bytes = msta->wcid.stats.rx_bytes; |
| 857 | + sinfo->rx_bytes = mlink->wcid.stats.rx_bytes; |
| 858 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 859 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 860 | - sinfo->tx_packets = msta->wcid.stats.tx_packets; |
| 861 | + sinfo->tx_packets = mlink->wcid.stats.tx_packets; |
| 862 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 863 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 864 | - sinfo->rx_packets = msta->wcid.stats.rx_packets; |
| 865 | + sinfo->rx_packets = mlink->wcid.stats.rx_packets; |
| 866 | sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); |
| 867 | } |
| 868 | +out: |
| 869 | + mutex_unlock(&dev->mt76.mutex); |
| 870 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 871 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 872 | static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta) |
| 873 | { |
| 874 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 875 | + struct mt7996_link_sta *mlink; |
| 876 | struct mt7996_dev *dev = msta->vif->dev; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 877 | u32 *changed = data; |
| 878 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 879 | + rcu_read_lock(); |
| 880 | + mlink = rcu_dereference(msta->link[0]); |
| 881 | + |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 882 | spin_lock_bh(&dev->mt76.sta_poll_lock); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 883 | - msta->changed |= *changed; |
| 884 | - if (list_empty(&msta->rc_list)) |
| 885 | - list_add_tail(&msta->rc_list, &dev->sta_rc_list); |
| 886 | + mlink->changed |= *changed; |
| 887 | + if (list_empty(&mlink->rc_list)) |
| 888 | + list_add_tail(&mlink->rc_list, &dev->sta_rc_list); |
| 889 | spin_unlock_bh(&dev->mt76.sta_poll_lock); |
| 890 | + |
| 891 | + rcu_read_unlock(); |
| 892 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 893 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 894 | static void mt7996_sta_rc_update(struct ieee80211_hw *hw, |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 895 | @@ -1238,7 +1288,7 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 896 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 897 | if (!msta->vif) { |
| 898 | dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n", |
| 899 | - sta->addr, msta->wcid.idx); |
| 900 | + sta->addr, msta->deflink.wcid.idx); |
| 901 | return; |
| 902 | } |
| 903 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 904 | @@ -1284,16 +1334,18 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 905 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 906 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 907 | struct mt7996_bss_conf *mconf; |
| 908 | + struct mt7996_link_sta *mlink; |
| 909 | |
| 910 | mutex_lock(&dev->mt76.mutex); |
| 911 | mconf = mconf_dereference_protected(mvif, 0); |
| 912 | + mlink = mlink_dereference_protected(msta, 0); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 913 | |
| 914 | if (enabled) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 915 | - set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags); |
| 916 | + set_bit(MT_WCID_FLAG_4ADDR, &mlink->wcid.flags); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 917 | else |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 918 | - clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags); |
| 919 | + clear_bit(MT_WCID_FLAG_4ADDR, &mlink->wcid.flags); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 920 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 921 | - mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, sta); |
| 922 | + mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, mlink); |
| 923 | mutex_unlock(&dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 924 | } |
| 925 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 926 | @@ -1306,16 +1358,18 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 927 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 928 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 929 | struct mt7996_bss_conf *mconf; |
| 930 | + struct mt7996_link_sta *mlink; |
| 931 | |
| 932 | mutex_lock(&dev->mt76.mutex); |
| 933 | mconf = mconf_dereference_protected(mvif, 0); |
| 934 | + mlink = mlink_dereference_protected(msta, 0); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 935 | |
| 936 | if (enabled) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 937 | - set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); |
| 938 | + set_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 939 | else |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 940 | - clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); |
| 941 | + clear_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 942 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 943 | - mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, sta); |
| 944 | + mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, mlink); |
| 945 | mutex_unlock(&dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 946 | } |
| 947 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 948 | @@ -1448,11 +1502,12 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 949 | { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 950 | struct mt76_ethtool_worker_info *wi = wi_data; |
| 951 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 952 | + struct mt7996_link_sta *mlink = &msta->deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 953 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 954 | if (msta->vif->deflink.mt76.idx != wi->idx) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 955 | return; |
| 956 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 957 | - mt76_ethtool_worker(wi, &msta->wcid.stats, true); |
| 958 | + mt76_ethtool_worker(wi, &mlink->wcid.stats, true); |
| 959 | } |
| 960 | |
| 961 | static |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 962 | @@ -1555,10 +1610,12 @@ mt7996_twt_teardown_request(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 963 | u8 flowid) |
| 964 | { |
| 965 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 966 | + struct mt7996_link_sta *mlink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 967 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 968 | |
| 969 | mutex_lock(&dev->mt76.mutex); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 970 | - mt7996_mac_twt_teardown_flow(dev, msta, flowid); |
| 971 | + mlink = mlink_dereference_protected(msta, 0); |
| 972 | + mt7996_mac_twt_teardown_flow(dev, mlink, flowid); |
| 973 | mutex_unlock(&dev->mt76.mutex); |
| 974 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 975 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 976 | @@ -1681,6 +1738,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 977 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 978 | struct mt7996_bss_conf *mconf = &mvif->deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 979 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 980 | + struct mt7996_link_sta *mlink = &msta->deflink; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 981 | struct mt7996_dev *dev = mt7996_hw_dev(hw); |
| 982 | struct mt7996_phy *phy = mt7996_hw_phy(hw); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 983 | struct mtk_wed_device *wed = &dev->mt76.mmio.wed; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 984 | @@ -1703,7 +1761,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 985 | if (!mtk_wed_device_active(wed)) |
| 986 | return -ENODEV; |
| 987 | |
| 988 | - if (msta->wcid.idx > MT7996_WTBL_STA) |
| 989 | + if (mlink->wcid.idx > MT7996_WTBL_STA) |
| 990 | return -EIO; |
| 991 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 992 | path->type = DEV_PATH_MTK_WDMA; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 993 | @@ -1711,11 +1769,11 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 994 | path->mtk_wdma.wdma_idx = wed->wdma_idx; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 995 | path->mtk_wdma.bss = mconf->mt76.idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 996 | path->mtk_wdma.queue = 0; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 997 | - path->mtk_wdma.wcid = msta->wcid.idx; |
| 998 | + path->mtk_wdma.wcid = mlink->wcid.idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 999 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1000 | if (ieee80211_hw_check(hw, SUPPORTS_AMSDU_IN_AMPDU) && |
| 1001 | mtk_wed_is_amsdu_supported(wed)) |
| 1002 | - path->mtk_wdma.amsdu = msta->wcid.amsdu; |
| 1003 | + path->mtk_wdma.amsdu = mlink->wcid.amsdu; |
| 1004 | else |
| 1005 | path->mtk_wdma.amsdu = 0; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1006 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1007 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1008 | index b2eed253..ced769b4 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1009 | --- a/mt7996/mcu.c |
| 1010 | +++ b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1011 | @@ -122,13 +122,13 @@ mt7996_mcu_get_sta_nss(u16 mcs_map) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1012 | } |
| 1013 | |
| 1014 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1015 | -mt7996_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, |
| 1016 | +mt7996_mcu_set_sta_he_mcs(struct ieee80211_link_sta *link_sta, |
| 1017 | struct mt7996_bss_conf *mconf, |
| 1018 | __le16 *he_mcs, u16 mcs_map) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1019 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1020 | enum nl80211_band band = mconf->phy->mt76->chandef.chan->band; |
| 1021 | const u16 *mask = mconf->bitrate_mask.control[band].he_mcs; |
| 1022 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 1023 | + int nss, max_nss = link_sta->rx_nss > 3 ? 4 : link_sta->rx_nss; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1024 | |
| 1025 | for (nss = 0; nss < max_nss; nss++) { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1026 | int mcs; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1027 | @@ -171,11 +171,11 @@ mt7996_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1031 | -mt7996_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs, |
| 1032 | - const u16 *mask) |
| 1033 | +mt7996_mcu_set_sta_vht_mcs(struct ieee80211_link_sta *link_sta, |
| 1034 | + __le16 *vht_mcs, const u16 *mask) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1035 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1036 | - u16 mcs, mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map); |
| 1037 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 1038 | + u16 mcs, mcs_map = le16_to_cpu(link_sta->vht_cap.vht_mcs.rx_mcs_map); |
| 1039 | + int nss, max_nss = link_sta->rx_nss > 3 ? 4 : link_sta->rx_nss; |
| 1040 | |
| 1041 | for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) { |
| 1042 | switch (mcs_map & 0x3) { |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1043 | @@ -197,13 +197,13 @@ mt7996_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1047 | -mt7996_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs, |
| 1048 | +mt7996_mcu_set_sta_ht_mcs(struct ieee80211_link_sta *link_sta, u8 *ht_mcs, |
| 1049 | const u8 *mask) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1050 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1051 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 1052 | + int nss, max_nss = link_sta->rx_nss > 3 ? 4 : link_sta->rx_nss; |
| 1053 | |
| 1054 | for (nss = 0; nss < max_nss; nss++) |
| 1055 | - ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss]; |
| 1056 | + ht_mcs[nss] = link_sta->ht_cap.mcs.rx_mask[nss] & mask[nss]; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1057 | } |
| 1058 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1059 | static int |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1060 | @@ -536,14 +536,14 @@ static inline void __mt7996_stat_to_netdev(struct mt76_phy *mphy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1061 | u32 tx_bytes, u32 rx_bytes, |
| 1062 | u32 tx_packets, u32 rx_packets) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1063 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1064 | - struct mt7996_sta *msta; |
| 1065 | + struct mt7996_link_sta *mlink; |
| 1066 | struct ieee80211_vif *vif; |
| 1067 | struct wireless_dev *wdev; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1068 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1069 | if (wiphy_ext_feature_isset(mphy->hw->wiphy, |
| 1070 | NL80211_EXT_FEATURE_STAS_COUNT)) { |
| 1071 | - msta = container_of(wcid, struct mt7996_sta, wcid); |
| 1072 | - vif = container_of((void *)msta->vif, struct ieee80211_vif, |
| 1073 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 1074 | + vif = container_of((void *)mlink->sta->vif, struct ieee80211_vif, |
| 1075 | drv_priv); |
| 1076 | wdev = ieee80211_vif_to_wdev(vif); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1077 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1078 | @@ -1241,10 +1241,10 @@ __mt7996_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1079 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1080 | int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, |
| 1081 | struct ieee80211_bss_conf *conf, |
| 1082 | - struct mt7996_bss_conf *mconf, int enable) |
| 1083 | + struct mt7996_bss_conf *mconf, |
| 1084 | + struct mt7996_link_sta *mlink, int enable) |
| 1085 | { |
| 1086 | struct ieee80211_vif *vif = conf->vif; |
| 1087 | - struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 1088 | struct mt7996_dev *dev = phy->dev; |
| 1089 | struct sk_buff *skb; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1090 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1091 | @@ -1260,7 +1260,7 @@ int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1092 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1093 | /* bss_basic must be first */ |
| 1094 | mt7996_mcu_bss_basic_tlv(skb, conf, mconf, NULL, phy->mt76, |
| 1095 | - mvif->sta.wcid.idx, enable); |
| 1096 | + mlink->wcid.idx, enable); |
| 1097 | mt7996_mcu_bss_sec_tlv(skb, mconf); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1098 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1099 | if (vif->type == NL80211_IFTYPE_MONITOR) |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1100 | @@ -1340,9 +1340,10 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1101 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1102 | struct mt7996_sta *msta = (struct mt7996_sta *)params->sta->drv_priv; |
| 1103 | struct mt7996_bss_conf *mconf = mconf_dereference_protected(msta->vif, 0); |
| 1104 | + struct mt7996_link_sta *mlink = mlink_dereference_protected(msta, 0); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1105 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1106 | if (enable && !params->amsdu) |
| 1107 | - msta->wcid.amsdu = false; |
| 1108 | + mlink->wcid.amsdu = false; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1109 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1110 | return mt7996_mcu_sta_ba(dev, &mconf->mt76, params, enable, true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1111 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1112 | @@ -1360,15 +1361,15 @@ int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1113 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1114 | mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf, |
| 1115 | struct mt7996_bss_conf *mconf, |
| 1116 | - struct ieee80211_sta *sta) |
| 1117 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1118 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1119 | - struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
| 1120 | + struct ieee80211_he_cap_elem *elem = &link_sta->he_cap.he_cap_elem; |
| 1121 | struct ieee80211_he_mcs_nss_supp mcs_map; |
| 1122 | struct sta_rec_he_v2 *he; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1123 | struct tlv *tlv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1124 | int i = 0; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1125 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1126 | - if (!sta->deflink.he_cap.has_he) |
| 1127 | + if (!link_sta->he_cap.has_he) |
| 1128 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1129 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1130 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_V2, sizeof(*he)); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1131 | @@ -1385,21 +1386,21 @@ mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1132 | u8p_replace_bits(&he->he_phy_cap[1], conf->he_ldpc, |
| 1133 | IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1134 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1135 | - mcs_map = sta->deflink.he_cap.he_mcs_nss_supp; |
| 1136 | - switch (sta->deflink.bandwidth) { |
| 1137 | + mcs_map = link_sta->he_cap.he_mcs_nss_supp; |
| 1138 | + switch (link_sta->bandwidth) { |
| 1139 | case IEEE80211_STA_RX_BW_160: |
| 1140 | if (elem->phy_cap_info[0] & |
| 1141 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) |
| 1142 | - mt7996_mcu_set_sta_he_mcs(sta, mconf, |
| 1143 | + mt7996_mcu_set_sta_he_mcs(link_sta, mconf, |
| 1144 | &he->max_nss_mcs[CMD_HE_MCS_BW8080], |
| 1145 | le16_to_cpu(mcs_map.rx_mcs_80p80)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1146 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1147 | - mt7996_mcu_set_sta_he_mcs(sta, mconf, |
| 1148 | + mt7996_mcu_set_sta_he_mcs(link_sta, mconf, |
| 1149 | &he->max_nss_mcs[CMD_HE_MCS_BW160], |
| 1150 | le16_to_cpu(mcs_map.rx_mcs_160)); |
| 1151 | fallthrough; |
| 1152 | default: |
| 1153 | - mt7996_mcu_set_sta_he_mcs(sta, mconf, |
| 1154 | + mt7996_mcu_set_sta_he_mcs(link_sta, mconf, |
| 1155 | &he->max_nss_mcs[CMD_HE_MCS_BW80], |
| 1156 | le16_to_cpu(mcs_map.rx_mcs_80)); |
| 1157 | break; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1158 | @@ -1409,24 +1410,25 @@ mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1162 | -mt7996_mcu_sta_he_6g_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 1163 | +mt7996_mcu_sta_he_6g_tlv(struct sk_buff *skb, |
| 1164 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1165 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1166 | struct sta_rec_he_6g_capa *he_6g; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1167 | struct tlv *tlv; |
| 1168 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1169 | - if (!sta->deflink.he_6ghz_capa.capa) |
| 1170 | + if (!link_sta->he_6ghz_capa.capa) |
| 1171 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1172 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1173 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G, sizeof(*he_6g)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1174 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1175 | he_6g = (struct sta_rec_he_6g_capa *)tlv; |
| 1176 | - he_6g->capa = sta->deflink.he_6ghz_capa.capa; |
| 1177 | + he_6g->capa = link_sta->he_6ghz_capa.capa; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1178 | } |
| 1179 | |
| 1180 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1181 | -mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 1182 | +mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1183 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1184 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 1185 | + struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv; |
| 1186 | struct ieee80211_vif *vif = container_of((void *)msta->vif, |
| 1187 | struct ieee80211_vif, drv_priv); |
| 1188 | struct ieee80211_eht_mcs_nss_supp *mcs_map; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1189 | @@ -1434,11 +1436,11 @@ mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1190 | struct sta_rec_eht *eht; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1191 | struct tlv *tlv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1192 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1193 | - if (!sta->deflink.eht_cap.has_eht) |
| 1194 | + if (!link_sta->eht_cap.has_eht) |
| 1195 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1196 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1197 | - mcs_map = &sta->deflink.eht_cap.eht_mcs_nss_supp; |
| 1198 | - elem = &sta->deflink.eht_cap.eht_cap_elem; |
| 1199 | + mcs_map = &link_sta->eht_cap.eht_mcs_nss_supp; |
| 1200 | + elem = &link_sta->eht_cap.eht_cap_elem; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1201 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1202 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT, sizeof(*eht)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1203 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1204 | @@ -1449,7 +1451,7 @@ mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1205 | eht->phy_cap_ext = cpu_to_le64(elem->phy_cap_info[8]); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1206 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1207 | if (vif->type != NL80211_IFTYPE_STATION && |
| 1208 | - (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & |
| 1209 | + (link_sta->he_cap.he_cap_elem.phy_cap_info[0] & |
| 1210 | (IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G | |
| 1211 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | |
| 1212 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1213 | @@ -1465,44 +1467,44 @@ mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1214 | } |
| 1215 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1216 | static void |
| 1217 | -mt7996_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 1218 | +mt7996_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1219 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1220 | struct sta_rec_ht_uni *ht; |
| 1221 | struct tlv *tlv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1222 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1223 | - if (!sta->deflink.ht_cap.ht_supported) |
| 1224 | + if (!link_sta->ht_cap.ht_supported) |
| 1225 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1226 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1227 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1228 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1229 | ht = (struct sta_rec_ht_uni *)tlv; |
| 1230 | - ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap); |
| 1231 | - ht->ampdu_param = u8_encode_bits(sta->deflink.ht_cap.ampdu_factor, |
| 1232 | + ht->ht_cap = cpu_to_le16(link_sta->ht_cap.cap); |
| 1233 | + ht->ampdu_param = u8_encode_bits(link_sta->ht_cap.ampdu_factor, |
| 1234 | IEEE80211_HT_AMPDU_PARM_FACTOR) | |
| 1235 | - u8_encode_bits(sta->deflink.ht_cap.ampdu_density, |
| 1236 | + u8_encode_bits(link_sta->ht_cap.ampdu_density, |
| 1237 | IEEE80211_HT_AMPDU_PARM_DENSITY); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1238 | } |
| 1239 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1240 | static void |
| 1241 | -mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 1242 | +mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1243 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1244 | struct sta_rec_vht *vht; |
| 1245 | struct tlv *tlv; |
| 1246 | #ifdef CONFIG_MTK_VENDOR |
| 1247 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 1248 | + struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv; |
| 1249 | struct mt7996_phy *phy = (struct mt7996_phy *)msta->vif->deflink.phy; |
| 1250 | #endif |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1251 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1252 | /* For 6G band, this tlv is necessary to let hw work normally */ |
| 1253 | - if (!sta->deflink.he_6ghz_capa.capa && !sta->deflink.vht_cap.vht_supported) |
| 1254 | + if (!link_sta->he_6ghz_capa.capa && !link_sta->vht_cap.vht_supported) |
| 1255 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1256 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1257 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1258 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1259 | vht = (struct sta_rec_vht *)tlv; |
| 1260 | - vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); |
| 1261 | - vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; |
| 1262 | - vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; |
| 1263 | + vht->vht_cap = cpu_to_le32(link_sta->vht_cap.cap); |
| 1264 | + vht->vht_rx_mcs_map = link_sta->vht_cap.vht_mcs.rx_mcs_map; |
| 1265 | + vht->vht_tx_mcs_map = link_sta->vht_cap.vht_mcs.tx_mcs_map; |
| 1266 | #ifdef CONFIG_MTK_VENDOR |
| 1267 | vht->rts_bw_sig = phy->rts_bw_sig; |
| 1268 | #endif |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1269 | @@ -1510,9 +1512,10 @@ mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1270 | |
| 1271 | static void |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1272 | mt7996_mcu_sta_amsdu_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
| 1273 | - struct ieee80211_vif *vif, struct ieee80211_sta *sta) |
| 1274 | + struct ieee80211_vif *vif, |
| 1275 | + struct ieee80211_link_sta *link_sta, |
| 1276 | + struct mt7996_link_sta *mlink) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1277 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1278 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 1279 | struct sta_rec_amsdu *amsdu; |
| 1280 | struct tlv *tlv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1281 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1282 | @@ -1521,16 +1524,16 @@ mt7996_mcu_sta_amsdu_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1283 | vif->type != NL80211_IFTYPE_AP) |
| 1284 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1285 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1286 | - if (!sta->deflink.agg.max_amsdu_len) |
| 1287 | + if (!link_sta->agg.max_amsdu_len) |
| 1288 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1289 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1290 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu)); |
| 1291 | amsdu = (struct sta_rec_amsdu *)tlv; |
| 1292 | amsdu->max_amsdu_num = 8; |
| 1293 | amsdu->amsdu_en = true; |
| 1294 | - msta->wcid.amsdu = true; |
| 1295 | + mlink->wcid.amsdu = true; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1296 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1297 | - switch (sta->deflink.agg.max_amsdu_len) { |
| 1298 | + switch (link_sta->agg.max_amsdu_len) { |
| 1299 | case IEEE80211_MAX_MPDU_LEN_VHT_11454: |
| 1300 | amsdu->max_mpdu_size = |
| 1301 | IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1302 | @@ -1549,10 +1552,10 @@ static void |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1303 | mt7996_mcu_sta_muru_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1304 | struct ieee80211_bss_conf *conf, |
| 1305 | struct mt7996_bss_conf *mconf, |
| 1306 | - struct ieee80211_sta *sta) |
| 1307 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1308 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1309 | struct mt7996_phy *phy = mconf->phy; |
| 1310 | - struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
| 1311 | + struct ieee80211_he_cap_elem *elem = &link_sta->he_cap.he_cap_elem; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1312 | struct sta_rec_muru *muru; |
| 1313 | struct tlv *tlv; |
| 1314 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1315 | @@ -1572,11 +1575,11 @@ mt7996_mcu_sta_muru_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1316 | muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL); |
| 1317 | muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1318 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1319 | - if (sta->deflink.vht_cap.vht_supported) |
| 1320 | + if (link_sta->vht_cap.vht_supported) |
| 1321 | muru->mimo_dl.vht_mu_bfee = |
| 1322 | - !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
| 1323 | + !!(link_sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1324 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1325 | - if (!sta->deflink.he_cap.has_he) |
| 1326 | + if (!link_sta->he_cap.has_he) |
| 1327 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1328 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1329 | muru->mimo_dl.partial_bw_dl_mimo = |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1330 | @@ -1609,7 +1612,7 @@ mt7996_mcu_sta_muru_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1331 | static inline bool |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1332 | mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf, |
| 1333 | struct mt7996_bss_conf *mconf, |
| 1334 | - struct ieee80211_sta *sta, bool bfee) |
| 1335 | + struct ieee80211_link_sta *link_sta, bool bfee) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1336 | { |
| 1337 | int sts = hweight16(phy->mt76->chainmask); |
| 1338 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1339 | @@ -1620,8 +1623,8 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1340 | if (!bfee && sts < 2) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1341 | return false; |
| 1342 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1343 | - if (sta->deflink.eht_cap.has_eht) { |
| 1344 | - struct ieee80211_sta_eht_cap *pc = &sta->deflink.eht_cap; |
| 1345 | + if (link_sta->eht_cap.has_eht) { |
| 1346 | + struct ieee80211_sta_eht_cap *pc = &link_sta->eht_cap; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1347 | struct ieee80211_eht_cap_elem_fixed *pe = &pc->eht_cap_elem; |
| 1348 | |
| 1349 | if (bfee) |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1350 | @@ -1632,8 +1635,8 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf, |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1351 | EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1352 | } |
| 1353 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1354 | - if (sta->deflink.he_cap.has_he) { |
| 1355 | - struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; |
| 1356 | + if (link_sta->he_cap.has_he) { |
| 1357 | + struct ieee80211_he_cap_elem *pe = &link_sta->he_cap.he_cap_elem; |
| 1358 | |
| 1359 | if (bfee) |
| 1360 | return conf->he_su_beamformee && |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1361 | @@ -1643,8 +1646,8 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1362 | HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]); |
| 1363 | } |
| 1364 | |
| 1365 | - if (sta->deflink.vht_cap.vht_supported) { |
| 1366 | - u32 cap = sta->deflink.vht_cap.cap; |
| 1367 | + if (link_sta->vht_cap.vht_supported) { |
| 1368 | + u32 cap = link_sta->vht_cap.cap; |
| 1369 | |
| 1370 | if (bfee) |
| 1371 | return conf->vht_su_beamformee && |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1372 | @@ -1667,10 +1670,10 @@ mt7996_mcu_sta_sounding_rate(struct sta_rec_bf *bf) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | static void |
| 1376 | -mt7996_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7996_phy *phy, |
| 1377 | - struct sta_rec_bf *bf) |
| 1378 | +mt7996_mcu_sta_bfer_ht(struct ieee80211_link_sta *link_sta, |
| 1379 | + struct mt7996_phy *phy, struct sta_rec_bf *bf) |
| 1380 | { |
| 1381 | - struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs; |
| 1382 | + struct ieee80211_mcs_info *mcs = &link_sta->ht_cap.mcs; |
| 1383 | u8 n = 0; |
| 1384 | |
| 1385 | bf->tx_mode = MT_PHY_TYPE_HT; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1386 | @@ -1692,10 +1695,11 @@ mt7996_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | static void |
| 1390 | -mt7996_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7996_phy *phy, |
| 1391 | - struct sta_rec_bf *bf, bool explicit) |
| 1392 | +mt7996_mcu_sta_bfer_vht(struct ieee80211_link_sta *link_sta, |
| 1393 | + struct mt7996_phy *phy, struct sta_rec_bf *bf, |
| 1394 | + bool explicit) |
| 1395 | { |
| 1396 | - struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; |
| 1397 | + struct ieee80211_sta_vht_cap *pc = &link_sta->vht_cap; |
| 1398 | struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap; |
| 1399 | u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map); |
| 1400 | u8 nss_mcs = mt7996_mcu_get_sta_nss(mcs_map); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1401 | @@ -1716,23 +1720,24 @@ mt7996_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1402 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 1403 | bf->ibf_ncol = bf->ncol; |
| 1404 | |
| 1405 | - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 1406 | + if (link_sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 1407 | bf->nrow = 1; |
| 1408 | } else { |
| 1409 | bf->nrow = tx_ant; |
| 1410 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 1411 | bf->ibf_ncol = nss_mcs; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1412 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1413 | - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 1414 | + if (link_sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 1415 | bf->ibf_nrow = 1; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1416 | } |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1417 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1418 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1419 | static void |
| 1420 | -mt7996_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
| 1421 | - struct mt7996_phy *phy, struct sta_rec_bf *bf) |
| 1422 | +mt7996_mcu_sta_bfer_he(struct ieee80211_link_sta *link_sta, |
| 1423 | + struct ieee80211_vif *vif, struct mt7996_phy *phy, |
| 1424 | + struct sta_rec_bf *bf) |
| 1425 | { |
| 1426 | - struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap; |
| 1427 | + struct ieee80211_sta_he_cap *pc = &link_sta->he_cap; |
| 1428 | struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem; |
| 1429 | const struct ieee80211_sta_he_cap *vc = |
| 1430 | mt76_connac_get_he_phy_cap(phy->mt76, vif); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1431 | @@ -1757,7 +1762,7 @@ mt7996_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1432 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 1433 | bf->ibf_ncol = bf->ncol; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1434 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1435 | - if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160) |
| 1436 | + if (link_sta->bandwidth != IEEE80211_STA_RX_BW_160) |
| 1437 | return; |
| 1438 | |
| 1439 | /* go over for 160MHz and 80p80 */ |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1440 | @@ -1789,10 +1794,11 @@ mt7996_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1441 | } |
| 1442 | |
| 1443 | static void |
| 1444 | -mt7996_mcu_sta_bfer_eht(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
| 1445 | - struct mt7996_phy *phy, struct sta_rec_bf *bf) |
| 1446 | +mt7996_mcu_sta_bfer_eht(struct ieee80211_link_sta *link_sta, |
| 1447 | + struct ieee80211_vif *vif, struct mt7996_phy *phy, |
| 1448 | + struct sta_rec_bf *bf) |
| 1449 | { |
| 1450 | - struct ieee80211_sta_eht_cap *pc = &sta->deflink.eht_cap; |
| 1451 | + struct ieee80211_sta_eht_cap *pc = &link_sta->eht_cap; |
| 1452 | struct ieee80211_eht_cap_elem_fixed *pe = &pc->eht_cap_elem; |
| 1453 | struct ieee80211_eht_mcs_nss_supp *eht_nss = &pc->eht_mcs_nss_supp; |
| 1454 | const struct ieee80211_sta_eht_cap *vc = |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1455 | @@ -1815,10 +1821,10 @@ mt7996_mcu_sta_bfer_eht(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1456 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 1457 | bf->ibf_ncol = bf->ncol; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1458 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1459 | - if (sta->deflink.bandwidth < IEEE80211_STA_RX_BW_160) |
| 1460 | + if (link_sta->bandwidth < IEEE80211_STA_RX_BW_160) |
| 1461 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1462 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1463 | - switch (sta->deflink.bandwidth) { |
| 1464 | + switch (link_sta->bandwidth) { |
| 1465 | case IEEE80211_STA_RX_BW_160: |
| 1466 | snd_dim = EHT_PHY(CAP2_SOUNDING_DIM_160MHZ_MASK, ve->phy_cap_info[2]); |
| 1467 | sts = EHT_PHY(CAP1_BEAMFORMEE_SS_160MHZ_MASK, pe->phy_cap_info[1]); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1468 | @@ -1847,7 +1853,7 @@ mt7996_mcu_sta_bfer_eht(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1469 | static void |
| 1470 | mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1471 | struct ieee80211_bss_conf *conf, struct mt7996_bss_conf *mconf, |
| 1472 | - struct ieee80211_sta *sta) |
| 1473 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1474 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1475 | struct mt7996_phy *phy = mconf->phy; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1476 | int tx_ant = hweight16(phy->mt76->chainmask) - 1; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1477 | @@ -1861,10 +1867,10 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1478 | }; |
| 1479 | bool ebf; |
| 1480 | |
| 1481 | - if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) |
| 1482 | + if (!(link_sta->ht_cap.ht_supported || link_sta->he_cap.has_he)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1483 | return; |
| 1484 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1485 | - ebf = mt7996_is_ebf_supported(phy, conf, mconf, sta, false); |
| 1486 | + ebf = mt7996_is_ebf_supported(phy, conf, mconf, link_sta, false); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1487 | if (!ebf && !dev->ibf) |
| 1488 | return; |
| 1489 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1490 | @@ -1875,23 +1881,23 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1491 | * vht: support eBF and iBF |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1492 | * ht: iBF only, since mac80211 lacks of eBF support |
| 1493 | */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1494 | - if (sta->deflink.eht_cap.has_eht && ebf) |
| 1495 | - mt7996_mcu_sta_bfer_eht(sta, conf->vif, phy, bf); |
| 1496 | - else if (sta->deflink.he_cap.has_he && ebf) |
| 1497 | - mt7996_mcu_sta_bfer_he(sta, conf->vif, phy, bf); |
| 1498 | - else if (sta->deflink.vht_cap.vht_supported) |
| 1499 | - mt7996_mcu_sta_bfer_vht(sta, phy, bf, ebf); |
| 1500 | - else if (sta->deflink.ht_cap.ht_supported) |
| 1501 | - mt7996_mcu_sta_bfer_ht(sta, phy, bf); |
| 1502 | + if (link_sta->eht_cap.has_eht && ebf) |
| 1503 | + mt7996_mcu_sta_bfer_eht(link_sta, conf->vif, phy, bf); |
| 1504 | + else if (link_sta->he_cap.has_he && ebf) |
| 1505 | + mt7996_mcu_sta_bfer_he(link_sta, conf->vif, phy, bf); |
| 1506 | + else if (link_sta->vht_cap.vht_supported) |
| 1507 | + mt7996_mcu_sta_bfer_vht(link_sta, phy, bf, ebf); |
| 1508 | + else if (link_sta->ht_cap.ht_supported) |
| 1509 | + mt7996_mcu_sta_bfer_ht(link_sta, phy, bf); |
| 1510 | else |
| 1511 | return; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1512 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1513 | bf->bf_cap = ebf ? ebf : dev->ibf << 1; |
| 1514 | - bf->bw = sta->deflink.bandwidth; |
| 1515 | - bf->ibf_dbw = sta->deflink.bandwidth; |
| 1516 | + bf->bw = link_sta->bandwidth; |
| 1517 | + bf->ibf_dbw = link_sta->bandwidth; |
| 1518 | bf->ibf_nrow = tx_ant; |
| 1519 | |
| 1520 | - if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol) |
| 1521 | + if (!ebf && link_sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol) |
| 1522 | bf->ibf_timeout = 0x48; |
| 1523 | else |
| 1524 | bf->ibf_timeout = 0x18; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1525 | @@ -1901,7 +1907,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1526 | else |
| 1527 | bf->mem_20m = matrix[bf->nrow][bf->ncol]; |
| 1528 | |
| 1529 | - switch (sta->deflink.bandwidth) { |
| 1530 | + switch (link_sta->bandwidth) { |
| 1531 | case IEEE80211_STA_RX_BW_160: |
| 1532 | case IEEE80211_STA_RX_BW_80: |
| 1533 | bf->mem_total = bf->mem_20m * 2; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1534 | @@ -1918,7 +1924,8 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1535 | static void |
| 1536 | mt7996_mcu_sta_bfee_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1537 | struct ieee80211_bss_conf *conf, |
| 1538 | - struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta) |
| 1539 | + struct mt7996_bss_conf *mconf, |
| 1540 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1541 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1542 | struct mt7996_phy *phy = mconf->phy; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1543 | int tx_ant = hweight8(phy->mt76->antenna_mask) - 1; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1544 | @@ -1926,22 +1933,22 @@ mt7996_mcu_sta_bfee_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1545 | struct tlv *tlv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1546 | u8 nrow = 0; |
| 1547 | |
| 1548 | - if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he)) |
| 1549 | + if (!(link_sta->vht_cap.vht_supported || link_sta->he_cap.has_he)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1550 | return; |
| 1551 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1552 | - if (!mt7996_is_ebf_supported(phy, conf, mconf, sta, true)) |
| 1553 | + if (!mt7996_is_ebf_supported(phy, conf, mconf, link_sta, true)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1554 | return; |
| 1555 | |
| 1556 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee)); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1557 | bfee = (struct sta_rec_bfee *)tlv; |
| 1558 | |
| 1559 | - if (sta->deflink.he_cap.has_he) { |
| 1560 | - struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; |
| 1561 | + if (link_sta->he_cap.has_he) { |
| 1562 | + struct ieee80211_he_cap_elem *pe = &link_sta->he_cap.he_cap_elem; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1563 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1564 | nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK, |
| 1565 | pe->phy_cap_info[5]); |
| 1566 | - } else if (sta->deflink.vht_cap.vht_supported) { |
| 1567 | - struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; |
| 1568 | + } else if (link_sta->vht_cap.vht_supported) { |
| 1569 | + struct ieee80211_sta_vht_cap *pc = &link_sta->vht_cap; |
| 1570 | |
| 1571 | nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK, |
| 1572 | pc->cap); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1573 | @@ -1978,25 +1985,24 @@ mt7996_mcu_sta_hdrt_tlv(struct mt7996_dev *dev, struct sk_buff *skb) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1574 | static void |
| 1575 | mt7996_mcu_sta_hdr_trans_tlv(struct mt7996_dev *dev, struct sk_buff *skb, |
| 1576 | struct ieee80211_vif *vif, |
| 1577 | - struct ieee80211_sta *sta) |
| 1578 | + struct mt7996_link_sta *mlink) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1579 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1580 | struct sta_rec_hdr_trans *hdr_trans; |
| 1581 | - struct mt76_wcid *wcid; |
| 1582 | + struct mt76_wcid *wcid = &mlink->wcid; |
| 1583 | struct tlv *tlv; |
| 1584 | |
| 1585 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HDR_TRANS, sizeof(*hdr_trans)); |
| 1586 | hdr_trans = (struct sta_rec_hdr_trans *)tlv; |
| 1587 | hdr_trans->dis_rx_hdr_tran = true; |
| 1588 | |
| 1589 | + if (!wcid->sta) |
| 1590 | + return; |
| 1591 | + |
| 1592 | if (vif->type == NL80211_IFTYPE_STATION) |
| 1593 | hdr_trans->to_ds = true; |
| 1594 | else |
| 1595 | hdr_trans->from_ds = true; |
| 1596 | |
| 1597 | - if (!sta) |
| 1598 | - return; |
| 1599 | - |
| 1600 | - wcid = (struct mt76_wcid *)sta->drv_priv; |
| 1601 | hdr_trans->dis_rx_hdr_tran = !test_bit(MT_WCID_FLAG_HDR_TRANS, &wcid->flags); |
| 1602 | if (test_bit(MT_WCID_FLAG_4ADDR, &wcid->flags)) { |
| 1603 | hdr_trans->to_ds = true; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1604 | @@ -2053,16 +2059,17 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1605 | |
| 1606 | int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, |
| 1607 | struct mt7996_bss_conf *mconf, |
| 1608 | - struct ieee80211_sta *sta, void *data, u32 field) |
| 1609 | + struct ieee80211_link_sta *link_sta, |
| 1610 | + struct mt7996_link_sta *mlink, void *data, |
| 1611 | + u32 field) |
| 1612 | { |
| 1613 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1614 | struct sta_phy_uni *phy = data; |
| 1615 | struct sta_rec_ra_fixed_uni *ra; |
| 1616 | struct sk_buff *skb; |
| 1617 | struct tlv *tlv; |
| 1618 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1619 | skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, |
| 1620 | - &msta->wcid, |
| 1621 | + &mlink->wcid, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1622 | MT7996_STA_UPDATE_MAX_SIZE); |
| 1623 | if (IS_ERR(skb)) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1624 | return PTR_ERR(skb); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1625 | @@ -2081,7 +2088,7 @@ int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1626 | ra->phy = *phy; |
| 1627 | break; |
| 1628 | case RATE_PARAM_MMPS_UPDATE: |
| 1629 | - ra->mmps_mode = mt7996_mcu_get_mmps_mode(sta->deflink.smps_mode); |
| 1630 | + ra->mmps_mode = mt7996_mcu_get_mmps_mode(link_sta->smps_mode); |
| 1631 | break; |
| 1632 | default: |
| 1633 | break; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1634 | @@ -2096,7 +2103,8 @@ static int |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1635 | mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, |
| 1636 | struct ieee80211_bss_conf *conf, |
| 1637 | struct mt7996_bss_conf *mconf, |
| 1638 | - struct ieee80211_sta *sta) |
| 1639 | + struct ieee80211_link_sta *link_sta, |
| 1640 | + struct mt7996_link_sta *mlink) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1641 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1642 | struct cfg80211_chan_def *chandef = &mconf->phy->mt76->chandef; |
| 1643 | struct cfg80211_bitrate_mask *mask = &mconf->bitrate_mask; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1644 | @@ -2120,11 +2128,11 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1645 | } \ |
| 1646 | } while (0) |
| 1647 | |
| 1648 | - if (sta->deflink.he_cap.has_he) { |
| 1649 | + if (link_sta->he_cap.has_he) { |
| 1650 | __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); |
| 1651 | - } else if (sta->deflink.vht_cap.vht_supported) { |
| 1652 | + } else if (link_sta->vht_cap.vht_supported) { |
| 1653 | __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); |
| 1654 | - } else if (sta->deflink.ht_cap.ht_supported) { |
| 1655 | + } else if (link_sta->ht_cap.ht_supported) { |
| 1656 | __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); |
| 1657 | } else { |
| 1658 | nrates = hweight32(mask->control[band].legacy); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1659 | @@ -2141,8 +2149,8 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1660 | |
| 1661 | /* fixed single rate */ |
| 1662 | if (nrates == 1) { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1663 | - ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy, |
| 1664 | - RATE_PARAM_FIXED_MCS); |
| 1665 | + ret = mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, |
| 1666 | + &phy, RATE_PARAM_FIXED_MCS); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1667 | if (ret) |
| 1668 | return ret; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1669 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1670 | @@ -2150,29 +2158,28 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1671 | /* fixed GI */ |
| 1672 | if (mask->control[band].gi != NL80211_TXRATE_DEFAULT_GI || |
| 1673 | mask->control[band].he_gi != GENMASK(7, 0)) { |
| 1674 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 1675 | u32 addr; |
| 1676 | |
| 1677 | /* firmware updates only TXCMD but doesn't take WTBL into |
| 1678 | * account, so driver should update here to reflect the |
| 1679 | * actual txrate hardware sends out. |
| 1680 | */ |
| 1681 | - addr = mt7996_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7); |
| 1682 | - if (sta->deflink.he_cap.has_he) |
| 1683 | + addr = mt7996_mac_wtbl_lmac_addr(dev, mlink->wcid.idx, 7); |
| 1684 | + if (link_sta->he_cap.has_he) |
| 1685 | mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1686 | else |
| 1687 | mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi); |
| 1688 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1689 | - ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy, |
| 1690 | - RATE_PARAM_FIXED_GI); |
| 1691 | + ret = mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, |
| 1692 | + &phy, RATE_PARAM_FIXED_GI); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1693 | if (ret) |
| 1694 | return ret; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1695 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1696 | |
| 1697 | /* fixed HE_LTF */ |
| 1698 | if (mask->control[band].he_ltf != GENMASK(7, 0)) { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1699 | - ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy, |
| 1700 | - RATE_PARAM_FIXED_HE_LTF); |
| 1701 | + ret = mt7996_mcu_set_fixed_field(dev, mconf, link_sta, mlink, |
| 1702 | + &phy, RATE_PARAM_FIXED_HE_LTF); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1703 | if (ret) |
| 1704 | return ret; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1705 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1706 | @@ -2184,7 +2191,7 @@ static void |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1707 | mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1708 | struct ieee80211_bss_conf *conf, |
| 1709 | struct mt7996_bss_conf *mconf, |
| 1710 | - struct ieee80211_sta *sta) |
| 1711 | + struct ieee80211_link_sta *link_sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1712 | { |
| 1713 | #define INIT_RCPI 180 |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1714 | struct mt76_phy *mphy = mconf->phy->mt76; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1715 | @@ -2193,20 +2200,20 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1716 | enum nl80211_band band = chandef->chan->band; |
| 1717 | struct sta_rec_ra_uni *ra; |
| 1718 | struct tlv *tlv; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1719 | - u32 supp_rate = sta->deflink.supp_rates[band]; |
| 1720 | - u32 cap = sta->wme ? STA_CAP_WMM : 0; |
| 1721 | + u32 supp_rate = link_sta->supp_rates[band]; |
| 1722 | + u32 cap = link_sta->sta->wme ? STA_CAP_WMM : 0; |
| 1723 | |
| 1724 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra)); |
| 1725 | ra = (struct sta_rec_ra_uni *)tlv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1726 | |
| 1727 | ra->valid = true; |
| 1728 | ra->auto_rate = true; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1729 | - ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, &sta->deflink); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1730 | + ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1731 | ra->channel = chandef->chan->hw_value; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1732 | - ra->bw = (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_320) ? |
| 1733 | - CMD_CBW_320MHZ : sta->deflink.bandwidth; |
| 1734 | + ra->bw = (link_sta->bandwidth == IEEE80211_STA_RX_BW_320) ? |
| 1735 | + CMD_CBW_320MHZ : link_sta->bandwidth; |
| 1736 | ra->phy.bw = ra->bw; |
| 1737 | - ra->mmps_mode = mt7996_mcu_get_mmps_mode(sta->deflink.smps_mode); |
| 1738 | + ra->mmps_mode = mt7996_mcu_get_mmps_mode(link_sta->smps_mode); |
| 1739 | |
| 1740 | if (supp_rate) { |
| 1741 | supp_rate &= mask->control[band].legacy; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1742 | @@ -2226,60 +2233,60 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1743 | } |
| 1744 | } |
| 1745 | |
| 1746 | - if (sta->deflink.ht_cap.ht_supported) { |
| 1747 | + if (link_sta->ht_cap.ht_supported) { |
| 1748 | ra->supp_mode |= MODE_HT; |
| 1749 | - ra->af = sta->deflink.ht_cap.ampdu_factor; |
| 1750 | - ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); |
| 1751 | + ra->af = link_sta->ht_cap.ampdu_factor; |
| 1752 | + ra->ht_gf = !!(link_sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); |
| 1753 | |
| 1754 | cap |= STA_CAP_HT; |
| 1755 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 1756 | + if (link_sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 1757 | cap |= STA_CAP_SGI_20; |
| 1758 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 1759 | + if (link_sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 1760 | cap |= STA_CAP_SGI_40; |
| 1761 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) |
| 1762 | + if (link_sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1763 | cap |= STA_CAP_TX_STBC; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1764 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) |
| 1765 | + if (link_sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1766 | cap |= STA_CAP_RX_STBC; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1767 | if (conf->ht_ldpc && |
| 1768 | - (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) |
| 1769 | + (link_sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1770 | cap |= STA_CAP_LDPC; |
| 1771 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1772 | - mt7996_mcu_set_sta_ht_mcs(sta, ra->ht_mcs, |
| 1773 | + mt7996_mcu_set_sta_ht_mcs(link_sta, ra->ht_mcs, |
| 1774 | mask->control[band].ht_mcs); |
| 1775 | ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs; |
| 1776 | } |
| 1777 | |
| 1778 | - if (sta->deflink.vht_cap.vht_supported) { |
| 1779 | + if (link_sta->vht_cap.vht_supported) { |
| 1780 | u8 af; |
| 1781 | |
| 1782 | ra->supp_mode |= MODE_VHT; |
| 1783 | af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, |
| 1784 | - sta->deflink.vht_cap.cap); |
| 1785 | + link_sta->vht_cap.cap); |
| 1786 | ra->af = max_t(u8, ra->af, af); |
| 1787 | |
| 1788 | cap |= STA_CAP_VHT; |
| 1789 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 1790 | + if (link_sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 1791 | cap |= STA_CAP_VHT_SGI_80; |
| 1792 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 1793 | + if (link_sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 1794 | cap |= STA_CAP_VHT_SGI_160; |
| 1795 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC) |
| 1796 | + if (link_sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1797 | cap |= STA_CAP_VHT_TX_STBC; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1798 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) |
| 1799 | + if (link_sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1800 | cap |= STA_CAP_VHT_RX_STBC; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1801 | if (conf->vht_ldpc && |
| 1802 | - (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) |
| 1803 | + (link_sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1804 | cap |= STA_CAP_VHT_LDPC; |
| 1805 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1806 | - mt7996_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs, |
| 1807 | + mt7996_mcu_set_sta_vht_mcs(link_sta, ra->supp_vht_mcs, |
| 1808 | mask->control[band].vht_mcs); |
| 1809 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1810 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1811 | - if (sta->deflink.he_cap.has_he) { |
| 1812 | + if (link_sta->he_cap.has_he) { |
| 1813 | ra->supp_mode |= MODE_HE; |
| 1814 | cap |= STA_CAP_HE; |
| 1815 | |
| 1816 | - if (sta->deflink.he_6ghz_capa.capa) |
| 1817 | - ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa, |
| 1818 | + if (link_sta->he_6ghz_capa.capa) |
| 1819 | + ra->af = le16_get_bits(link_sta->he_6ghz_capa.capa, |
| 1820 | IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP); |
| 1821 | } |
| 1822 | ra->sta_cap = cpu_to_le32(cap); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1823 | @@ -2290,14 +2297,14 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1824 | int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, |
| 1825 | struct ieee80211_bss_conf *conf, |
| 1826 | struct mt7996_bss_conf *mconf, |
| 1827 | - struct ieee80211_sta *sta, bool changed) |
| 1828 | + struct ieee80211_link_sta *link_sta, |
| 1829 | + struct mt7996_link_sta *mlink, bool changed) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1830 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1831 | - struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1832 | struct sk_buff *skb; |
| 1833 | int ret; |
| 1834 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1835 | skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, |
| 1836 | - &msta->wcid, |
| 1837 | + &mlink->wcid, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1838 | MT7996_STA_UPDATE_MAX_SIZE); |
| 1839 | if (IS_ERR(skb)) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1840 | return PTR_ERR(skb); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1841 | @@ -2307,26 +2314,27 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1842 | * update sta_rec_he here. |
| 1843 | */ |
| 1844 | if (changed) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1845 | - mt7996_mcu_sta_he_tlv(skb, conf, mconf, sta); |
| 1846 | + mt7996_mcu_sta_he_tlv(skb, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1847 | |
| 1848 | /* sta_rec_ra accommodates BW, NSS and only MCS range format |
| 1849 | * i.e 0-{7,8,9} for VHT. |
| 1850 | */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1851 | - mt7996_mcu_sta_rate_ctrl_tlv(skb, dev, conf, mconf, sta); |
| 1852 | + mt7996_mcu_sta_rate_ctrl_tlv(skb, dev, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1853 | |
| 1854 | ret = mt76_mcu_skb_send_msg(&dev->mt76, skb, |
| 1855 | MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true); |
| 1856 | if (ret) |
| 1857 | return ret; |
| 1858 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1859 | - return mt7996_mcu_add_rate_ctrl_fixed(dev, conf, mconf, sta); |
| 1860 | + return mt7996_mcu_add_rate_ctrl_fixed(dev, conf, mconf, link_sta, mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1861 | } |
| 1862 | |
| 1863 | static int |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1864 | -mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, struct mt7996_sta *msta) |
| 1865 | +mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, |
| 1866 | + struct mt7996_link_sta *mlink) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1867 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1868 | struct mt7996_phy *phy = mconf->phy; |
| 1869 | - struct mt7996_vow_sta_ctrl *vow = &msta->vow; |
| 1870 | + struct mt7996_vow_sta_ctrl *vow = &mlink->vow; |
| 1871 | u8 omac_idx = mconf->mt76.omac_idx; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1872 | int ret; |
| 1873 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1874 | @@ -2344,34 +2352,29 @@ mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, struct mt7996_sta *msta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1875 | vow->drr_quantum[IEEE80211_AC_BE] = VOW_DRR_QUANTUM_IDX2; |
| 1876 | vow->drr_quantum[IEEE80211_AC_BK] = VOW_DRR_QUANTUM_IDX2; |
| 1877 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1878 | - ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_BSS_GROUP); |
| 1879 | + ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, mlink, VOW_DRR_CTRL_STA_BSS_GROUP); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1880 | if (ret) |
| 1881 | return ret; |
| 1882 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1883 | - ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_PAUSE); |
| 1884 | + ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, mlink, VOW_DRR_CTRL_STA_PAUSE); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1885 | if (ret) |
| 1886 | return ret; |
| 1887 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1888 | - return mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_ALL); |
| 1889 | + return mt7996_mcu_set_vow_drr_ctrl(phy, mconf, mlink, VOW_DRR_CTRL_STA_ALL); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1890 | } |
| 1891 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1892 | int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf, |
| 1893 | - struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta, |
| 1894 | - bool enable, bool newly) |
| 1895 | + struct mt7996_bss_conf *mconf, |
| 1896 | + struct ieee80211_link_sta *link_sta, |
| 1897 | + struct mt7996_link_sta *mlink, bool enable, bool newly) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1898 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1899 | struct ieee80211_vif *vif = conf->vif; |
| 1900 | - struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1901 | - struct ieee80211_link_sta *link_sta; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1902 | - struct mt7996_sta *msta; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1903 | struct sk_buff *skb; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1904 | int conn_state; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1905 | int ret; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1906 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1907 | - msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta; |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1908 | - link_sta = sta ? &sta->deflink : NULL; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1909 | - |
| 1910 | skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, |
| 1911 | - &msta->wcid, |
| 1912 | + &mlink->wcid, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1913 | MT7996_STA_UPDATE_MAX_SIZE); |
| 1914 | if (IS_ERR(skb)) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1915 | return PTR_ERR(skb); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1916 | @@ -2385,37 +2388,37 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1917 | goto out; |
| 1918 | |
| 1919 | /* starec hdr trans */ |
| 1920 | - mt7996_mcu_sta_hdr_trans_tlv(dev, skb, vif, sta); |
| 1921 | + mt7996_mcu_sta_hdr_trans_tlv(dev, skb, vif, mlink); |
| 1922 | /* starec tx proc */ |
| 1923 | mt7996_mcu_sta_tx_proc_tlv(skb); |
| 1924 | |
| 1925 | /* tag order is in accordance with firmware dependency. */ |
| 1926 | - if (sta) { |
| 1927 | + if (link_sta) { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1928 | /* starec hdrt mode */ |
| 1929 | mt7996_mcu_sta_hdrt_tlv(dev, skb); |
| 1930 | /* starec bfer */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1931 | - mt7996_mcu_sta_bfer_tlv(dev, skb, conf, mconf, sta); |
| 1932 | + mt7996_mcu_sta_bfer_tlv(dev, skb, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1933 | /* starec ht */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1934 | - mt7996_mcu_sta_ht_tlv(skb, sta); |
| 1935 | + mt7996_mcu_sta_ht_tlv(skb, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1936 | /* starec vht */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1937 | - mt7996_mcu_sta_vht_tlv(skb, sta); |
| 1938 | + mt7996_mcu_sta_vht_tlv(skb, link_sta); |
| 1939 | /* starec uapsd */ |
| 1940 | - mt76_connac_mcu_sta_uapsd(skb, vif, sta); |
| 1941 | + mt76_connac_mcu_sta_uapsd(skb, vif, link_sta->sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1942 | /* starec amsdu */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1943 | - mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, sta); |
| 1944 | + mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, link_sta, mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1945 | /* starec he */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1946 | - mt7996_mcu_sta_he_tlv(skb, conf, mconf, sta); |
| 1947 | + mt7996_mcu_sta_he_tlv(skb, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1948 | /* starec he 6g*/ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1949 | - mt7996_mcu_sta_he_6g_tlv(skb, sta); |
| 1950 | + mt7996_mcu_sta_he_6g_tlv(skb, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1951 | /* starec eht */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1952 | - mt7996_mcu_sta_eht_tlv(skb, sta); |
| 1953 | + mt7996_mcu_sta_eht_tlv(skb, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1954 | /* starec muru */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1955 | - mt7996_mcu_sta_muru_tlv(dev, skb, conf, mconf, sta); |
| 1956 | + mt7996_mcu_sta_muru_tlv(dev, skb, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1957 | /* starec bfee */ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1958 | - mt7996_mcu_sta_bfee_tlv(dev, skb, conf, mconf, sta); |
| 1959 | + mt7996_mcu_sta_bfee_tlv(dev, skb, conf, mconf, link_sta); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1960 | } |
| 1961 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1962 | - ret = mt7996_mcu_sta_init_vow(mconf, msta); |
| 1963 | + ret = mt7996_mcu_sta_init_vow(mconf, mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1964 | if (ret) { |
| 1965 | dev_kfree_skb(skb); |
| 1966 | return ret; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1967 | @@ -2491,16 +2494,16 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1968 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1969 | static int mt7996_mcu_get_pn(struct mt7996_dev *dev, |
| 1970 | struct ieee80211_bss_conf *conf, |
| 1971 | - struct mt7996_bss_conf *mconf, u8 *pn) |
| 1972 | + struct mt7996_bss_conf *mconf, |
| 1973 | + struct mt7996_link_sta *mlink, u8 *pn) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1974 | { |
| 1975 | #define TSC_TYPE_BIGTK_PN 2 |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1976 | - struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1977 | struct sta_rec_pn_info *pn_info; |
| 1978 | struct sk_buff *skb, *rskb; |
| 1979 | struct tlv *tlv; |
| 1980 | int ret; |
| 1981 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1982 | - skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, &mvif->sta.wcid); |
| 1983 | + skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, &mlink->wcid); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1984 | if (IS_ERR(skb)) |
| 1985 | return PTR_ERR(skb); |
| 1986 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1987 | @@ -2527,6 +2530,7 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1988 | int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, |
| 1989 | struct ieee80211_bss_conf *conf, |
| 1990 | struct mt7996_bss_conf *mconf, |
| 1991 | + struct mt7996_link_sta *mlink, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1992 | struct ieee80211_key_conf *key) |
| 1993 | { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1994 | struct mt7996_mcu_bcn_prot_tlv *bcn_prot; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1995 | @@ -2545,7 +2549,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1996 | |
| 1997 | bcn_prot = (struct mt7996_mcu_bcn_prot_tlv *)tlv; |
| 1998 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1999 | - ret = mt7996_mcu_get_pn(dev, conf, mconf, pn); |
| 2000 | + ret = mt7996_mcu_get_pn(dev, conf, mconf, mlink, pn); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2001 | if (ret) { |
| 2002 | dev_kfree_skb(skb); |
| 2003 | return ret; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2004 | @@ -4840,21 +4844,18 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2005 | int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev, |
| 2006 | struct ieee80211_vif *vif, |
| 2007 | struct mt7996_bss_conf *mconf, |
| 2008 | - struct ieee80211_sta *sta) |
| 2009 | + struct mt7996_link_sta *mlink) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2010 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2011 | - struct mt7996_sta *msta; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2012 | struct sk_buff *skb; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2013 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2014 | - msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mconf->vif->sta; |
| 2015 | - |
| 2016 | skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, |
| 2017 | - &msta->wcid, |
| 2018 | + &mlink->wcid, |
| 2019 | MT7996_STA_UPDATE_MAX_SIZE); |
| 2020 | if (IS_ERR(skb)) |
| 2021 | return PTR_ERR(skb); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2022 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2023 | /* starec hdr trans */ |
| 2024 | - mt7996_mcu_sta_hdr_trans_tlv(dev, skb, vif, sta); |
| 2025 | + mt7996_mcu_sta_hdr_trans_tlv(dev, skb, vif, mlink); |
| 2026 | return mt76_mcu_skb_send_msg(&dev->mt76, skb, |
| 2027 | MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2028 | } |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2029 | @@ -5043,7 +5044,7 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2030 | switch (tag) { |
| 2031 | case UNI_PER_STA_RSSI: |
| 2032 | for (i = 0; i < sta_num; ++i) { |
| 2033 | - struct mt7996_sta *msta; |
| 2034 | + struct mt7996_link_sta *mlink; |
| 2035 | struct mt76_phy *phy; |
| 2036 | s8 rssi[4]; |
| 2037 | u8 *rcpi; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2038 | @@ -5057,10 +5058,10 @@ int mt7996_mcu_get_per_sta_info(struct mt76_dev *dev, u16 tag, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2039 | rssi[2] = to_rssi(MT_PRXV_RCPI0, rcpi[2]); |
| 2040 | rssi[3] = to_rssi(MT_PRXV_RCPI0, rcpi[3]); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2041 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2042 | - msta = container_of(wcid, struct mt7996_sta, wcid); |
| 2043 | - phy = msta->vif->phy->mt76; |
| 2044 | - msta->ack_signal = mt76_rx_signal(phy->antenna_mask, rssi); |
| 2045 | - ewma_avg_signal_add(&msta->avg_ack_signal, -msta->ack_signal); |
| 2046 | + mlink = container_of(wcid, struct mt7996_link_sta, wcid); |
| 2047 | + phy = mlink->sta->vif->deflink.phy->mt76; |
| 2048 | + mlink->ack_signal = mt76_rx_signal(phy->antenna_mask, rssi); |
| 2049 | + ewma_avg_signal_add(&mlink->avg_ack_signal, -mlink->ack_signal); |
| 2050 | } else { |
| 2051 | ret = -EINVAL; |
| 2052 | dev_err(dev->dev, "Failed to update RSSI for " |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2053 | @@ -5082,7 +5083,7 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2054 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2055 | u16 sta_list[PER_STA_INFO_MAX_NUM]; |
| 2056 | LIST_HEAD(sta_poll_list); |
| 2057 | - struct mt7996_sta *msta; |
| 2058 | + struct mt7996_link_sta *mlink; |
| 2059 | int i, ret; |
| 2060 | bool empty = false; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2061 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2062 | @@ -5102,13 +5103,13 @@ int mt7996_mcu_get_rssi(struct mt76_dev *dev) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2063 | empty = true; |
| 2064 | break; |
| 2065 | } |
| 2066 | - msta = list_first_entry(&sta_poll_list, |
| 2067 | - struct mt7996_sta, |
| 2068 | + mlink = list_first_entry(&sta_poll_list, |
| 2069 | + struct mt7996_link_sta, |
| 2070 | wcid.poll_list); |
| 2071 | - list_del_init(&msta->wcid.poll_list); |
| 2072 | + list_del_init(&mlink->wcid.poll_list); |
| 2073 | spin_unlock_bh(&dev->sta_poll_lock); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2074 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2075 | - sta_list[i] = msta->wcid.idx; |
| 2076 | + sta_list[i] = mlink->wcid.idx; |
| 2077 | } |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2078 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2079 | ret = mt7996_mcu_get_per_sta_info(dev, UNI_PER_STA_RSSI, |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2080 | @@ -5398,10 +5399,18 @@ int mt7996_mcu_set_scs_stats(struct mt7996_phy *phy) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2081 | void mt7996_sta_rssi_work(void *data, struct ieee80211_sta *sta) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2082 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2083 | struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; |
| 2084 | + struct mt7996_link_sta *mlink; |
| 2085 | struct mt7996_phy *poll_phy = (struct mt7996_phy *) data; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2086 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2087 | - if (poll_phy->scs_ctrl.sta_min_rssi > msta->ack_signal) |
| 2088 | - poll_phy->scs_ctrl.sta_min_rssi = msta->ack_signal; |
| 2089 | + mutex_lock(&poll_phy->dev->mt76.mutex); |
| 2090 | + mlink = mlink_dereference_protected(msta, 0); |
| 2091 | + if (!mlink) |
| 2092 | + goto out; |
| 2093 | + |
| 2094 | + if (poll_phy->scs_ctrl.sta_min_rssi > mlink->ack_signal) |
| 2095 | + poll_phy->scs_ctrl.sta_min_rssi = mlink->ack_signal; |
| 2096 | +out: |
| 2097 | + mutex_unlock(&poll_phy->dev->mt76.mutex); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2098 | } |
| 2099 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2100 | void mt7996_mcu_scs_sta_poll(struct work_struct *work) |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2101 | @@ -5477,9 +5486,10 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2102 | |
| 2103 | int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, |
| 2104 | struct mt7996_bss_conf *mconf, |
| 2105 | - struct mt7996_sta *msta, enum vow_drr_ctrl_id id) |
| 2106 | + struct mt7996_link_sta *mlink, |
| 2107 | + enum vow_drr_ctrl_id id) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2108 | { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2109 | - struct mt7996_vow_sta_ctrl *vow = msta ? &msta->vow : NULL; |
| 2110 | + struct mt7996_vow_sta_ctrl *vow = mlink ? &mlink->vow : NULL; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2111 | u32 val = 0; |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2112 | struct { |
| 2113 | u8 __rsv1[4]; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2114 | @@ -5501,11 +5511,11 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2115 | } __packed req = { |
| 2116 | .tag = cpu_to_le16(UNI_VOW_DRR_CTRL), |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2117 | .len = cpu_to_le16(sizeof(req) - 4), |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2118 | - .wlan_idx = cpu_to_le16(msta ? msta->wcid.idx : 0), |
| 2119 | + .wlan_idx = cpu_to_le16(mlink ? mlink->wcid.idx : 0), |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2120 | .band_idx = phy->mt76->band_idx, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2121 | - .wmm_idx = msta ? mconf->mt76.wmm_idx : 0, |
| 2122 | + .wmm_idx = mlink ? mconf->mt76.wmm_idx : 0, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2123 | .ctrl_id = cpu_to_le32(id), |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2124 | - .omac_idx = msta ? mconf->mt76.omac_idx : 0 |
| 2125 | + .omac_idx = mlink ? mconf->mt76.omac_idx : 0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2126 | }; |
| 2127 | |
| 2128 | switch (id) { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2129 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2130 | index be966c18..d86e24e3 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2131 | --- a/mt7996/mt7996.h |
| 2132 | +++ b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2133 | @@ -304,10 +304,10 @@ struct mt7996_vow_sta_ctrl { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2134 | u8 drr_quantum[IEEE80211_NUM_ACS]; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2135 | }; |
| 2136 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2137 | -struct mt7996_sta { |
| 2138 | +struct mt7996_link_sta { |
| 2139 | struct mt76_wcid wcid; /* must be first */ |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2140 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2141 | - struct mt7996_vif *vif; |
| 2142 | + struct mt7996_sta *sta; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2143 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2144 | struct list_head rc_list; |
| 2145 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2146 | @@ -326,6 +326,13 @@ struct mt7996_sta { |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2147 | struct mt7996_vow_sta_ctrl vow; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2148 | }; |
| 2149 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2150 | +struct mt7996_sta { |
| 2151 | + struct mt7996_link_sta deflink; |
| 2152 | + struct mt7996_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2153 | + |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2154 | + struct mt7996_vif *vif; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2155 | +}; |
| 2156 | + |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2157 | struct mt7996_bss_conf { |
| 2158 | struct mt76_vif mt76; /* must be first */ |
| 2159 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2160 | @@ -788,6 +795,13 @@ mconf_dereference_protected(struct mt7996_vif *mvif, u8 link_id) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2161 | lockdep_is_held(&mvif->dev->mt76.mutex)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2162 | } |
| 2163 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2164 | +static inline struct mt7996_link_sta * |
| 2165 | +mlink_dereference_protected(struct mt7996_sta *msta, u8 link_id) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2166 | +{ |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2167 | + return rcu_dereference_protected(msta->link[link_id], |
| 2168 | + lockdep_is_held(&msta->vif->dev->mt76.mutex)); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2169 | +} |
| 2170 | + |
| 2171 | extern const struct ieee80211_ops mt7996_ops; |
| 2172 | extern struct pci_driver mt7996_pci_driver; |
| 2173 | extern struct pci_driver mt7996_hif_driver; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2174 | @@ -832,10 +846,12 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2175 | struct mt7996_bss_conf *mconf, bool enable); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2176 | int mt7996_mcu_add_bss_info(struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2177 | struct ieee80211_bss_conf *conf, |
| 2178 | - struct mt7996_bss_conf *mconf, int enable); |
| 2179 | + struct mt7996_bss_conf *mconf, |
| 2180 | + struct mt7996_link_sta *mlink, int enable); |
| 2181 | int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf, |
| 2182 | - struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta, |
| 2183 | - bool enable, bool newly); |
| 2184 | + struct mt7996_bss_conf *mconf, |
| 2185 | + struct ieee80211_link_sta *link_sta, |
| 2186 | + struct mt7996_link_sta *mlink, bool enable, bool newly); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2187 | int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev, |
| 2188 | struct ieee80211_ampdu_params *params, |
| 2189 | bool add); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2190 | @@ -857,7 +873,8 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2191 | int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, |
| 2192 | struct ieee80211_bss_conf *conf, |
| 2193 | struct mt7996_bss_conf *mconf, |
| 2194 | - struct ieee80211_sta *sta, bool changed); |
| 2195 | + struct ieee80211_link_sta *link_sta, |
| 2196 | + struct mt7996_link_sta *mlink, bool changed); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2197 | int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef); |
| 2198 | int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2199 | int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2200 | @@ -865,7 +882,9 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2201 | void *data, u16 version); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2202 | int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, |
| 2203 | struct mt7996_bss_conf *mconf, |
| 2204 | - struct ieee80211_sta *sta, void *data, u32 field); |
| 2205 | + struct ieee80211_link_sta *link_sta, |
| 2206 | + struct mt7996_link_sta *mlink, void *data, |
| 2207 | + u32 field); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2208 | int mt7996_mcu_set_eeprom(struct mt7996_dev *dev); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2209 | int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *buf, u32 buf_len); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2210 | int mt7996_mcu_get_eeprom_free_block(struct mt7996_dev *dev, u8 *block_num); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2211 | @@ -921,7 +940,8 @@ void mt7996_mcu_scs_sta_poll(struct work_struct *work); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2212 | int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2213 | int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, |
| 2214 | struct mt7996_bss_conf *mconf, |
| 2215 | - struct mt7996_sta *msta, enum vow_drr_ctrl_id id); |
| 2216 | + struct mt7996_link_sta *mlink, |
| 2217 | + enum vow_drr_ctrl_id id); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2218 | int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy); |
| 2219 | void mt7996_mcu_wmm_pbc_work(struct work_struct *work); |
| 2220 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2221 | @@ -988,7 +1008,7 @@ void mt7996_mac_reset_counters(struct mt7996_phy *phy); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2222 | void mt7996_mac_cca_stats_reset(struct mt7996_phy *phy); |
| 2223 | void mt7996_mac_enable_nf(struct mt7996_dev *dev, u8 band); |
| 2224 | void mt7996_mac_enable_rtscts(struct mt7996_dev *dev, |
| 2225 | - struct ieee80211_vif *vif, bool enable); |
| 2226 | + struct mt7996_link_sta *mlink, bool enable); |
| 2227 | void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, |
| 2228 | struct sk_buff *skb, struct mt76_wcid *wcid, |
| 2229 | struct ieee80211_key_conf *key, int pid, |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2230 | @@ -1006,8 +1026,7 @@ void mt7996_mac_dump_work(struct work_struct *work); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2231 | void mt7996_mac_sta_rc_work(struct work_struct *work); |
| 2232 | void mt7996_mac_update_stats(struct mt7996_phy *phy); |
| 2233 | void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev, |
| 2234 | - struct mt7996_sta *msta, |
| 2235 | - u8 flowid); |
| 2236 | + struct mt7996_link_sta *mlink, u8 flowid); |
| 2237 | void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw, |
| 2238 | struct ieee80211_sta *sta, |
| 2239 | struct ieee80211_twt_setup *twt); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2240 | @@ -1036,11 +1055,12 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2241 | int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, |
| 2242 | struct ieee80211_bss_conf *conf, |
| 2243 | struct mt7996_bss_conf *mconf, |
| 2244 | + struct mt7996_link_sta *mlink, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2245 | struct ieee80211_key_conf *key); |
| 2246 | int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev, |
| 2247 | struct ieee80211_vif *vif, |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2248 | struct mt7996_bss_conf *mconf, |
| 2249 | - struct ieee80211_sta *sta); |
| 2250 | + struct mt7996_link_sta *mlink); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2251 | int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode); |
| 2252 | int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2253 | #ifdef CONFIG_MAC80211_DEBUGFS |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2254 | diff --git a/mt7996/testmode.c b/mt7996/testmode.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2255 | index 042da4e4..be224373 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2256 | --- a/mt7996/testmode.c |
| 2257 | +++ b/mt7996/testmode.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2258 | @@ -241,8 +241,8 @@ mt7996_tm_init(struct mt7996_phy *phy, bool en) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2259 | |
| 2260 | mt7996_tm_rf_switch_mode(dev, rf_test_mode); |
| 2261 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2262 | - mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, en); |
| 2263 | - mt7996_mcu_add_sta(dev, &phy->monitor_vif->bss_conf, &mvif->deflink, NULL, en, false); |
| 2264 | + mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, &mvif->sta.deflink, en); |
| 2265 | + mt7996_mcu_add_sta(dev, &phy->monitor_vif->bss_conf, &mvif->deflink, NULL, &mvif->sta.deflink, en, false); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2266 | |
| 2267 | mt7996_tm_set(dev, SET_ID(BAND_IDX), phy->mt76->band_idx); |
| 2268 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2269 | @@ -1192,7 +1192,7 @@ mt7996_tm_txbf_init(struct mt7996_phy *phy, u16 *val) |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2270 | phy->omac_mask |= BIT_ULL(mvif->deflink.mt76.omac_idx); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2271 | |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 2272 | mt7996_mcu_add_dev_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, true); |
| 2273 | - mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, true); |
| 2274 | + mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, &mvif->sta.deflink, true); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2275 | |
| 2276 | if (td->ibf) { |
| 2277 | if (td->is_txbf_dut) { |
| 2278 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 2279 | 2.45.2 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2280 | |