All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rtw-next] wifi: rtw89: do BIP in software when not in station mode
@ 2026-10-20 13:00 V schurink
  2026-10-29  1:57 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: V schurink @ 2026-10-20 13:00 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: linux-wireless, V schurink

rtw89_cam_sec_key_add() installs the AES-CMAC key (BIP, 802.11w PMF)
in hardware. rtw89_core_tx_update_sec_key() has no case for
WLAN_CIPHER_SUITE_AES_CMAC, and the driver does not set
IEEE80211_KEY_FLAG_GENERATE_MMIE. Thus, an AP with PMF sends each
protected group-addressed management frame without an MMIE, for
example a broadcast deauthentication. For each frame, the driver logs
"key cipher not supported 1027078". PMF clients discard these frames.

An AP sends these frames. Thus, return -EOPNOTSUPP for AES-CMAC when
the interface is not a station, so that mac80211 does BIP in software.
A station only receives these frames, so it keeps the IGTK in
hardware. This does not change WoWLAN, which uses the IGTK of a
station.

BIP in hardware does not work for an AP on RTL8922A. The test used
IEEE80211_KEY_FLAG_GENERATE_MMIE and RTW89_SEC_KEY_TYPE_BIP_CCMP128 in
the TX descriptor. The client did not accept the protected broadcast
deauthentication.

Tested on RTL8912AU (RTL8922A, USB) in AP mode with hostapd 2.10,
WPA2-PSK and SAE, ieee80211w=1. The client accepts the protected
broadcast deauthentication, and the driver does not log the warning.

Fixes: 940cd99625de ("wifi: rtw89: wow: support 802.11w PMF IGTK rekey")
Signed-off-by: V schurink <spam@acio.nl>
---
 drivers/net/wireless/realtek/rtw89/cam.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireless/realtek/rtw89/cam.c
index 22f21a0..58a7e8f 100644
--- a/drivers/net/wireless/realtek/rtw89/cam.c
+++ b/drivers/net/wireless/realtek/rtw89/cam.c
@@ -514,6 +514,12 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
 		ext_key = true;
 		break;
 	case WLAN_CIPHER_SUITE_AES_CMAC:
+		/* TX does not support BIP. An AP sends group-addressed robust
+		 * management frames, so let mac80211 do BIP in software there.
+		 * A station only receives them; keep its IGTK in hardware.
+		 */
+		if (vif->type != NL80211_IFTYPE_STATION)
+			return -EOPNOTSUPP;
 		hw_key_type = RTW89_SEC_KEY_TYPE_BIP_CCMP128;
 		break;
 	default:
-- 
2.53.0
---
Also discussed in the out-of-tree repository:
https://github.com/morrownr/rtw89/pull/135

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH rtw-next] wifi: rtw89: do BIP in software when not in station mode
  2026-10-20 13:00 [PATCH rtw-next] wifi: rtw89: do BIP in software when not in station mode V schurink
@ 2026-10-29  1:57 ` Ping-Ke Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2026-10-29  1:57 UTC (permalink / raw)
  To: V schurink; +Cc: linux-wireless@vger.kernel.org

V schurink <spam@acio.nl> wrote:
> rtw89_cam_sec_key_add() installs the AES-CMAC key (BIP, 802.11w PMF)
> in hardware. rtw89_core_tx_update_sec_key() has no case for
> WLAN_CIPHER_SUITE_AES_CMAC, and the driver does not set
> IEEE80211_KEY_FLAG_GENERATE_MMIE. Thus, an AP with PMF sends each
> protected group-addressed management frame without an MMIE, for
> example a broadcast deauthentication. For each frame, the driver logs
> "key cipher not supported 1027078". PMF clients discard these frames.
> 
> An AP sends these frames. Thus, return -EOPNOTSUPP for AES-CMAC when
> the interface is not a station, so that mac80211 does BIP in software.
> A station only receives these frames, so it keeps the IGTK in
> hardware. This does not change WoWLAN, which uses the IGTK of a
> station.
> 
> BIP in hardware does not work for an AP on RTL8922A. The test used
> IEEE80211_KEY_FLAG_GENERATE_MMIE and RTW89_SEC_KEY_TYPE_BIP_CCMP128 in
> the TX descriptor. The client did not accept the protected broadcast
> deauthentication.
> 
> Tested on RTL8912AU (RTL8922A, USB) in AP mode with hostapd 2.10,
> WPA2-PSK and SAE, ieee80211w=1. The client accepts the protected
> broadcast deauthentication, and the driver does not log the warning.

We made a RFT patch [1]. Please try if it can work to you.

I think the reason why your try in github doesn't work is missing to
trim MIC space of MMIC.

[1] https://lore.kernel.org/linux-wireless/20261029014857.9753-1-pkshih@realtek.com/T/#u

> 
> Fixes: 940cd99625de ("wifi: rtw89: wow: support 802.11w PMF IGTK rekey")
> Signed-off-by: V schurink <spam@acio.nl>
> ---
>  drivers/net/wireless/realtek/rtw89/cam.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/cam.c b/drivers/net/wireless/realtek/rtw89/cam.c
> index 22f21a0..58a7e8f 100644
> --- a/drivers/net/wireless/realtek/rtw89/cam.c
> +++ b/drivers/net/wireless/realtek/rtw89/cam.c
> @@ -514,6 +514,12 @@ int rtw89_cam_sec_key_add(struct rtw89_dev *rtwdev,
>                 ext_key = true;
>                 break;
>         case WLAN_CIPHER_SUITE_AES_CMAC:
> +               /* TX does not support BIP. An AP sends group-addressed robust
> +                * management frames, so let mac80211 do BIP in software there.
> +                * A station only receives them; keep its IGTK in hardware.
> +                */

The first line of block comment should be empty. Even, I think this comment
is not necessary. The change blow says that, or it should be 'vif == IFTYPE_AP'
to match the comment. 

> +               if (vif->type != NL80211_IFTYPE_STATION)
> +                       return -EOPNOTSUPP;
>                 hw_key_type = RTW89_SEC_KEY_TYPE_BIP_CCMP128;
>                 break;
>         default:
> --
> 2.53.0
> ---
> Also discussed in the out-of-tree repository:
> https://github.com/morrownr/rtw89/pull/135


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-29  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 13:00 [PATCH rtw-next] wifi: rtw89: do BIP in software when not in station mode V schurink
2026-10-29  1:57 ` Ping-Ke Shih

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.