Skip to content

Commit a5e60ef

Browse files
LorenzoBianconigregkh
authored andcommitted
wifi: mt76: mt7996: Reset mtxq->idx if primary link is removed in mt7996_vif_link_remove()
[ Upstream commit 751a267 ] Reset WCID index in mt76_txq struct if primary link is removed in mt7996_vif_link_remove routine. Fixes: a3316d2 ("wifi: mt76: mt7996: set vif default link_id adding/removing vif links") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20251205-mt76-txq-wicd-fix-v2-2-f19ba48af7c1@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9fd2f23 commit a5e60ef

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

  • drivers/net/wireless/mediatek/mt76/mt7996

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,28 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
402402

403403
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
404404

405-
if (!mlink->wcid->offchannel &&
405+
if (vif->txq && !mlink->wcid->offchannel &&
406406
mvif->mt76.deflink_id == link_conf->link_id) {
407407
struct ieee80211_bss_conf *iter;
408+
struct mt76_txq *mtxq;
408409
unsigned int link_id;
409410

410411
mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
412+
mtxq = (struct mt76_txq *)vif->txq->drv_priv;
413+
/* Primary link will be removed, look for a new one */
411414
for_each_vif_active_link(vif, iter, link_id) {
412-
if (link_id != IEEE80211_LINK_UNSPECIFIED) {
413-
mvif->mt76.deflink_id = link_id;
414-
break;
415-
}
415+
struct mt7996_vif_link *link;
416+
417+
if (link_id == link_conf->link_id)
418+
continue;
419+
420+
link = mt7996_vif_link(dev, vif, link_id);
421+
if (!link)
422+
continue;
423+
424+
mtxq->wcid = link->msta_link.wcid.idx;
425+
mvif->mt76.deflink_id = link_id;
426+
break;
416427
}
417428
}
418429

0 commit comments

Comments
 (0)