From: Ping-Ke Shih pkshih@realtek.com
[ Upstream commit 04a2de8cfc95076d6c65d4d6d06d0f9d964a2105 ]
Two C2H events are not listed, and driver throws
MAC c2h class 0 func 6 not support MAC c2h class 1 func 3 not support
Since the implementation in vendor driver does nothing, add two dummy functions for them.
Reported-by: Bitterblue Smith rtl8821cerfe2@gmail.com Closes: https://lore.kernel.org/linux-wireless/d2d62793-046c-4b55-93ed-1d1f43cff7f2@... Reviewed-by: Sean Anderson sean.anderson@linux.dev Signed-off-by: Ping-Ke Shih pkshih@realtek.com Link: https://patch.msgid.link/20250804012234.8913-3-pkshih@realtek.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- User-visible issue: firmware sends two valid C2H events which the driver doesn’t list/handle, producing noisy logs: - “MAC c2h class 0 func 6 not support” (INFO class, func 6) - “MAC c2h class 1 func 3 not support” (OFLD class, func 3) - Current dispatcher prints this whenever a handler is missing: drivers/net/wireless/realtek/rtw89/mac.c:5539.
- Root cause in current trees: - OFLD class has `RTW89_MAC_C2H_FUNC_BCN_RESEND` but its slot is `NULL` in the handler table, so it logs as unsupported: drivers/net/wireless/realtek/rtw89/mac.c:5410 and drivers/net/wireless/realtek/rtw89/mac.h:390. - INFO class has no enumerant for BCN update-done, so func 6 is out- of-range and also logs unsupported: drivers/net/wireless/realtek/rtw89/mac.h:398..403 and drivers/net/wireless/realtek/rtw89/mac.c:5418.
- What this patch changes (small and contained): - Adds two no-op handlers: - `rtw89_mac_c2h_bcn_resend(...)` in `mac.c` and wires it into `[RTW89_MAC_C2H_FUNC_BCN_RESEND]` in `rtw89_mac_c2h_ofld_handler[]`. - `rtw89_mac_c2h_bcn_upd_done(...)` in `mac.c` and wires it into `[RTW89_MAC_C2H_FUNC_BCN_UPD_DONE]` in `rtw89_mac_c2h_info_handler[]`. - Extends the INFO function enum with `RTW89_MAC_C2H_FUNC_BCN_UPD_DONE = 0x06`, which bumps `RTW89_MAC_C2H_FUNC_INFO_MAX` accordingly so func 6 becomes in-range: drivers/net/wireless/realtek/rtw89/mac.h (new enumerant before `RTW89_MAC_C2H_FUNC_INFO_MAX`).
- Behavioral effect: - These two events are now recognized and consumed without logging “not support,” matching vendor driver behavior (“implementation in vendor driver does nothing”). - No functional change to MAC/PHY state; only eliminates spurious logs for valid firmware events.
- Risk assessment: - Minimal: adds two static no-op functions and table entries; no locking or state changes. - `INFO_MAX` increases to include 0x06, and the handler table explicitly sets index 6, preventing out-of-bounds. Indices 4–5 remain NULL (and still log “not support” if ever seen), maintaining current behavior for other undefined funcs. - No ABI/API changes; touches only `drivers/net/wireless/realtek/rtw89/`.
- Impacted subsystems: - Confined to rtw89 MAC C2H handling; does not touch core networking/mac80211 subsystems.
- Stable criteria fit: - Fixes an end-user visible annoyance (log spam/false “unsupported”) triggered by normal firmware behavior. - Very small, localized, and low-risk; no new features or architectural changes. - Reviewed-by present; linked to user report and discussion.
- Cross-version applicability: - The OFLD BCN_RESEND enumerant is present with a NULL handler in older trees (e.g., v6.1: mac.c:3928..3952 shows NULL; mac.h:303..330 lists BCN_RESEND), so wiring a no-op handler backports cleanly. - INFO func 6 is currently out-of-range; adding `RTW89_MAC_C2H_FUNC_BCN_UPD_DONE = 0x06` and the matching handler table entry brings parity with firmware without altering other values.
- Security considerations: - None; pure handling/no-op of already-received control indications.
- Conclusion: - This is an ideal stable backport: it resolves a real annoyance with negligible regression risk and no functional downside, aligning mainline behavior with vendor expectations.
drivers/net/wireless/realtek/rtw89/mac.c | 13 ++++++++++++- drivers/net/wireless/realtek/rtw89/mac.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c index ef17a307b7702..33a7dd9d6f0e6 100644 --- a/drivers/net/wireless/realtek/rtw89/mac.c +++ b/drivers/net/wireless/realtek/rtw89/mac.c @@ -5235,6 +5235,11 @@ rtw89_mac_c2h_bcn_cnt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len) { }
+static void +rtw89_mac_c2h_bcn_upd_done(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len) +{ +} + static void rtw89_mac_c2h_pkt_ofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *skb_c2h, u32 len) @@ -5257,6 +5262,11 @@ rtw89_mac_c2h_pkt_ofld_rsp(struct rtw89_dev *rtwdev, struct sk_buff *skb_c2h, rtw89_complete_cond(wait, cond, &data); }
+static void +rtw89_mac_c2h_bcn_resend(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len) +{ +} + static void rtw89_mac_c2h_tx_duty_rpt(struct rtw89_dev *rtwdev, struct sk_buff *skb_c2h, u32 len) { @@ -5646,7 +5656,7 @@ void (* const rtw89_mac_c2h_ofld_handler[])(struct rtw89_dev *rtwdev, [RTW89_MAC_C2H_FUNC_EFUSE_DUMP] = NULL, [RTW89_MAC_C2H_FUNC_READ_RSP] = NULL, [RTW89_MAC_C2H_FUNC_PKT_OFLD_RSP] = rtw89_mac_c2h_pkt_ofld_rsp, - [RTW89_MAC_C2H_FUNC_BCN_RESEND] = NULL, + [RTW89_MAC_C2H_FUNC_BCN_RESEND] = rtw89_mac_c2h_bcn_resend, [RTW89_MAC_C2H_FUNC_MACID_PAUSE] = rtw89_mac_c2h_macid_pause, [RTW89_MAC_C2H_FUNC_SCANOFLD_RSP] = rtw89_mac_c2h_scanofld_rsp, [RTW89_MAC_C2H_FUNC_TX_DUTY_RPT] = rtw89_mac_c2h_tx_duty_rpt, @@ -5661,6 +5671,7 @@ void (* const rtw89_mac_c2h_info_handler[])(struct rtw89_dev *rtwdev, [RTW89_MAC_C2H_FUNC_DONE_ACK] = rtw89_mac_c2h_done_ack, [RTW89_MAC_C2H_FUNC_C2H_LOG] = rtw89_mac_c2h_log, [RTW89_MAC_C2H_FUNC_BCN_CNT] = rtw89_mac_c2h_bcn_cnt, + [RTW89_MAC_C2H_FUNC_BCN_UPD_DONE] = rtw89_mac_c2h_bcn_upd_done, };
static diff --git a/drivers/net/wireless/realtek/rtw89/mac.h b/drivers/net/wireless/realtek/rtw89/mac.h index 241e89983c4ad..25fe5e5c8a979 100644 --- a/drivers/net/wireless/realtek/rtw89/mac.h +++ b/drivers/net/wireless/realtek/rtw89/mac.h @@ -419,6 +419,7 @@ enum rtw89_mac_c2h_info_func { RTW89_MAC_C2H_FUNC_DONE_ACK, RTW89_MAC_C2H_FUNC_C2H_LOG, RTW89_MAC_C2H_FUNC_BCN_CNT, + RTW89_MAC_C2H_FUNC_BCN_UPD_DONE = 0x06, RTW89_MAC_C2H_FUNC_INFO_MAX, };