From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f13.google.com (mail-pj2-f13.google.com [74.125.227.141]) (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 0496C483BC8 for ; Mon, 14 Sep 2026 13:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789390881; cv=none; b=ReAjSuc4AK5yQvW62v1Wn/cLj2rnp4dvyYW/IayWx63fKzrdW7DPu+2GbB5NE3eZEhepw6WT65tj3wXEcDLhsdbLadsk1k/pmksQ7A+t545TmfcuOTq7577fSCuiqcYPIawbA7MTjtJrPLva0Oiq08UDBSDPj2XPFPMylTNQtEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789390881; c=relaxed/simple; bh=vV1KBM/CzTDp19ZJa/oiYxMhH5ShLnt22gZbgeuW7m4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lAn4JwytNNWXuNs4XQl/oXtREEv3vjJ9XmCZXnw5ycdl9MU1t3fER4PoJEd0pR1uN5ANqZIHj5oXZcJ8qXBVbzsTGdRLyc45cAZZiFsQ9uCKgwykSxvX4nYIi4X0bnjkLJo7mUOM9ViZHB7cnSfS+U7oEBjJys2nktAgpWTeNWs= 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=TF0eK80g; arc=none smtp.client-ip=74.125.227.141 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="TF0eK80g" Received: by mail-pj2-f13.google.com with SMTP id 98e67ed59e1d1-39d654f02baso1663221a91.3 for ; Mon, 14 Sep 2026 06:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789390879; x=1789995679; 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:content-type; bh=w0zMSPeSGbDLM5HJhTpgpS0ZmvGUDQ4KNMTTEqPdWPg=; b=TF0eK80gA3gFcmV3dQ5bk2kCRl4kAgbfbgFlVe5g783KyZDzIyaAN4YimDh679psxB oAxM9KdlVBCkUjAOjAsZCdtgdG9Uw+AaSkzW7MqCGnr3nk+jWEFhH3jRz1aqUOja7Qs8 JEe6NQcD6kCSFy94uccTCrZX0uxNJgM2jjSqrpghMqhM88JbYxM0sAFE4ug/zhIggAup zQee4WjUbxRF5f4oaSEzmtTEgdgoh7Nk93eCmwPTtLv3/MxuRP6Gnwfmu0GHzz7bAHzr 6+ubMaUhf5yKbCsoGrfSfBx5q9O0SHz7ntNQw7f8Lg2TytZpKf0LBzbXz2cuTuxLV019 Nb7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789390879; x=1789995679; 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:content-type; bh=w0zMSPeSGbDLM5HJhTpgpS0ZmvGUDQ4KNMTTEqPdWPg=; b=SNd/LcHx3ygJCOuc/SKTmS3qCMwD98KIjmP7xsDg+z/tFUOw5lBVrJ6Pad3V5hIhoQ h4G9/9YC98htGL9qSROgFSYu0hwoO3zuWWNw9d/2stxqFswqZXR4srwcx2qIh3h1+KVJ bmpu61D46UNJm9HYBiKRI8GTGIehdi1ZVQbNL/gFszAJuKV/yU73ISBQpQ1YV3bCkYRN MylXLuy7CsXm4ak/n5X1hJWlwU9HgtRd91fO+jnlibwOabLQkjDKylc5smGz8ZiLlZ33 zLzXVIbXxs9Ll95xaoQgv4+sUadu73poSNt8Nr8N9LbdDhx+7t2zurX2iMq4dzg+n15K z10Q== X-Forwarded-Encrypted: i=1; AKwUvBzdcWPpUdTpwhFkzSyUB5Alad2S242IF/yYmYP2Cgm8a7J7D3RSqHe661I8zg/B2WO4RVBB9Q48IeVSSwk=@vger.kernel.org X-Gm-Message-State: AFuF++mI7HeGq2afrTcggi/QB/LVcuNMy+/QOVnXcgfXrYG4Vp3rZvW4 b4gb9/VBZZPKVCMswWdrSTWSbakncNpWQnDT1GFduYznwcvEMiKRFwpO X-Gm-Gg: AYBFou0YI4Adq6avVG0I9eTRNxFnlzYQJD+3XTeExHR5IJz89Ao2TR2eURs7z8keoGN l1P0Lv2vykVKf0lo8kTP4OsySe4fL4sGwAjVyx/M61KT6VreHAr6sN+DY9bfKv+VSc0Fofi8Q8q PGTMuOv2FST3wZ5InD+j35lzx/tUsfaDHqEOu41PisI+347LbWcU3WovhmpIoHaylz4TZaI8/1p lhuwjJ9okGIqa9ssJ+HwzzxRNX1SRrUI2rIL9QwYURyiu8hfuY/1pKZkEuIGJ55pNxhrCIquA/K w4Be6gNZX4RMRF/luw/C3g2XhoLXe+DzyBFPBDkq1jEBCXbOgyagExZN72J1w9xjWGkiiC4I+Z9 K5j1MyGQjdagkgqxK17ftCVeZ83DmY2rb+VcNTVcCjCeEpOqpcOMQJiCAshTYDEi2r2CFUMA0aS HnQkL3arbt2NJ4n/+CDuxgq6/RffnQcaLSwTDauqmW42sZiTdP0F3xPuFOYcspLdBkPMUOj2Bui L7UWjFNxDO2luhH1LaWlz2h X-Received: by 2002:a17:90b:5624:b0:38e:67e1:15b with SMTP id 98e67ed59e1d1-39debf93f0dmr5392681a91.6.1789390878954; Mon, 14 Sep 2026 06:01:18 -0700 (PDT) Received: from LAPTOP-450UDG4J ([223.185.135.143]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39d950913a6sm21081467a91.6.2026.09.14.06.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 06:01:17 -0700 (PDT) From: Yogesh Gaur To: Heiner Kallweit , nic_swsd@realtek.com Cc: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Javen Xu , Yogesh Gaur Subject: [PATCH net v4] r8169: don't enable chip LTR when the platform has not enabled LTR Date: Mon, 14 Sep 2026 18:30:49 +0530 Message-ID: <20260914130050.304-1-yogeshgaur.83@gmail.com> X-Mailer: git-send-email 2.55.0.windows.5 In-Reply-To: <20260911131352.2036-1-yogeshgaur.83@gmail.com> References: <20260911131352.2036-1-yogeshgaur.83@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: 8bit rtl_enable_ltr() programs the MAC to generate LTR messages - ALDPS_LTR_EN, LTR_SNOOP_EN, LTR_OBFF_LOCK_EN, plus LINK_SPEED_CHANGE_EN on RTL8125/RTL8126/RTL8127 - and rtl_hw_aspm_clkreq_enable() calls it on every ASPM enable, then goes on to let the chip trigger L1.2. The only gate is tp->aspm_manageable, which records that the OS is allowed to control ASPM. It says nothing about LTR. LTR is a separate PCIe capability that only works if every device on the path to the root port supports it. The PCI core works that out in pci_configure_ltr() and records the result in pci_dev->ltr_path; per PCIe r6.0 sec 7.5.3.16 a function must not issue LTR messages while LTR Mechanism Enable is clear. So on a platform whose hierarchy has no LTR path, the driver tells the chip to start sending LTR messages nothing will honour, and ties ALDPS - the PHY's link-down power saving - to them. A report against RTL8125B (rev 05, firmware rtl8125b-2_0.0.2) in a mini PC shows the effect: 291 link down/up transitions in one eight-hour boot, with repeated downshifts to 100Mbps, against four transitions at boot and then a stable link on the kernel before the LTR change. Gate the chip's LTR programming on pci_dev->ltr_path. That field exists only when CONFIG_PCIEASPM is enabled, so the test needs a preprocessor guard rather than IS_ENABLED(). With CONFIG_PCIEASPM=n the PCI core's pci_configure_ltr() is a stub and LTR is enabled nowhere, so the chip must not issue LTR messages in that configuration either. Note this does change CONFIG_PCIEASPM=n builds, which used to program chip LTR unconditionally: pci_disable_link_state() is a stub that returns success there, so tp->aspm_manageable ends up set. Fixes: 9ab94a32af70 ("r8169: enable LTR support") Assisted-by: LLM Signed-off-by: Yogesh Gaur --- v4: - Drop closes line. v3: https://lore.kernel.org/all/20260911131352.2036-1-yogeshgaur.83@gmail.com/ v2: https://lore.kernel.org/all/20260910130140.910-1-yogeshgaur.83@gmail.com/ v1: https://lore.kernel.org/all/20260909110554.1977-1-yogeshgaur.83@gmail.com/ NOT VERIFIED ON HARDWARE. The causal claim above is reasoned from the register writes. Compile-tested only: drivers/net/ethernet/realtek/r8169_main.o, x86_64 defconfig + R8169=m, built W=1 clean with both CONFIG_PCIEASPM=y and CONFIG_PCIEASPM=n. drivers/net/ethernet/realtek/r8169_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index ec4fc21fa21f..c305a8f19551 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -3037,6 +3037,18 @@ static void rtl_disable_exit_l1(struct rtl8169_private *tp) static void rtl_enable_ltr(struct rtl8169_private *tp) { + /* The chip must not issue LTR messages unless LTR is enabled for the + * whole path up to the root port. pci_configure_ltr() works that out + * and records the result in pci_dev->ltr_path, which exists only with + * CONFIG_PCIEASPM; without it the PCI core never enables LTR anywhere. + */ +#ifdef CONFIG_PCIEASPM + if (!tp->pci_dev->ltr_path) + return; +#else + return; +#endif + switch (tp->mac_version) { case RTL_GIGA_MAC_VER_80: r8168_mac_ocp_write(tp, 0xcdd0, 0x9003); -- 2.55.0.windows.5