Skip to content

Commit a145277

Browse files
committed
wifi: mt76: mt7996: set vif default link_id adding/removing vif links
JIRA: https://issues.redhat.com/browse/RHEL-89168 commit a3316d2 Author: Lorenzo Bianconi <lorenzo@kernel.org> Date: Wed Mar 12 12:14:02 2025 +0100 wifi: mt76: mt7996: set vif default link_id adding/removing vif links This info will be consumed by subsequent patches (e.g. in set/get tsf routines). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-18-015b3d6fd928@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent 8b32156 commit a145277

File tree

1 file changed

+19
-0
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7996

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
271271
struct mt76_vif_link *mlink)
272272
{
273273
struct mt7996_vif_link *link = container_of(mlink, struct mt7996_vif_link, mt76);
274+
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
274275
struct mt7996_sta_link *msta_link = &link->msta_link;
275276
struct mt7996_phy *phy = mphy->priv;
276277
struct mt7996_dev *dev = phy->dev;
@@ -338,6 +339,9 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
338339

339340
ieee80211_iter_keys(mphy->hw, vif, mt7996_key_iter, NULL);
340341

342+
if (mvif->mt76.deflink_id == IEEE80211_LINK_UNSPECIFIED)
343+
mvif->mt76.deflink_id = link_conf->link_id;
344+
341345
return 0;
342346
}
343347

@@ -346,6 +350,7 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
346350
struct mt76_vif_link *mlink)
347351
{
348352
struct mt7996_vif_link *link = container_of(mlink, struct mt7996_vif_link, mt76);
353+
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
349354
struct mt7996_sta_link *msta_link = &link->msta_link;
350355
struct mt7996_phy *phy = mphy->priv;
351356
struct mt7996_dev *dev = phy->dev;
@@ -359,6 +364,19 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
359364

360365
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
361366

367+
if (mvif->mt76.deflink_id == link_conf->link_id) {
368+
struct ieee80211_bss_conf *iter;
369+
unsigned int link_id;
370+
371+
mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
372+
for_each_vif_active_link(vif, iter, link_id) {
373+
if (link_id != IEEE80211_LINK_UNSPECIFIED) {
374+
mvif->mt76.deflink_id = link_id;
375+
break;
376+
}
377+
}
378+
}
379+
362380
dev->mt76.vif_mask &= ~BIT_ULL(mlink->idx);
363381
phy->omac_mask &= ~BIT_ULL(mlink->omac_idx);
364382

@@ -443,6 +461,7 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
443461
mt76_vif_init(vif, &mvif->mt76);
444462

445463
vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
464+
mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
446465

447466
out:
448467
mutex_unlock(&dev->mt76.mutex);

0 commit comments

Comments
 (0)