From nobody Sun Jul 19 18:50:52 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4h3CQk1ggkz6lR2V for ; Sun, 19 Jul 2026 18:50:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h3CQj0wXbz3RDX for ; Sun, 19 Jul 2026 18:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784487053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vGVEtS5mCis6cBYEJQxKZEa74OtRWuSo9t3JBHGxRQA=; b=qr2Nt4MAVf4zjdWtMN9fU4ac0V3kqtIB0txuYfXH3L9apPVUc5t//tBF1CjbfDkMDjVAH8 I2FJoCTD8Wyt+0OkmB0JasMBby2Z8e/Q614IderDZjf1mRu5KavnP7gB0UthOxUihblD4m wxgOnrXMpVgEj+0TTGPIRBqYzGZGbdQeAj5zAZszxdZsVUzQN5k9h1DQAS4qwuVts0wfUB Xh9MTMDgX/mxA2XONVDa3qkcwMdM4jBTRlvUHI54BXn3zYr0pqQAtIWXr1prbS2Vr9wUnQ mBwKx0GOOE9e6Fl4pTuo7Xf7QgTqAYcYl8VXBjtsfDWxeEoDpEOdaR+lvvfmRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784487053; a=rsa-sha256; cv=none; b=C6WRjm7MOJwjbmmq5S4f6TT2downx+LYX/pBbLXei35MbWPVf8wCXZeMdILZXk82Cl1tDK 6+yTliJzPcK/ZPG0D9CZQ3L/dk5FKXNgCzbLSLEa5RvW/QAsiwq2ki64o2h6pNM9O2vRTP ckWNw0uvxlUT1d+ukgnPptdDVZ29qIS+biDRaFk4OZcv6Pkp38+5tzAeH+3gq6nqbZpp46 udYMqnfL8S1tMZ67PpeJvPubJEv6j38XEiP8XP1AqhwctKeZDEBfOXWrNmpLmX7ZnAeMpa x/CkN5sS+2mWkgOxf42LdWfY9EIKAUrtqinFvBzwUEWwsguKVSmki3dvoIfi3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784487053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vGVEtS5mCis6cBYEJQxKZEa74OtRWuSo9t3JBHGxRQA=; b=DX5HYTRg+1gstV4cPSnia3jWkifHvQ1dBgYCnuvX9scpaioNR4jaggAE8Iu90/qeuxr9Z8 EhrKb+8XM06CTnrwgJWh0R7r5fmbakHZybE04LsmXGjDKwHpOTjR+epI6MR1j/ijFnBmgQ yYtrURxD4Qg5fSdl18eGlk+VyFWYVNpQ2R92yCN8kzxq3JQwgEDIvEqNcDVRmvUhN9GsnB IUTpzSzwJtKyt6RI7gTN1C4uCCsJj1EgN/Eimd7JI3XnCQBS9XwdXaW8UuIfvVOpiuVKJD Wi3oK19nJDOljQvctsPAesNTHxlHJM5D+662Bh+xt6PabwtlnHuKpQYb4DegKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h3CQh5yHqzBRM for ; Sun, 19 Jul 2026 18:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f48b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 19 Jul 2026 18:50:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: =?utf-8?Q?J=C3=A9r=C3=A9mie?= Jourdin From: Adrian Chadd Subject: git: b0c14eae1060 - main - re(4): add hw.re.aspm_disable loader tunable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0c14eae10609f7d688b31d112de2a641d9cc516 Auto-Submitted: auto-generated Date: Sun, 19 Jul 2026 18:50:52 +0000 Message-Id: <6a5d1c8c.3f48b.65ba8348@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b0c14eae10609f7d688b31d112de2a641d9cc516 commit b0c14eae10609f7d688b31d112de2a641d9cc516 Author: Jérémie Jourdin AuthorDate: 2026-07-19 18:49:12 +0000 Commit: Adrian Chadd CommitDate: 2026-07-19 18:49:14 +0000 re(4): add hw.re.aspm_disable loader tunable re(4) has unconditionally disabled ASPM L0s/L1 and CLKREQ at attach for years; on laptops this costs 200mW+ (requested by adrian@ in the PR). Make it a tunable following the existing hw.re.* pattern: * default 1 keeps today's behavior; * 0 preserves the firmware-configured ASPM state at attach and skips the watchdog re-assert from the previous revision. Documented in re.4. * Verified on RTL8168H (XID 0x541): with hw.re.aspm_disable=0, attach no longer logs "ASPM disabled" and pciconf -lcb shows the firmware Link Control state preserved -- including Clock PM, which the unconditional code previously cleared. * Default (1) is behaviorally identical to the current driver. * Note the tunable also stops the driver clearing CLKREQ, a small power win even where firmware leaves L0s/L1 off. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58280 PR: kern/166724 --- share/man/man4/re.4 | 11 ++++++++++- sys/dev/re/if_re.c | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/share/man/man4/re.4 b/share/man/man4/re.4 index 0020af64b330..6d190c944b34 100644 --- a/share/man/man4/re.4 +++ b/share/man/man4/re.4 @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 9, 2026 +.Dd July 13, 2026 .Dt RE 4 .Os .Sh NAME @@ -182,6 +182,15 @@ Tunables can be set at the prompt before booting the kernel or stored in .Xr loader.conf 5 . .Bl -tag -width "xxxxxx" +.It Va hw.re.aspm_disable +This tunable controls whether the driver disables PCI Express ASPM +(the L0s and L1 link states and CLKREQ) on the device. +ASPM is a known trigger of transmit stalls and watchdog timeouts on +many supported controllers, so it is disabled by default. +Set to 0 to keep the ASPM configuration programmed by the firmware, +trading reliability under sustained transmit load for lower link +power consumption. +The default value is 1. .It Va hw.re.intr_filter This tunable makes driver use interrupt filter handler on controllers that support MSI/MSI-X capability. diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 5a3e8e68d26f..5a1e8ad554cb 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -167,6 +167,8 @@ static int msix_disable = 0; TUNABLE_INT("hw.re.msix_disable", &msix_disable); static int prefer_iomap = 0; TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); +static int aspm_disable = 1; +TUNABLE_INT("hw.re.aspm_disable", &aspm_disable); #define RE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) @@ -1369,8 +1371,14 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } - /* Disable ASPM L0S/L1 and CLKREQ. */ - if (sc->rl_expcap != 0) { + /* + * Disable ASPM L0S/L1 and CLKREQ. ASPM is implicated in Tx + * stalls and watchdog timeouts on many chip revisions, so it + * is turned off by default; set the hw.re.aspm_disable tunable + * to 0 to keep the firmware-configured ASPM state and trade + * reliability under sustained load for link power management. + */ + if (aspm_disable != 0 && sc->rl_expcap != 0) { cap = pci_read_config(dev, sc->rl_expcap + PCIER_LINK_CAP, 2); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { @@ -3658,11 +3666,12 @@ re_watchdog(struct rl_softc *sc) } /* - * ASPM is a common cause of these Tx timeouts. Make sure L0s/L1 + * ASPM is a common cause of these Tx timeouts. Unless the + * administrator has opted to keep ASPM enabled, make sure L0s/L1 * and CLKREQ are still disabled on the link before reinitializing; * firmware or a power transition may have re-armed them. */ - if (sc->rl_expcap != 0) { + if (aspm_disable != 0 && sc->rl_expcap != 0) { uint16_t ctl; ctl = pci_read_config(sc->rl_dev,