Skip to content

Commit f048f24

Browse files
Ming Yen Hsiehopsiff
authored andcommitted
wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present
mainline inclusion from mainline-v6.15-rc1 category: bugfix When the p2p device and MLO station are running concurrently, the p2p device will occupy the wrong link_idx when the MLO secondary link is added. Fixes: 9e4c3a0 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-2-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 4bada9b) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent d913822 commit f048f24

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

drivers/net/wireless/mediatek/mt76/mt76.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ struct mt76_testmode_data {
744744

745745
struct mt76_vif {
746746
u8 idx;
747+
u8 link_idx;
747748
u8 omac_idx;
748749
u8 band_idx;
749750
u8 wmm_idx;

drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
11581158
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
11591159
.len = cpu_to_le16(sizeof(struct req_tlv)),
11601160
.active = enable,
1161-
.link_idx = mvif->idx,
1161+
.link_idx = mvif->link_idx,
11621162
},
11631163
};
11641164
struct {
@@ -1181,7 +1181,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
11811181
.bmc_tx_wlan_idx = cpu_to_le16(wcid->idx),
11821182
.sta_idx = cpu_to_le16(wcid->idx),
11831183
.conn_state = 1,
1184-
.link_idx = mvif->idx,
1184+
.link_idx = mvif->link_idx,
11851185
},
11861186
};
11871187
int err, idx, cmd, len;

drivers/net/wireless/mediatek/mt76/mt7925/main.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,17 +356,23 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
356356
struct mt76_txq *mtxq;
357357
int idx, ret = 0;
358358

359-
mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);
360-
if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) {
361-
ret = -ENOSPC;
362-
goto out;
359+
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
360+
mconf->mt76.idx = MT792x_MAX_INTERFACES;
361+
} else {
362+
mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);
363+
364+
if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) {
365+
ret = -ENOSPC;
366+
goto out;
367+
}
363368
}
364369

365370
mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ?
366371
0 : mconf->mt76.idx;
367372
mconf->mt76.band_idx = 0xff;
368373
mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ?
369374
0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
375+
mconf->mt76.link_idx = hweight16(mvif->valid_links);
370376

371377
if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
372378
mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4;

0 commit comments

Comments
 (0)