blob: 30c8b37e04cc58102f03d41ad0c9548687ca6212 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 525b850e3140488b346601070adbeb5fd163af67 Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Wed, 22 May 2024 18:22:51 +0800
4Subject: [PATCH 139/199] mtk: mt76: mt7996: do not remove bss_info and starec
5 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
13Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
14---
15 mt7996/main.c | 17 +++++++++++++----
16 1 file changed, 13 insertions(+), 4 deletions(-)
17
18diff --git a/mt7996/main.c b/mt7996/main.c
19index 40418f7e..2a2112f1 100644
20--- a/mt7996/main.c
21+++ b/mt7996/main.c
22@@ -338,6 +338,9 @@ static int mt7996_add_bss_conf(struct mt7996_phy *phy,
23 u8 link_id = conf->link_id;
24 int idx, ret;
25
26+ if (rcu_access_pointer(mvif->link[link_id]))
27+ return 0;
28+
29 if (conf != &vif->bss_conf) {
30 mconf = kzalloc(sizeof(*mconf), GFP_KERNEL);
31 if (!mconf)
32@@ -2516,10 +2519,16 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
33
34 mutex_lock(&phy->dev->mt76.mutex);
35
36- /* remove first */
37- if (rcu_access_pointer(mvif->link[link_id]))
38- mt7996_remove_bss_conf(vif, link_conf,
39- mconf_dereference_protected(mvif, link_id));
40+ mconf = mconf_dereference_protected(mvif, link_id);
41+
42+ /* Remove bss conf when change non-MLO interface to MLO interface */
43+ if (ieee80211_vif_is_mld(vif) && mconf == &mvif->deflink)
44+ mt7996_remove_bss_conf(vif, link_conf, mconf);
45+ else if (mconf && phy != mconf->phy)
46+ dev_err(phy->dev->mt76.dev,
47+ "%s: error: change link[%d] from phy%d to phy%d",
48+ __func__, link_id, mconf->phy->mt76->band_idx,
49+ phy->mt76->band_idx);
50
51 ret = mt7996_add_bss_conf(phy, vif, link_conf);
52 if (ret) {
53--
542.18.0
55