Re: [PATCH v4 3/3] wifi: rtw88: ps: trigger firmware recovery only after consecutive LPS leave failures on PCI

From: Kalpesh Solanki

Date: Thu Nov 12 2026 - 09:02:02 EST


Hi Luka, Ping-Ke,

Thank you both for your patience while I was away, and thank you Luka for
advocating to address the review feedback before pushing v5.

Regarding Luka's two comments on v4:

1. Redundant rtw_hci_type check in rtw_fw_recovery():
You are completely right. Since rtw_fw_leave_lps_check() already guards the
call with rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE, and the other callers in
pci.c are PCI-only, having an HCI check in rtw_fw_recovery() in main.c is
redundant. I have dropped it in v5.

2. ps_hang_cnt on non-FW_FEATURE_LPS_C2H chipsets:
Excellent catch! On chipsets without FW_FEATURE_LPS_C2H (such as RTL8822B
and RTL8723D), the check falls back to polling REG_TCR for
BIT_PWRMGT_HWDATA_EN. On timeout, the driver forcefully clears this bit via
rtw_write32_clr(rtwdev, REG_TCR, BIT_PWRMGT_HWDATA_EN) so packets can continue
to be transmitted. If the firmware is frozen, it will never re-assert this
bit. On the next check, the register read sees the bit cleared, falsely reports
success, and resets ps_hang_cnt back to 0. Thus, a stuck firmware on these
chips could never reach RTW_PS_HANG_MAX_CNT.

In v5, I have updated patch 3/3 so that ps_hang_cnt is only incremented and
evaluated when FW_FEATURE_LPS_C2H is supported:

if (rtw_fw_feature_check(fw, FW_FEATURE_LPS_C2H) &&
rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE) {
rtwdev->ps_hang_cnt++;
if (rtwdev->ps_hang_cnt >= RTW_PS_HANG_MAX_CNT)
rtw_fw_recovery(rtwdev);
}

For C2H-capable devices (such as RTL8822C and RTL8821C), completion signaling
reliably accumulates consecutive timeouts when the firmware hangs, while
legacy chipsets without C2H retain the upstream behavior (clear TCR and warn)
without getting trapped in a broken counter reset loop.

Regarding lore / patchwork:
It appears v4 was either dropped by list filters or delayed during list delivery.
I have sent out the full v5 series [PATCH v5 0/3] incorporating all the above
changes to the mailing list.

Thanks,
Kalpesh