Skip to contentSkip to conversation

wifi: mt76: clear cipher state on key removal for WED offload

PATCH Superseded Joshua Klinesmith 1 participant 3 messages Apr 7

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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.

Fixes 3fd2dbd6a1d3 ("mt76: mt7915: update bss_info with cipher after setting the group key")
---
 drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +6 -0
index 90d5e79fbf..6e7442cac4 100644
@@ -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
#2 lore raw

PATCH v2 2/2 wifi: mt76: mt7996: clear cipher state on key removal for WED offload

In reply to Joshua Klinesmith

Same 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.

Fixes 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
---
 drivers/net/wireless/mediatek/mt76/mt7996/main.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +7 -0
index f16135f0b7..d464fc3d90 100644
@@ -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