blob: 4e55b7e158b1c3393b6cba94294d46c10c3c3258 [file] [log] [blame]
From c14b26df4ab2474ea89fbc410f570d28d415bb9f Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 5 Jun 2024 10:11:13 +0800
Subject: [PATCH 136/193] mtk: mt76: mt7996: set unused band to UNSPECIFIED in
band_to_link
Change-Id: I21190c5952a9c2f2a7f5f619f8d1fb23dd127c6f
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
mt7996/main.c | 4 ++++
mt7996/mcu.c | 3 +++
mt7996/mt7996.h | 3 +++
3 files changed, 10 insertions(+)
diff --git a/mt7996/main.c b/mt7996/main.c
index 7bd189b..436ef82 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -482,6 +482,8 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
mvif->sta.vif = mvif;
/* TODO: temporaily set this to prevent some crashes */
mvif->deflink.phy = phy;
+ memset(mvif->band_to_link, IEEE80211_LINK_UNSPECIFIED,
+ sizeof(mvif->band_to_link));
if (vif->type == NL80211_IFTYPE_STATION)
ret = mt7996_add_bss_conf(phy, vif, &vif->bss_conf);
@@ -1053,6 +1055,8 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
mutex_lock(&dev->mt76.mutex);
link_id = mvif->band_to_link[phy->mt76->band_idx];
+ if (link_id == IEEE80211_LINK_UNSPECIFIED)
+ goto out;
if (!mvif->cs_ready_links)
mvif->cs_link_id = link_id;
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
index 29dc95b..b498e9e 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -379,6 +379,9 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
int link_id, band_idx = mphy->band_idx;
link_id = mvif->band_to_link[band_idx];
+ if (link_id == IEEE80211_LINK_UNSPECIFIED)
+ return;
+
link_conf = rcu_dereference(vif->link_conf[link_id]);
if (!link_conf || !link_conf->csa_active || vif->type == NL80211_IFTYPE_STATION)
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
index 7bb1712..3ff9cb6 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -966,6 +966,9 @@ mt7996_get_link_wcid(struct mt7996_dev *dev, u16 idx, u8 band_idx)
mlink = wcid_to_mlink(wcid);
link_id = mlink->sta->vif->band_to_link[band_idx];
+ if (link_id == IEEE80211_LINK_UNSPECIFIED)
+ return wcid;
+
mlink = rcu_dereference(mlink->sta->link[link_id]);
if (!mlink)
return wcid;
--
2.45.2