wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Wed, 11 Dec 2024 01:19:17 +0000 (17:19 -0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:34:35 +0000 (13:34 +0100)
In mt7925_mac_link_bss_add(), the mt76_connac_mcu_uni_add_dev() function
must be executed only after all parameters have been properly initialized.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-8-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/main.c

index 268d216f09e20855190e8bd892bf36b1b2764e1a..3cd3c3e289e72802259467b93959810ebf52eefa 100644 (file)
@@ -365,18 +365,14 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
        mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ?
                               0 : mconf->mt76.idx;
        mconf->mt76.band_idx = 0xff;
-       mconf->mt76.wmm_idx = mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
+       mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ?
+                             0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
 
        if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
                mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4;
        else
                mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL;
 
-       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mconf->mt76,
-                                         &mlink->wcid, true);
-       if (ret)
-               goto out;
-
        dev->mt76.vif_mask |= BIT_ULL(mconf->mt76.idx);
        mvif->phy->omac_mask |= BIT_ULL(mconf->mt76.omac_idx);
 
@@ -395,6 +391,12 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
        ewma_rssi_init(&mconf->rssi);
 
        rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid);
+
+       ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mconf->mt76,
+                                         &mlink->wcid, true);
+       if (ret)
+               goto out;
+
        if (vif->txq) {
                mtxq = (struct mt76_txq *)vif->txq->drv_priv;
                mtxq->wcid = idx;