[PATCH v2 09/13] wifi: mt76: mt7996: Support MLO in mt7996_mac_sta_event()
Lorenzo Bianconi
lorenzo at kernel.org
Tue Mar 11 10:45:08 PDT 2025
Similar to mt7996_mac_sta_add() adn mt7996_mac_sta_remove(), update
mt7996_mac_sta_event routine to take into account MLO support.
Please note mcu routines does not support MLO yet.
Co-developed-by: Bo Jiao <Bo.Jiao at mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao at mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu at mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu at mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen at mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen at mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 69 ++++++++++++++----------
1 file changed, 40 insertions(+), 29 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 307c68c6b0cd7c3acdbfd7be78a007a66d3183bf..6d323b5e4e8076ca963e585c12dc656dc5ec3fdb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1001,41 +1001,52 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, enum mt76_sta_event ev)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_sta_link *msta_link = &msta->deflink;
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_vif_link *link = &mvif->deflink;
- int i, ret;
-
- switch (ev) {
- case MT76_STA_EVENT_ASSOC:
- ret = mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
- CONN_STATE_CONNECT, true);
- if (ret)
- return ret;
-
- ret = mt7996_mcu_add_rate_ctrl(dev, vif, sta, false);
- if (ret)
- return ret;
+ struct ieee80211_link_sta *link_sta;
+ unsigned int link_id;
- msta_link->wcid.tx_info |= MT_WCID_TX_INFO_SET;
- msta_link->wcid.sta = 1;
+ for_each_sta_active_link(vif, sta, link_sta, link_id) {
+ struct mt7996_sta_link *msta_link;
+ struct mt7996_vif_link *link;
+ int i, err;
- return 0;
+ link = mt7996_vif_link(dev, vif, link_id);
+ if (!link)
+ continue;
- case MT76_STA_EVENT_AUTHORIZE:
- return mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
- CONN_STATE_PORT_SECURE, false);
+ msta_link = mt76_dereference(msta->link[link_id], &dev->mt76);
+ if (!msta_link)
+ continue;
- case MT76_STA_EVENT_DISASSOC:
- for (i = 0; i < ARRAY_SIZE(msta_link->twt.flow); i++)
- mt7996_mac_twt_teardown_flow(dev, msta, i);
+ switch (ev) {
+ case MT76_STA_EVENT_ASSOC:
+ err = mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
+ CONN_STATE_CONNECT, true);
+ if (err)
+ return err;
- mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
- CONN_STATE_DISCONNECT, false);
- msta_link->wcid.sta_disabled = 1;
- msta_link->wcid.sta = 0;
+ err = mt7996_mcu_add_rate_ctrl(dev, vif, sta, false);
+ if (err)
+ return err;
- return 0;
+ msta_link->wcid.tx_info |= MT_WCID_TX_INFO_SET;
+ msta_link->wcid.sta = 1;
+ break;
+ case MT76_STA_EVENT_AUTHORIZE:
+ err = mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
+ CONN_STATE_PORT_SECURE, false);
+ if (err)
+ return err;
+ break;
+ case MT76_STA_EVENT_DISASSOC:
+ for (i = 0; i < ARRAY_SIZE(msta_link->twt.flow); i++)
+ mt7996_mac_twt_teardown_flow(dev, msta, i);
+
+ mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
+ CONN_STATE_DISCONNECT, false);
+ msta_link->wcid.sta_disabled = 1;
+ msta_link->wcid.sta = 0;
+ break;
+ }
}
return 0;
--
2.48.1
More information about the linux-arm-kernel
mailing list