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