* [PATCH 1/2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport
2026-04-10 8:00 ` [PATCH 0/2] wifi: rtw89: fix RF calibration for USB transport Louis Kotze
@ 2026-04-10 8:00 ` Louis Kotze
2026-04-10 8:00 ` [PATCH 2/2] wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB Louis Kotze
1 sibling, 0 replies; 3+ messages in thread
From: Louis Kotze @ 2026-04-10 8:00 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, rtl8821cerfe2, linux-kernel, Louis Kotze
USB transport adds significant latency to H2C/C2H round-trips used
by RF calibration. The existing timeout values were designed for PCIe
and are too tight for USB, causing "failed to wait RF DACK",
"failed to wait RF TSSI" and similar errors on USB adapters.
Apply a 4x timeout multiplier when the device uses USB transport.
The multiplier is applied in rtw89_phy_rfk_report_wait() so all
calibrations benefit without changing any call sites or PCIe
timeout values.
The 4x multiplier was chosen based on measured data from two
independent testers (RTL8922AU, 6GHz MLO and 2.4/5GHz):
Calibration PCIe timeout Max measured (USB) 4x timeout
PRE_NTFY 5ms 1ms 20ms
DACK 58ms 72ms 232ms
RX_DCK 128ms 374ms 512ms
TSSI normal 20ms 24ms 80ms
TSSI scan 6ms 14ms 24ms
TXGAPK 54ms 18ms 216ms
IQK 84ms 53ms 336ms
DPK 34ms 30ms 136ms
Tested with RTL8922AU on 6GHz MLO (5GHz + 6GHz simultaneous):
25 connect/disconnect cycles with zero failures.
Signed-off-by: Louis Kotze <loukot@gmail.com>
---
drivers/net/wireless/realtek/rtw89/phy.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index e70d0e283..4d809df8b 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -3956,6 +3956,13 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
struct rtw89_rfk_wait_info *wait = &rtwdev->rfk_wait;
unsigned long time_left;
+ /* USB transport adds latency to H2C/C2H round-trips, so RF
+ * calibrations take longer than on PCIe. Apply a 4x multiplier
+ * to avoid spurious timeouts.
+ */
+ if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
+ ms *= 4;
+
/* Since we can't receive C2H event during SER, use a fixed delay. */
if (test_bit(RTW89_FLAG_SER_HANDLING, rtwdev->flags)) {
fsleep(1000 * ms / 2);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB
2026-04-10 8:00 ` [PATCH 0/2] wifi: rtw89: fix RF calibration for USB transport Louis Kotze
2026-04-10 8:00 ` [PATCH 1/2] wifi: rtw89: phy: increase RF calibration timeouts " Louis Kotze
@ 2026-04-10 8:00 ` Louis Kotze
1 sibling, 0 replies; 3+ messages in thread
From: Louis Kotze @ 2026-04-10 8:00 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, rtl8821cerfe2, linux-kernel, Louis Kotze
On USB adapters, RF calibration timeouts can still occasionally occur
despite the increased timeout values, particularly under system load
or USB bus contention. However, the radio typically continues to
operate correctly despite an incomplete calibration — the timeout
does not indicate a hardware failure.
Make calibration timeouts and bad state returns non-fatal on USB by
logging at debug level and continuing, rather than returning
-ETIMEDOUT/-EFAULT which can cascade into a connection failure or
disconnect.
PCIe error handling is unchanged — timeouts remain fatal on PCIe
where they indicate a real problem.
Signed-off-by: Louis Kotze <loukot@gmail.com>
---
drivers/net/wireless/realtek/rtw89/phy.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index 4d809df8b..a06bea88e 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -3972,9 +3972,21 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
time_left = wait_for_completion_timeout(&wait->completion,
msecs_to_jiffies(ms));
if (time_left == 0) {
+ if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
+ "RF %s timeout (non-fatal on USB)\n",
+ rfk_name);
+ goto out;
+ }
rtw89_warn(rtwdev, "failed to wait RF %s\n", rfk_name);
return -ETIMEDOUT;
} else if (wait->state != RTW89_RFK_STATE_OK) {
+ if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+ rtw89_debug(rtwdev, RTW89_DBG_RFK,
+ "RF %s state %d (non-fatal on USB)\n",
+ rfk_name, wait->state);
+ goto out;
+ }
rtw89_warn(rtwdev, "failed to do RF %s result from state %d\n",
rfk_name, wait->state);
return -EFAULT;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread