summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorShayne Chen <shayne.chen@mediatek.com>2026-03-15 11:26:26 +0100
committerFelix Fietkau <nbd@nbd.name>2026-03-24 15:49:32 +0000
commitc8d22f28ea583bda31b7db8243e4e1eb042ac38a (patch)
tree778e17ab0e5dcd8752bbc3502881d0321bf0a84f /drivers/net
parent108cb0c43fdc93bad105dcd00c30d9729520c71f (diff)
wifi: mt76: mt7996: Move mlink deallocation in mt7996_vif_link_remove()
Destroy mt76_vif_link struct in mt7996_vif_link_remove routine and not in mt76_unassign_vif_chanctx(). This is necessary since, in order to properly support MLO link reconfiguration, we will destroy mt76_vif_link struct during AP tear-down process and not running unassign_vif_chanctx mac80211 callback. This patch does not introduce any regression since mt76_assign_vif_chanctx/mt76_unassign_vif_chanctx APIs are currently used just by MT7996 driver. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-3-a8a634fbc927@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mediatek/mt76/channel.c9
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7996/main.c6
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/channel.c b/drivers/net/wireless/mediatek/mt76/channel.c
index cf3fc09e5d5a..05eee64706ea 100644
--- a/drivers/net/wireless/mediatek/mt76/channel.c
+++ b/drivers/net/wireless/mediatek/mt76/channel.c
@@ -158,8 +158,6 @@ void mt76_unassign_vif_chanctx(struct ieee80211_hw *hw,
{
struct mt76_chanctx *ctx = (struct mt76_chanctx *)conf->drv_priv;
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
- struct mt76_vif_data *mvif = mlink->mvif;
- int link_id = link_conf->link_id;
struct mt76_phy *phy = ctx->phy;
struct mt76_dev *dev = phy->dev;
@@ -176,15 +174,8 @@ void mt76_unassign_vif_chanctx(struct ieee80211_hw *hw,
if (!mlink)
goto out;
- if (mlink != (struct mt76_vif_link *)vif->drv_priv)
- rcu_assign_pointer(mvif->link[link_id], NULL);
-
dev->drv->vif_link_remove(phy, vif, link_conf, mlink);
mlink->ctx = NULL;
-
- if (mlink != (struct mt76_vif_link *)vif->drv_priv)
- kfree_rcu(mlink, rcu_head);
-
out:
mutex_unlock(&dev->mutex);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 07a266f7670c..feee93340a6c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -459,6 +459,12 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
spin_unlock_bh(&dev->mt76.sta_poll_lock);
mt76_wcid_cleanup(&dev->mt76, &msta_link->wcid);
+
+ if (mlink != (struct mt76_vif_link *)vif->drv_priv &&
+ !mlink->wcid->offchannel) {
+ rcu_assign_pointer(mlink->mvif->link[link_id], NULL);
+ kfree_rcu(mlink, rcu_head);
+ }
}
static void mt7996_phy_set_rxfilter(struct mt7996_phy *phy)