public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/2] r8169: enable more devices ASPM support
@ 2025-03-18  8:37 ChunHao Lin
  2025-03-18  8:37 ` [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP " ChunHao Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: ChunHao Lin @ 2025-03-18  8:37 UTC (permalink / raw)
  To: hkallweit1, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel, ChunHao Lin

This series of patches will enable more devices ASPM support.
It also fix a RTL8126 cannot enter L1 substate issue when ASPM is
enabled.


V2 -> V3: Fix code format issue.
V1 -> V2: Add name for pcie extended config space 0x890 and bit 0.

ChunHao Lin (2):
  r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
  r8169: disable RTL8126 ZRX-DC timeout

 drivers/net/ethernet/realtek/r8169_main.c | 29 ++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

--
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
  2025-03-18  8:37 [PATCH net-next v3 0/2] r8169: enable more devices ASPM support ChunHao Lin
@ 2025-03-18  8:37 ` ChunHao Lin
  2025-03-18 20:08   ` Heiner Kallweit
  2025-03-18  8:37 ` [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout ChunHao Lin
  2025-03-24 19:30 ` [PATCH net-next v3 0/2] r8169: enable more devices ASPM support patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: ChunHao Lin @ 2025-03-18  8:37 UTC (permalink / raw)
  To: hkallweit1, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel, ChunHao Lin

This patch will enable RTL8168H/RTL8168EP/RTL8168FP ASPM support on
the platforms that have tested with ASPM enabled.

Signed-off-by: ChunHao Lin <hau@realtek.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index b18daeeda40d..3c663fca07d3 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5398,7 +5398,7 @@ static void rtl_init_mac_address(struct rtl8169_private *tp)
 /* register is set if system vendor successfully tested ASPM 1.2 */
 static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
 {
-	if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&
+	if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
 	    r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)
 		return true;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout
  2025-03-18  8:37 [PATCH net-next v3 0/2] r8169: enable more devices ASPM support ChunHao Lin
  2025-03-18  8:37 ` [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP " ChunHao Lin
@ 2025-03-18  8:37 ` ChunHao Lin
  2025-03-18 20:08   ` Heiner Kallweit
  2025-03-24 19:30 ` [PATCH net-next v3 0/2] r8169: enable more devices ASPM support patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: ChunHao Lin @ 2025-03-18  8:37 UTC (permalink / raw)
  To: hkallweit1, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel, ChunHao Lin

Disable it due to it dose not meet ZRX-DC specification. If it is enabled,
device will exit L1 substate every 100ms. Disable it for saving more power
in L1 substate.

Signed-off-by: ChunHao Lin <hau@realtek.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 3c663fca07d3..fcb87059dc5d 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2852,6 +2852,32 @@ static u32 rtl_csi_read(struct rtl8169_private *tp, int addr)
 		RTL_R32(tp, CSIDR) : ~0;
 }
 
+static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp)
+{
+	struct pci_dev *pdev = tp->pci_dev;
+	u32 csi;
+	int rc;
+	u8 val;
+
+#define RTL_GEN3_RELATED_OFF	0x0890
+#define RTL_GEN3_ZRXDC_NONCOMPL	0x1
+	if (pdev->cfg_size > RTL_GEN3_RELATED_OFF) {
+		rc = pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val);
+		if (rc == PCIBIOS_SUCCESSFUL) {
+			val &= ~RTL_GEN3_ZRXDC_NONCOMPL;
+			rc = pci_write_config_byte(pdev, RTL_GEN3_RELATED_OFF,
+						   val);
+			if (rc == PCIBIOS_SUCCESSFUL)
+				return;
+		}
+	}
+
+	netdev_notice_once(tp->dev,
+		"No native access to PCI extended config space, falling back to CSI\n");
+	csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF);
+	rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL);
+}
+
 static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val)
 {
 	struct pci_dev *pdev = tp->pci_dev;
@@ -3824,6 +3850,7 @@ static void rtl_hw_start_8125d(struct rtl8169_private *tp)
 
 static void rtl_hw_start_8126a(struct rtl8169_private *tp)
 {
+	rtl_disable_zrxdc_timeout(tp);
 	rtl_set_def_aspm_entry_latency(tp);
 	rtl_hw_start_8125_common(tp);
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
  2025-03-18  8:37 ` [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP " ChunHao Lin
@ 2025-03-18 20:08   ` Heiner Kallweit
  0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2025-03-18 20:08 UTC (permalink / raw)
  To: ChunHao Lin, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel

On 18.03.2025 09:37, ChunHao Lin wrote:
> This patch will enable RTL8168H/RTL8168EP/RTL8168FP ASPM support on
> the platforms that have tested with ASPM enabled.
> 
> Signed-off-by: ChunHao Lin <hau@realtek.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout
  2025-03-18  8:37 ` [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout ChunHao Lin
@ 2025-03-18 20:08   ` Heiner Kallweit
  0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2025-03-18 20:08 UTC (permalink / raw)
  To: ChunHao Lin, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel

On 18.03.2025 09:37, ChunHao Lin wrote:
> Disable it due to it dose not meet ZRX-DC specification. If it is enabled,
> device will exit L1 substate every 100ms. Disable it for saving more power
> in L1 substate.
> 
> Signed-off-by: ChunHao Lin <hau@realtek.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 

Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 0/2] r8169: enable more devices ASPM support
  2025-03-18  8:37 [PATCH net-next v3 0/2] r8169: enable more devices ASPM support ChunHao Lin
  2025-03-18  8:37 ` [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP " ChunHao Lin
  2025-03-18  8:37 ` [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout ChunHao Lin
@ 2025-03-24 19:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-24 19:30 UTC (permalink / raw)
  To: ChunHao Lin
  Cc: hkallweit1, nic_swsd, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-kernel

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 18 Mar 2025 16:37:19 +0800 you wrote:
> This series of patches will enable more devices ASPM support.
> It also fix a RTL8126 cannot enter L1 substate issue when ASPM is
> enabled.
> 
> 
> V2 -> V3: Fix code format issue.
> V1 -> V2: Add name for pcie extended config space 0x890 and bit 0.
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
    https://git.kernel.org/netdev/net-next/c/3d9b8ac53412
  - [net-next,v3,2/2] r8169: disable RTL8126 ZRX-DC timeout
    https://git.kernel.org/netdev/net-next/c/b48688ea3c9a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-24 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  8:37 [PATCH net-next v3 0/2] r8169: enable more devices ASPM support ChunHao Lin
2025-03-18  8:37 ` [PATCH net-next v3 1/2] r8169: enable RTL8168H/RTL8168EP/RTL8168FP " ChunHao Lin
2025-03-18 20:08   ` Heiner Kallweit
2025-03-18  8:37 ` [PATCH net-next v3 2/2] r8169: disable RTL8126 ZRX-DC timeout ChunHao Lin
2025-03-18 20:08   ` Heiner Kallweit
2025-03-24 19:30 ` [PATCH net-next v3 0/2] r8169: enable more devices ASPM support patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox