wifi: mt76: clear cipher state on key removal for WED offload
Subsystems (3)
v2 cover wifi: mt76: clear cipher state on key removal for WED offload
When switching WiFi encryption from WPA-PSK/SAE to open/none with WED hardware offload enabled, throughput drops to zero. The BSS cipher state is set when group keys are installed but never cleared when they are removed. The WA firmware retains the stale cipher value and keeps the protection bit set on WED-offloaded packets, causing all plaintext frames to be dropped.
Found via reverse engineering of the vendor MediaTek SDK mt_wifi.ko driver.
---
v1 -> v2: Rebased on wireless.git (was mt76-fixes)
Joshua Klinesmith (2):
wifi: mt76: mt7915: clear cipher state on key removal for WED offload
wifi: mt76: mt7996: clear cipher state on key removal for WED offload
drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++++ drivers/net/wireless/mediatek/mt76/mt7996/main.c | 7 +++++++ 2 files changed, 13 insertions(+)
base-commit: 45dbf8fcea4dcf28cabcf4a1778e908feadf4c90
Signature · 1 line
2.43.0
PATCH v2 1/2 wifi: mt76: mt7915: clear cipher state on key removal for WED offload
When switching from WPA-PSK/SAE to open/no encryption, the DISABLE_KEY path never resets mvif->mt76.cipher back to zero. The stale cipher value is sent to the WA firmware via BSS_INFO updates, causing the firmware to keep the protection bit set on WED-offloaded packets. The hardware then drops all plaintext frames, resulting in zero throughput.
Reset mvif->mt76.cipher to zero and notify the firmware via mt7915_mcu_add_bss_info() when the last group key is removed.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +6 -0
@@ -414,6 +414,12 @@ static int mt7915_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, }else {if (idx == *wcid_keyidx) *wcid_keyidx =-1 ; + +if (!sta && mvif->mt76.cipher) { + mvif->mt76.cipher =0 ; +mt7915_mcu_add_bss_info (phy, vif, true); + } + goto out; }
Signature · 1 line
2.43.0
PATCH v2 2/2 wifi: mt76: mt7996: clear cipher state on key removal for WED offload
In reply to Joshua KlinesmithSame issue as mt7915: link->mt76.cipher is set on key installation but never cleared on removal. The WA firmware retains the stale cipher in BSS_INFO, sets the protection bit on WED-offloaded frames, and drops all plaintext traffic when encryption is switched to open/none.
Reset link->mt76.cipher to zero and call mt7996_mcu_add_bss_info() when the last group key is removed.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +7 -0
@@ -249,6 +249,13 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,else if (idx == *wcid_keyidx) *wcid_keyidx =-1 ; +if (cmd !=SET_KEY && !sta && link->mt76.cipher) { + link->mt76.cipher =0 ; +if (link->phy) +mt7996_mcu_add_bss_info (link->phy, vif, link_conf, + &link->mt76, msta_link, true); + } +/* only do remove key for BIGTK */ if (cmd !=SET_KEY && !is_bigtk)return 0 ;
Signature · 1 line
2.43.0