Skip to content

Commit a7e480a

Browse files
committed
r8169: disable RTL8126 ZRX-DC timeout
jira LE-3460 Rebuild_History Non-Buildable kernel-6.12.0-55.18.1.el10_0 commit-author ChunHao Lin <[email protected]> commit b48688e 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 <[email protected]> Reviewed-by: Heiner Kallweit <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> (cherry picked from commit b48688e) Signed-off-by: Jonathan Maple <[email protected]>
1 parent d7e2d76 commit a7e480a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,6 +2850,32 @@ static u32 rtl_csi_read(struct rtl8169_private *tp, int addr)
28502850
RTL_R32(tp, CSIDR) : ~0;
28512851
}
28522852

2853+
static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp)
2854+
{
2855+
struct pci_dev *pdev = tp->pci_dev;
2856+
u32 csi;
2857+
int rc;
2858+
u8 val;
2859+
2860+
#define RTL_GEN3_RELATED_OFF 0x0890
2861+
#define RTL_GEN3_ZRXDC_NONCOMPL 0x1
2862+
if (pdev->cfg_size > RTL_GEN3_RELATED_OFF) {
2863+
rc = pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val);
2864+
if (rc == PCIBIOS_SUCCESSFUL) {
2865+
val &= ~RTL_GEN3_ZRXDC_NONCOMPL;
2866+
rc = pci_write_config_byte(pdev, RTL_GEN3_RELATED_OFF,
2867+
val);
2868+
if (rc == PCIBIOS_SUCCESSFUL)
2869+
return;
2870+
}
2871+
}
2872+
2873+
netdev_notice_once(tp->dev,
2874+
"No native access to PCI extended config space, falling back to CSI\n");
2875+
csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF);
2876+
rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL);
2877+
}
2878+
28532879
static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val)
28542880
{
28552881
struct pci_dev *pdev = tp->pci_dev;
@@ -3816,6 +3842,7 @@ static void rtl_hw_start_8125b(struct rtl8169_private *tp)
38163842

38173843
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
38183844
{
3845+
rtl_disable_zrxdc_timeout(tp);
38193846
rtl_set_def_aspm_entry_latency(tp);
38203847
rtl_hw_start_8125_common(tp);
38213848
}

0 commit comments

Comments
 (0)