blob: acef98c82f3bd4139ca460012c3fa7d0d3ca53af [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From ebc64cf0ebe700231a5b94b299abb49b8db88308 Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Wed, 22 May 2024 18:22:51 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 127/223] mtk: mt76: mt7996: do not remove bss_info and starec
developer05f3b2b2024-08-19 19:17:34 +08005 when assign_vif_chanctx
6
7When STA interface re-connect from rootAP, it would unsign/assign vif
8chanctx for both AP and station interface. If remove/re-allocate
9bss_info and starec for AP interface, the WTBL and GTK of AP would
10be cleared. But the hostapd does not remove interface so it would not
11set key again.
12
developerd0c89452024-10-11 16:53:27 +080013Change-Id: Icdd599f163268e7f313589f0ca35a2f220e2b783
developer05f3b2b2024-08-19 19:17:34 +080014Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
15---
16 mt7996/main.c | 17 +++++++++++++----
17 1 file changed, 13 insertions(+), 4 deletions(-)
18
19diff --git a/mt7996/main.c b/mt7996/main.c
developerd0c89452024-10-11 16:53:27 +080020index f45f6c02..be0864a0 100644
developer05f3b2b2024-08-19 19:17:34 +080021--- a/mt7996/main.c
22+++ b/mt7996/main.c
23@@ -338,6 +338,9 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
24 u8 link_id = conf->link_id;
25 int idx, ret;
26
27+ if (rcu_access_pointer(mvif->link[link_id]))
28+ return 0;
29+
30 if (conf != &vif->bss_conf) {
31 mconf = kzalloc(sizeof(*mconf), GFP_KERNEL);
32 if (!mconf)
developerd0c89452024-10-11 16:53:27 +080033@@ -2520,10 +2523,16 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer05f3b2b2024-08-19 19:17:34 +080034
35 mutex_lock(&phy->dev->mt76.mutex);
36
37- /* remove first */
38- if (rcu_access_pointer(mvif->link[link_id]))
39- mt7996_remove_bss_conf(vif, link_conf,
40- mconf_dereference_protected(mvif, link_id));
41+ mconf = mconf_dereference_protected(mvif, link_id);
42+
43+ /* Remove bss conf when change non-MLO interface to MLO interface */
44+ if (ieee80211_vif_is_mld(vif) && mconf == &mvif->deflink)
45+ mt7996_remove_bss_conf(vif, link_conf, mconf);
46+ else if (mconf && phy != mconf->phy)
47+ dev_err(phy->dev->mt76.dev,
48+ "%s: error: change link[%d] from phy%d to phy%d",
49+ __func__, link_id, mconf->phy->mt76->band_idx,
50+ phy->mt76->band_idx);
51
52 ret = mt7996_add_bss_conf(phy, vif, link_conf);
53 if (ret) {
54--
developerd0c89452024-10-11 16:53:27 +0800552.45.2
developer05f3b2b2024-08-19 19:17:34 +080056