From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 804A333BBD1 for ; Thu, 16 Apr 2026 04:55:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776315352; cv=none; b=Uj8Ot1y5sgaJ6hTkKaTgluLLKYZODnuuUPZcxgLUgajhd5P36ERughoU4WTl22OPETplq0mD+I7I3waP9oj5w9rBbiRCLgcvszDxvJl/FZCLOuBCA91efpprrgkrqxsspjdTAxSxROp79I36OUjuSxnyElffSgk3RuT87al3oE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776315352; c=relaxed/simple; bh=jauk6e9BJvBYX00zsKakv1BPdImGP5ebGlP113D2KLk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bAWXBENlnDVZz2ypDtlNBJWnVsfT/OT6odmoZ9a7RCyr9P29V7dUsDR2CKgr3hNje+2YzLkbGIfq89X8PgEsvZqky4+DrWXgvIiX7nFAnHmt3tHFY2w8bS6kKOfJGgtiTlmQI4m+NoepzP470ek5JVK9XTmptGrVbAhCbbamb5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=o567LVTu; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o567LVTu" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-488c21c636dso45660295e9.2 for ; Wed, 15 Apr 2026 21:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776315350; x=1776920150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ikmjS0XG21cXkTZVtL70gUUBd8u+W9ZnDJv3a6pHenw=; b=o567LVTut+o+JpCr8pNxpFl6D2CDATJA1lJxvFsgZeE8qrx5ssmNOVNmCWw9XaRFRz J/pW4qTusxXZsAWzz7cxw4CCWK7/8RKMnXB1dw7EocDNxoAMesnzQb9oLDRvX8UgDPLB wQZF0Dy98fjHnc7YonDMjUGCbiE7Ep3xKvjB+SFjvZvG+BXJjg82h2j1fKERx3TBbiex WpxOCoZqENHy6M1httz5FrDujuxRpPuPwMLVIShvK+IOTGeSPiTeAzjlXNHl3B/WcWR4 XOQ5ITQwEh+ELuxz0cC8D6R1rK7cVaj3bfDgea/OXymQodxGnyG5PLCCIHF3xQ2VVIEK tqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776315350; x=1776920150; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ikmjS0XG21cXkTZVtL70gUUBd8u+W9ZnDJv3a6pHenw=; b=UFsY/belaqWOXZdJEMD5rFVh4nzkK+7p6VHXzWLrG+ndsGUp2VNfpe7FuwxmMvMSAg H5qgazv6IsnJRquhkqGPuwge0cjcT7LB9Juj/j117DKE408Qsa179qiHM5B0YQbJVqJx SrUwdmI9gSb2MWv0sDVg84kMIagrNlvgnhRvHLejH8h2F7PUzxgiJ4FdXu6G8cmJrTV7 sjYPxsljBPruRG+eAaT0ZGu1Dg2QoRoO8x4qReR2x5b6u+u4+75GXQzulEuwuOn/kM8o Eh6fa1a9xvlNOINDk0T+fX7h+tgqxOb17mCamlFsDyCGTJHPS8JYqkU4JgJ0OurFqon4 M8cA== X-Forwarded-Encrypted: i=1; AFNElJ9OiXgPFA/n84z0Hwd18IqzsG74F7d27F+DfB/vQDfAnhuaNTKtgPRIFMe4BEMckoY0fFpvOnPXPW2nZd8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx023Huxuf7QIr9PsGiZE2ezpgc60oZ/5TQuU/HQ99Layak1Xre QD+QVgjxsTDMqaYyKgtn01mHn9AI4XNBMW7xejiVJnEc0VzXfWLb2zl4 X-Gm-Gg: AeBDieuZ98rEdb8d57W++vkCFJVmEa7lEGNk3VGlmjiJlqVZyOCl13F2WzUVm1crf6B DYeAsVOSVsAb2RUa3ByiEkeaTfYsLK+Bjp8jcKsDqRdA5+FMOwE6fz/+bAfKCTyuwe0ajUIciqs AYyCIl69CRjt1nljgCXc/aR/hcw/Y/OqBiDbq3TW7xEq53+UDLrZLDKd9RMjLjybVB7wx47bwpX Jt7OwPG4mYCq0kzxKfhCbaR6/bxZ6jXzDXSu2NGif6NAfGLjUK0V/9Y88VjKts/I/f5ZxJFcGAr erTw+WHBXm1X5mTZ59sIIHdit4jxaBNqg+JS4L238vGyDP0wDVExiMeo33nBiyUu7Hj3v2scT5b cUTXJ7bxZ+uGR9HguvysY0BabjD9lByg9f+Q14zcbSv1JPQMh74LGfqgD6gLNfFVzZpmG38KTEM EnNAM8G+cj+VN8qUujTnnQmoVwCUuMzrl0qqKSBJv48GemN47So8EQy+8tSveUpsyrsJ4W X-Received: by 2002:a05:600c:c0dc:b0:47e:e076:c7a5 with SMTP id 5b1f17b1804b1-488d68105d2mr233254355e9.11.1776315349678; Wed, 15 Apr 2026 21:55:49 -0700 (PDT) Received: from bazzite ([102.128.175.252]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488f58236bcsm21046875e9.12.2026.04.15.21.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 21:55:49 -0700 (PDT) From: Louis Kotze To: pkshih@realtek.com Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, rtl8821cerfe2@gmail.com, lucid_duck@justthetip.ca, Louis Kotze Subject: [PATCH v3] wifi: rtw89: phy: increase RF calibration timeouts for USB transport Date: Thu, 16 Apr 2026 06:55:36 +0200 Message-ID: <20260416045536.817930-1-loukot@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. The 4x multiplier was also verified under adverse host conditions on 5GHz. 5 cycles per scenario, stress-ng as the load generator, max observed time per calibration: Calibration PCIe 4x Baseline CPU stress Mem stress Combined PRE_NTFY 5 20 0 0 0 1 DACK 58 232 71 (!) 71 (!) 71 (!) 71 (!) RX_DCK 128 512 23 22 22 23 IQK 84 336 53 53 53 53 DPK 34 136 23 23 26 23 TSSI 20 80 6 9 14 9 TXGAPK 54 216 16 16 16 16 Legend: (!) = exceeds PCIe budget but within 4x budget. Two observations from that matrix: 1. DACK exceeds the stock PCIe budget (58ms) in baseline on 5GHz on this hardware. Without the 4x multiplier, DACK fails -ETIMEDOUT deterministically on every connect, no stress needed. This is the condition the patch addresses. 2. Calibration times appear dominated by USB transport round-trip latency rather than host load, though hardware and external component factors may also contribute. DACK stays at 71ms across all four scenarios. Host-side stress has essentially zero effect on observed calibration duration. Bumping the multiplier above 4x would not address a failure mode that this stress matrix produces. Reported-by: Devin Wittmayer Link: https://github.com/Lucid-Duck/rtw89-usb3-gap/tree/main/evidence/crash-2026-04-11 Signed-off-by: Louis Kotze Tested-by: Devin Wittmayer # RTL8922AU (BrosTrend BE6500) Tested-by: Devin Wittmayer # RTL8852AU (D-Link DWA-X1850 A1) Tested-by: Devin Wittmayer # RTL8852AU (D-Link DWA-X1850 B1) Tested-by: Devin Wittmayer # RTL8852BU (BrosTrend AX4L) Tested-by: Devin Wittmayer # RTL8852CU (EDUP AX5400) Acked-by: Ping-Ke Shih --- Changes since v2: - Reword commit message per Ping-Ke review: remove v1 reference from permanent changelog, use "condition" instead of "bug", acknowledge hardware factors in calibration timing rather than asserting I/O bound. - Add Tested-by tags from Devin Wittmayer across 4 chipsets (RTL8922AU, RTL8852AU, RTL8852BU, RTL8852CU) on Framework 13 + Fedora 43 (6.19.11) and Raspberry Pi 5 + Pi OS (6.12.47). - Add Reported-by for independent confirmation including xHCI hard lockup evidence (CPU5 deadlock in usb_unanchor_urb after DACK timeout triggered driver recovery). v2: https://lore.kernel.org/linux-wireless/20260415111339.453602-1-loukot@gmail.com/ v1: https://lore.kernel.org/linux-wireless/20260410080017.82946-1-loukot@gmail.com/ drivers/net/wireless/realtek/rtw89/phy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index e70d0e283..1f249c297 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -3956,6 +3956,14 @@ 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); base-commit: 1e33ef7657531b2361d53cca25f375b5626e76a9 -- 2.53.0