blob: c03003a8cef712035cac83401f25cd68a3b61515 [file] [log] [blame]
developer1f55fcf2024-10-17 14:52:33 +08001From 81e8f959269eed83f6611ea65f7e1fc22bb4d934 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
developer1f55fcf2024-10-17 14:52:33 +08004Subject: [PATCH 127/193] 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
developer1f55fcf2024-10-17 14:52:33 +080020index 161b5cb..5a6165b 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)
developer1f55fcf2024-10-17 14:52:33 +080033@@ -2519,10 +2522,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