From: Luka Gejak <luka.gejak@linux.dev>
To: Kalpesh Solanki <skalpesh942@gmail.com>, pkshih@realtek.com
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/3] wifi: rtw88: ps: trigger firmware recovery only after consecutive LPS leave failures on PCI
Date: Thu, 12 Nov 2026 22:30:25 +0100 [thread overview]
Message-ID: <5AD46498-09E2-4700-B5DB-FE45142A3212@linux.dev> (raw)
In-Reply-To: <20261112131401.236433-4-skalpesh942@gmail.com>
On November 12, 2026 2:14:01 PM GMT+01:00, Kalpesh Solanki
<skalpesh942@gmail.com> wrote:
>A single timeout in rtw_fw_leave_lps_check() does not always indicate a
>frozen firmware; in noisy RF environments or during beacon loss, the
>802.11 null data frame ACK can be delayed or dropped. Immediately
>triggering firmware recovery and a full hardware restart on a single
>timeout causes unnecessary disconnections and kernel warning traces on
>idle links.
>
>Follow rtw89 by introducing a consecutive failure counter (ps_hang_cnt)
>and only triggering rtw_fw_recovery() after RTW_PS_HANG_MAX_CNT (3)
>consecutive failures. Reset the counter to 0 on every successful LPS
>leave and in rtw_core_start() so that cold starts and hardware restarts
>always begin with a clean slate.
>
>On chipsets without FW_FEATURE_LPS_C2H (such as RTL8822B and RTL8723D),
>rtw_fw_leave_lps_check() falls back to polling REG_TCR for
>BIT_PWRMGT_HWDATA_EN. On timeout, the driver forcefully clears this
>bit so subsequent packets can be transmitted. Because stuck firmware
>never re-asserts the bit, subsequent register checks immediately pass,
>clearing ps_hang_cnt back to 0 and preventing the counter from ever
>accumulating. Therefore, only count consecutive failures on devices
>with FW_FEATURE_LPS_C2H, where C2H completion signaling reliably detects
>consecutive timeouts.
>
>Additionally, rtw_fw_recovery() clears keys via rtw_iterate_keys_atomic()
>under a spinlock. On USB and SDIO, register writes in key clearing sleep
>(via usb_control_msg() and sdio_claim_host()), which would trigger a
>BUG: scheduling while atomic if executed. Because USB and SDIO do not
>support firmware recovery, restrict firmware recovery invocation to
>PCI devices via rtw_hci_type().
>
>Signed-off-by: Kalpesh Solanki <skalpesh942@gmail.com>
>---
Looks good to me,
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Best regards,
Luka Gejak
prev parent reply other threads:[~2026-11-12 21:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 13:13 [PATCH v5 0/3] wifi: rtw88: firmware recovery fixes and LPS hang handling Kalpesh Solanki
2026-11-12 13:13 ` [PATCH v5 1/3] wifi: rtw88: clear RTW_FLAG_RESTARTING on stop and start failure Kalpesh Solanki
2026-11-12 21:28 ` Luka Gejak
2026-11-12 13:14 ` [PATCH v5 2/3] wifi: rtw88: skip already reset station in rtw_sta_remove() Kalpesh Solanki
2026-11-12 21:29 ` Luka Gejak
2026-11-12 13:14 ` [PATCH v5 3/3] wifi: rtw88: ps: trigger firmware recovery only after consecutive LPS leave failures on PCI Kalpesh Solanki
2026-11-12 21:30 ` Luka Gejak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5AD46498-09E2-4700-B5DB-FE45142A3212@linux.dev \
--to=luka.gejak@linux.dev \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=skalpesh942@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox