From nobody Mon Jun 15 12:15:32 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 CA0EE3AA1BF for ; Fri, 10 Apr 2026 08:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775808040; cv=none; b=B7gShzazYz7tH1hdNxFSTez9yjNnIxnsdBxswFmNi3N8LvShMl9qu59ojxzarpMPOnw+gBfLXP7WYF9UMMCCZAsiECxuuA4z7glBz6JWosZIS3aeXD7XRMVcgqH4oWOJFLvSnXruJlrJ3YxR5/oLkY8Dw8RpasK3cyk3aAYbWCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775808040; c=relaxed/simple; bh=sJLUcEB5Ds5h7s1KzusNR0Xi7cPwLi/aMbVipBLZNf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JbyQL6sI5GvfkpxuUprE8kRvWe8V0ImLQ6hIIkeAg1qeizSakgi4uvqlSJhsrvUSbxz414SDTVXGpHgYuMhUMhCOi4quRTkhQDm8nnHn4UyGQUupLRaL36O/7bHJhVnoYgJ5R0ckekmFW011XGzcgLIeo0HNJPNCnwrwxylMb3g= 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=UpRSBnY7; arc=none smtp.client-ip=209.85.221.48 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="UpRSBnY7" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-43b8e8e7432so1523488f8f.1 for ; Fri, 10 Apr 2026 01:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775808035; x=1776412835; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VbUT3h/LfG7smkTPhwuysdt9HcT3k1c4we51p644zaU=; b=UpRSBnY7EcZLH3DBjTOKWBU7CYY9RsXATYFTLOVx/xbY8jFBobjLsLMm8eM/s2sewb 9AaI2YrFLKmfrIheQKt7BaO6G2iCgZME3ppgQntdwewkwMoFFDul9qfwM3NBFf5CVyEK +zI1ymU3IaGQGiaC9cPxkhmaM7zXVdqpA/PFIqCeZXUtmhqn0r4nAXP/h12UcBM9jMOj pMyYPg5p5GYDEfyL/46sttJ5dbO9EN10drhGqZod3cPrL2MmzoxfyzcRAD4PbeaK+qOp 8zpoPoxFOLGLlMDH3ZwpgvWi8wdpVGV29TLKsbUs2fEP/3xLhs3b6IiWrhDEuBRWHPXy gmLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775808035; x=1776412835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VbUT3h/LfG7smkTPhwuysdt9HcT3k1c4we51p644zaU=; b=hn0NdfHESuZk2vqvQ/ALxHj6pIomDPE5N7O0Lbe8t3jKvtuNdAF+NiV7J4N/jMY1+U BusGWXGL6+2XZ324Gf5WlQrcmcJnyhN5eUEoQOUSXPtM/9BV94ipv+gIHpgG3GIDns9X 0yqKtwgjfhtZiLtOKGYr01p36SOUFhrv+hSvBpm/FxcB4AbGALek9BSO2q9DA86I3ESY uAlREBJqBqCpzXopLnN+AbHmcEmX7t1HyyCkHsNiVpP52iDgvUem04ynwtbGumjVp39g q0VhV8pPfBnPds6VmWHSt+j6sFdTkfrKHNSaq/1Mn4cFnIxUW755mwRJRiihleXGXIxu 7eaw== X-Forwarded-Encrypted: i=1; AJvYcCUWyILUXwl/WxXzJN0I0ZsSBCmS4UdbPyPzn5zZ5GhujgklMZrE9C70WURozjC6jiz7b40ZnmSJ/voR/mA=@vger.kernel.org X-Gm-Message-State: AOJu0YyKuUAM1cghuTZPWAWB0b3kAKzPSZmzG5IRa+j1GJrc43q2jJcI 2v7qRaktfWZ0Yd6gHRYbrJXneJr1p9NWr9L0KOR79N93mSZBOcOfFJGj X-Gm-Gg: AeBDievSUio2wMSnmJuajczod81g3cq/4XGwi4V7k82E9daUaqCE509abDBBvpuepPW x3rHrIOrCWzeTmE4CUSgPc7PwsTMuoZ+seZkgKnu0uF6jRDgcKZ6tZPGbllg0RdpBRQq5vIutdG XSZ0ZSxn9waP9G8sw1UFUbIOoaq2FgjUXg08ZqUQ9M2QW7uYefJp2G01X/t3E+uN1F0wJFRwkpu rniP0PXWXeRGAUxzApXZ/Q4vM0ngCwK4c5hkdUcmt9Ic0OO6KhXBTc4v7eA0ta+GRdHSfM3hDb+ GrG3c6T6+K3nC0fZGYLLETIHyt6MU8slC7oy4DxtL2t4erKtmUIbKMTaGCIZPkI+o9Ct4UvBai2 JDEZRxJ17ckdOqxa8petkMIHQ/kPAUfV2Y3vBXOWwwGs3VV0qsIWd3jqm6+Tj1RA7bu+SMttU8f ex X-Received: by 2002:a05:6000:26c2:b0:439:ddf9:a205 with SMTP id ffacd0b85a97d-43d6427b793mr2975801f8f.10.1775808034579; Fri, 10 Apr 2026 01:00:34 -0700 (PDT) Received: from bazzite ([102.128.175.252]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63e5c98fsm5891151f8f.35.2026.04.10.01.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 01:00:33 -0700 (PDT) From: Louis Kotze To: linux-wireless@vger.kernel.org Cc: pkshih@realtek.com, rtl8821cerfe2@gmail.com, linux-kernel@vger.kernel.org, Louis Kotze Subject: [PATCH 1/2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport Date: Fri, 10 Apr 2026 10:00:16 +0200 Message-ID: <20260410080017.82946-2-loukot@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410080017.82946-1-loukot@gmail.com> References: <795a8567fdbe48babc5cf0f2b5e10c0a@realtek.com> <20260410080017.82946-1-loukot@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/wireles= s/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 *rtwd= ev, const char *rfk_name, struct rtw89_rfk_wait_info *wait =3D &rtwdev->rfk_wait; unsigned long time_left; =20 + /* 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 =3D=3D RTW89_HCI_TYPE_USB) + ms *=3D 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); --=20 2.53.0 From nobody Mon Jun 15 12:15:32 2026 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 BEACC3ACA78 for ; Fri, 10 Apr 2026 08:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775808041; cv=none; b=DOdDtJ8jC6lalatiqAZowp4H51g+cnZPBFnd9Xm5jK9hMBeD6ynH/UXMFdwnu2PTMHZz8+Lhjsa8iO5L3n0piWMD35KA/mWiLaMhE+YYBXMNNd8lU/d8IAobc5shsBZDOeqgU0o5+GLH02REODX4vVEiV1NU7StsWkpjzHGg7Do= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775808041; c=relaxed/simple; bh=VPddwM7q9ai+Mc+Hm7URp9mhZzBpJZSUIvlqgPihycU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XSZS7vCJZqbVqi4IqTixhNKzF0xuYlJwKYIKaVKlEno9F91D5mcw6y6jRfvM+37qJrXY07TTziGD9ftcBlJwW4ud5cauVP7ZUJnkOENjXLAl2gVZsFkzQamKxjQVw+tgoWVWRkF5+W99GDwF3CesGYFFYqN3GgbT1Xefu22+Em4= 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=LrZEVRu1; arc=none smtp.client-ip=209.85.221.51 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="LrZEVRu1" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-43d5e87a507so1288809f8f.3 for ; Fri, 10 Apr 2026 01:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775808038; x=1776412838; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FH4qigFMvJKamcVu6PpJKnPBitJ1tPD2bAQZHpobGMY=; b=LrZEVRu1cF8ARTyxV7oe+qNycEiPSievJ3j7kt8tptvwyUXYdg9DvGmRh71rOfr7zV tuSIU272nYeAR4/+R6p6jdZuxwmFtyfqfKZGG90btFJRspgcZJ6d4G15tYvCntn2VC/N kk3cmt1+AmtZZAtPAsSB3979mE7RFZHh6xJ/BsPH+XJajg1Iq1IklY5SAmebJdHufo+S CZ4IpsK7ArJHRoU88GgpDkX3B1F4Ao/jVd82lhTUn+IrtafglwAAdYuIQKHPJ3jHB1Nj A3Y2BZRAHOjfRedIim2CXrLBDvAJqdMbbpyRqKbGJPEy/m4WJKtPBKggsesF4YhssTkW j2NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775808038; x=1776412838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FH4qigFMvJKamcVu6PpJKnPBitJ1tPD2bAQZHpobGMY=; b=Xf6QXM2AveAgEpe6SooJvM9tVxZbnhJTk52MdnQ9HMWzSdPOaoOw5sFMPL1AOPMeY/ CHNqtNKoGwWcX+MUpp195+Q3KzQ7QTV1scHGYtMA9irqCkz8Fc95DzMKBsNZPtDqj0SO 1i2nv1ffcpHIFMDbSfxRkX7rsAgBbYNwf+FM5StuwTTWc6cah9Xo+sJAoT81Aa+Uu47/ 1/0UciQjW/ttuPOY1En28OIKcgyHXyvqp1DXgVfSAaqPyPehYteag0/STi5yQQU/ngUd H7NdnrqeTU61NwV+wISyaGdZJNEwFXzRhwlkhqg62JRv5M1Gyq9cP2gtOvsvPuM6mUR5 JAQQ== X-Forwarded-Encrypted: i=1; AJvYcCWUyWPa0JqEcwqcyAZzGw/GHVbAYfqtGheIbNuNzynHWXTpGPo7y7NFDwzvwZ69RmD+vE4Or+YImf7qoe4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/KYW/s5ZDn5JQbNOe6MPU3RTeovolM0AeRCXk0WSF76xnrB3g XDA9UFHdeKTIM1wdn3mV1Ehxl7q+z+0fKliBRyuiDHxDqcVamRe6RrPf X-Gm-Gg: AeBDiet+tWP4BfgabWbktM9XCpF+QWeuubv1fH/abwH2TiwFZsuhY/2VDG/MnRkLjp1 PamyUP0VIo76kMuZh4Pvajs22ZMBbvCau98UQOKzOI5xDn+TSlc3s2aw/rgD+BqgpX1L4CYH6U+ 37O9QaZ98KKyQnllurvLMBObEd6fInEpykHkcej6sYHL0i2TL+WmZf4H5zOxsSPaazRlOFO2lO3 jAIqMDR6xuOSYOtS859nuVJWLfpe6srUIlvNz+AF4OousFWVqdCs2E99oOSF/N4wRIDipkLKRB4 cIS6erm513esBUA2d3UPe7nmWBWd1y0VOH4Z+rwOUpkfsJl0UU45IwKXaQmDiSE7BOYIShWwIsK zGua2/3basSDsRpr9I68mXEOEypIjtvFbX0KETq8OS+EaAOrKPCvytb3S8m1HTEayTSkI+M5hpx pf5n2YyVJ+n9BoK4M= X-Received: by 2002:a05:6000:1ac5:b0:43d:4df5:3de with SMTP id ffacd0b85a97d-43d642c5029mr2857827f8f.31.1775808037584; Fri, 10 Apr 2026 01:00:37 -0700 (PDT) Received: from bazzite ([102.128.175.252]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63e5c98fsm5891151f8f.35.2026.04.10.01.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 01:00:36 -0700 (PDT) From: Louis Kotze To: linux-wireless@vger.kernel.org Cc: pkshih@realtek.com, rtl8821cerfe2@gmail.com, linux-kernel@vger.kernel.org, Louis Kotze Subject: [PATCH 2/2] wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB Date: Fri, 10 Apr 2026 10:00:17 +0200 Message-ID: <20260410080017.82946-3-loukot@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410080017.82946-1-loukot@gmail.com> References: <795a8567fdbe48babc5cf0f2b5e10c0a@realtek.com> <20260410080017.82946-1-loukot@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=94 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 =E2=80=94 timeouts remain fatal on PCIe where they indicate a real problem. Signed-off-by: Louis Kotze --- 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/wireles= s/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 *rtwd= ev, const char *rfk_name, time_left =3D wait_for_completion_timeout(&wait->completion, msecs_to_jiffies(ms)); if (time_left =3D=3D 0) { + if (rtwdev->hci.type =3D=3D 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 !=3D RTW89_RFK_STATE_OK) { + if (rtwdev->hci.type =3D=3D 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; --=20 2.53.0 From nobody Mon Jun 15 12:15:32 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 3190634C826 for ; Wed, 15 Apr 2026 11:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776251637; cv=none; b=iO4baginlYevxzwUn8x58hNE5XgAhzoAaBAfGI1UqXeSQb3sofg9JSGpwEwPUgOuhpR5Jwsw0E72N3mSSpnpcsbh6UzNw3NjiVdVqAQitAyQOz8GGcpujMVW9GMOakIEyvjbBUnDTx+MFUiOwVli3yjeBxEGGdSlAM9+oj5/q/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776251637; c=relaxed/simple; bh=+WmQBag2xKG2Gx7djYJ7iyEhZicjNmTbO6K5EBS12tQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D0pKwakuHrhIYqqN5QK0erjfc+gGiGAAhHsfX0igzBQM+Eq91Wv+k9AcgBaMtJ7TWdwSmf8yygOD2HI+svwZYoMXiNuZvtbQXzf2i20x/Gj++tOCsAWBZHalUd6HGo2T3otPFo8nu9VBEkdT1HQULtYKeu6DB7apKZ1RqyFCtTU= 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=RIRmn9GP; arc=none smtp.client-ip=209.85.128.46 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="RIRmn9GP" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-488b0e1b870so103288995e9.2 for ; Wed, 15 Apr 2026 04:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776251632; x=1776856432; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bpedEU7mGkTRSv5C/AyW29lZoy8mTTrAXlbvsWFWNaY=; b=RIRmn9GP6ZsBXx/co/Ukt+5TAZq2hOCDMGJuiaSF/xBE0POK8l+ifh0gSqB3SCi4RN YBk4Wf0PbZoL7PO6c4Dvwm5lZb0g4zO0SNpY/+2jLgC6Uovt6IbKXNHw6xm9KuH3GVeH WBr0tFDMYz1jT4aNunmLuVHf5X8uKJmwtFz9Z35kXh8rymHDsoEmaHEzvIz/do1imqCd sHplOl7FDzpNlA5iImNkI2JQq9t9yYNrORib4CYHBSYsxwEQU0O/j7WJclOKa0zlAriQ +YNQgUIThJsVmWia+tb00vqDPghcdTc9HYpSWev20wmh/Ol/ExLE4ZrcnFsxjhZd8+bq 0EuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776251632; x=1776856432; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bpedEU7mGkTRSv5C/AyW29lZoy8mTTrAXlbvsWFWNaY=; b=R9rPACNfQT8UqVhhPfjPzFSND3IebNd42GyLHTlgfjf6Vi7lFX/WZ0/Rur0v9gqWMJ Fcy9f6tV4pLwK5us0PDWieTqrYfFFMnJnhUqxH3m+LTly4MvucA/GR9agZTFscfJAK6Q Sxcsl9mUzjyXlRPQg6QA64isrsItkX5oOvkIySdtH0xGSCHlm/l1fVu8HPvhKf2pXvrY ITlLcbKybdOsohixQ1yUUPae8Te355+8dbuJApJxwb+zP+g+gDidNFZrXlxlNSjtXFHu B70C3te6IANrtP0428KOXG/yAqcxSuIv2wi2j7odJtc9IeNp90AFflf21+o24TNi2+ON sB6g== X-Forwarded-Encrypted: i=1; AFNElJ/4js18zGDic1p7rd4hVD+m3YtXXezLWV//8gjQdoQK3ehvJVOty+CcbctNJv400O2CehH8QUujNWtTY/w=@vger.kernel.org X-Gm-Message-State: AOJu0YwHueWgywhQz8h9QQJjFHobDTRZAwYLDCQmh8/sznLXFy/72KMj gMqS4SEZvvU7RWGjoLTnm1ZeiN9AiG/hLqIrhCzLFB5gyLKeeskm5mDs X-Gm-Gg: AeBDieswNl/vYxSp4n3tZLFaHA5JAoJak1DKg+Wh61HaQPOPgVLNHefvhbZnGTYtvCj wCflMGGLjkD+EeL13UYVWnFOuFheqOtBT8LllhsQAYNzXVrajNfdFjZ5v6IPlLL3m+Z/+6PBe6s O7RuCVQcrcxId/ctAw4E8e89fOYeMJHEJXIm1+EWmStz3fCgYv3w8Zx2LpjCtRAZ5CIHY9BP4rB wLp+ZVmXFayMIIc7QA3k4se9FusIUI+7j1ydT3cq3XRZhhAc8ksZ/xzHtBrq0BNUSqBdCk270Ca KuSzClLj7l6EeSqPuo9TRL2LF2saBRUsSceWRmdEdfDMRGsQwITtjh9vPLRATo/YVw70nujMe9z FMs47DBWw5TlrKCfFVKrTxZCLfUzPCeb0V4fxAGE7g28xM03PAAe9tmEvbyX5PY1yEqIf1UWZTw j9wt/vFJSKOh4509U/6xrPvSWQoI0RGoT5R6AHAt8HHPKpn6ZeQ4kSaoMdOg== X-Received: by 2002:a05:600c:8883:b0:488:a82f:bb95 with SMTP id 5b1f17b1804b1-488d689c18fmr221931445e9.29.1776251632200; Wed, 15 Apr 2026 04:13:52 -0700 (PDT) Received: from bazzite ([102.128.175.252]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488f0ebd0e1sm17995625e9.28.2026.04.15.04.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 04:13:51 -0700 (PDT) From: Louis Kotze To: Ping-Ke Shih Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, rtl8821cerfe2@gmail.com, Louis Kotze Subject: [PATCH v2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport Date: Wed, 15 Apr 2026 13:13:37 +0200 Message-ID: <20260415111339.453602-1-loukot@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410080017.82946-1-loukot@gmail.com> References: <20260410080017.82946-1-loukot@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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. In response to review feedback on v1, the 4x multiplier was also re-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: (!) =3D 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 specific bug the patch fixes. 2. Calibration times are I/O bound (USB H2C/C2H round-trip latency), not CPU or memory bound. 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. Signed-off-by: Louis Kotze Acked-by: Ping-Ke Shih --- Changes since v1: - Fix comment style per Ping-Ke Shih review (first line '/*' on its own line, kernel-standard format). - Add stress-test verification table to the commit message. The 4x multiplier was re-measured on 5GHz under CPU stress, memory stress, and combined stress using stress-ng. DACK max is 71ms in all four scenarios, confirming calibration times are I/O bound (USB H2C/C2H round-trip) and not affected by host-side load. - Drop v1 patch 2/2 ("make RF calibration timeouts non-fatal on USB"). As Ping-Ke noted, the return code from rtw89_phy_rfk_*_and_wait() is discarded by all 8922a callers, making the non-fatal change a no-op for 8922a. Worse, the one 8922d caller that does check the return (rtw8922d_rfk_tssi) uses it to fall back to non-TSSI mode on calibration failure =E2=80=94 patch 2/2 would have silently broken that fallback. With patch 1/2's multiplier alone, 25 connect/disconnect cycles complete with zero failures, and the new stress matrix above confirms the margin. 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/wireles= s/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 *rtwd= ev, const char *rfk_name, struct rtw89_rfk_wait_info *wait =3D &rtwdev->rfk_wait; unsigned long time_left; =20 + /* + * 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 =3D=3D RTW89_HCI_TYPE_USB) + ms *=3D 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); --=20 2.53.0