developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 1 | From 81e8f959269eed83f6611ea65f7e1fc22bb4d934 Mon Sep 17 00:00:00 2001 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Wed, 22 May 2024 18:22:51 +0800 |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 127/193] mtk: mt76: mt7996: do not remove bss_info and starec |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | when assign_vif_chanctx |
| 6 | |
| 7 | When STA interface re-connect from rootAP, it would unsign/assign vif |
| 8 | chanctx for both AP and station interface. If remove/re-allocate |
| 9 | bss_info and starec for AP interface, the WTBL and GTK of AP would |
| 10 | be cleared. But the hostapd does not remove interface so it would not |
| 11 | set key again. |
| 12 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 13 | Change-Id: Icdd599f163268e7f313589f0ca35a2f220e2b783 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 14 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 15 | --- |
| 16 | mt7996/main.c | 17 +++++++++++++---- |
| 17 | 1 file changed, 13 insertions(+), 4 deletions(-) |
| 18 | |
| 19 | diff --git a/mt7996/main.c b/mt7996/main.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 20 | index 161b5cb..5a6165b 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 21 | --- 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) |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 33 | @@ -2519,10 +2522,16 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 34 | |
| 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 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 55 | 2.45.2 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 56 | |