[PATCH AUTOSEL 6.19-6.6] wifi: rtw89: wow: add reason codes for disassociation in WoWLAN mode

Sasha Levin
2026-02-14T21:26:34Z

From: Chin-Yen Lee <timlee@realtek.com>

[ Upstream commit 2fd8f953f25173d14981d8736b6f5bfcd757e51b ]

Some APs disconnect clients by sending a Disassociation frame
rather than a Deauthentication frame. Since these frames use
different reason codes in WoWLAN mode, this commit adds support
for handling Disassociation to prevent missed disconnection events.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260110022019.2254969-3-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

## Analysis

### Commit Message Analysis

The commit adds handling for disassociation frames in WoWLAN (Wake-on-
Wireless-LAN) mode. The problem described is that some APs disconnect
clients by sending a Disassociation frame rather than a Deauthentication
frame. Without this patch, if an AP sends a Disassociation frame while
the system is in WoWLAN suspend, the driver doesn't recognize the wake
reason code (`0x4`), and the disconnection event is missed — the system
either doesn't wake up properly or wakes up without reporting the
correct reason to userspace.

### Code Change Analysis

The change is minimal and surgical:

1. **wow.h**: Adds a new enum value `RTW89_WOW_RSN_RX_DISASSOC = 0x4` to
the existing `rtw89_wake_reason` enum. This is a firmware-defined
reason code that the hardware/firmware already produces — the driver
just wasn't handling it.

2. **wow.c**: Adds a new `case RTW89_WOW_RSN_RX_DISASSOC:` in the switch
statement in `rtw89_wow_show_wakeup_reason()`, which sets
`wakeup.disconnect = true` (same as deauth and disconnect cases) and
logs a debug message.

The pattern is identical to the existing `RTW89_WOW_RSN_RX_DEAUTH` case
— same behavior, just for a different frame type.

### Bug Classification

This fixes a **real functional bug**: missed disconnection events during
WoWLAN suspend. When an AP sends a disassociation frame (which is a
legitimate and common way to disconnect a client per IEEE 802.11), the
driver fails to properly report the wakeup reason. This means:

- The system may not wake up when the user expects it to (missed wake
event)
- Or if it does wake, the wakeup reason isn't properly communicated to
cfg80211/userspace
- The unhandled reason code falls through to the `default` case in the
switch

### Scope and Risk Assessment

- **Size**: ~10 lines added across 2 files
- **Risk**: Extremely low — it's adding a case to a switch statement
that mirrors existing cases
- **Self-contained**: No dependencies on other commits
- **No new features**: This is handling a firmware-defined reason code
that the hardware already produces; the driver was simply missing the
handler
- **No API changes**: No new userspace-visible APIs

### User Impact

This affects any user of rtw89 WiFi hardware who uses WoWLAN.
Disassociation frames are commonly sent by APs (especially enterprise
APs during maintenance, roaming scenarios, or policy enforcement).
Missing these events means WoWLAN doesn't work correctly in real-world
scenarios — which is a functional bug for laptop users relying on wake-
on-disconnect.

### Comparison to Stable Criteria

This is analogous to a **hardware quirk/workaround** — it handles a case
that the firmware already supports but the driver wasn't processing. It:
- Fixes a real bug (missed disconnection events)
- Is obviously correct (mirrors existing deauth handling)
- Is small and contained
- Does not introduce new features
- Applies cleanly

### Concerns

- The code exists in stable trees (rtw89 driver has been in the kernel
for several versions)
- No dependencies on other commits
- The enum value `0x4` is firmware-defined and presumably has been
supported by the firmware for some time

### Decision

This is a small, surgical bug fix that prevents missed WoWLAN
disconnection events. It's clearly correct, mirrors existing code
patterns, has negligible risk, and fixes a real-world user-facing issue
with WiFi hardware.

**YES**

drivers/net/wireless/realtek/rtw89/wow.c | 4 ++++
drivers/net/wireless/realtek/rtw89/wow.h | 1 +
2 files changed, 5 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
index 46aba4cb2ee9e..534966b4d9c43 100644
--- a/drivers/net/wireless/realtek/rtw89/wow.c
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
@@ -809,6 +809,10 @@ static void rtw89_wow_show_wakeup_reason(struct rtw89_dev *rtwdev)

reason = rtw89_read8(rtwdev, wow_reason_reg);
switch (reason) {
+ case RTW89_WOW_RSN_RX_DISASSOC:
+ wakeup.disconnect = true;
+ rtw89_debug(rtwdev, RTW89_DBG_WOW, "WOW: Rx disassoc\n");
+ break;
case RTW89_WOW_RSN_RX_DEAUTH:
wakeup.disconnect = true;
rtw89_debug(rtwdev, RTW89_DBG_WOW, "WOW: Rx deauth\n");
diff --git a/drivers/net/wireless/realtek/rtw89/wow.h b/drivers/net/wireless/realtek/rtw89/wow.h
index d2ba6cebc2a6b..71e07f482174f 100644
--- a/drivers/net/wireless/realtek/rtw89/wow.h
+++ b/drivers/net/wireless/realtek/rtw89/wow.h
@@ -33,6 +33,7 @@
enum rtw89_wake_reason {
RTW89_WOW_RSN_RX_PTK_REKEY = 0x1,
RTW89_WOW_RSN_RX_GTK_REKEY = 0x2,
+ RTW89_WOW_RSN_RX_DISASSOC = 0x4,
RTW89_WOW_RSN_RX_DEAUTH = 0x8,
RTW89_WOW_RSN_DISCONNECT = 0x10,
RTW89_WOW_RSN_RX_MAGIC_PKT = 0x21,
--
2.51.0