r8169: enable more devices ASPM support
v2 cover r8169: enable more devices ASPM support
This series of patches will enable more devices ASPM support. It also fix a RTL8126 cannot enter L1 substate issue when ASPM is enabled.
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 | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
--
2.43.0
PATCH v2 1/2 r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
This patch will enable RTL8168H/RTL8168EP/RTL8168FP ASPM support on the platforms that have tested with ASPM enabled.
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -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;
Signature · 1 line
2.43.0
PATCH v2 2/2 r8169: disable RTL8126 ZRX-DC timeout
In reply to ChunHao LinDisable 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.
--- drivers/net/ethernet/realtek/r8169_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/ethernet/realtek/r8169_main.c +20 -0
@@ -2852,6 +2852,25 @@ 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; +u8 val; + +#define RTL_GEN3_RELATED_OFF 0x0890 +#define RTL_GEN3_ZRXDC_NONCOMPL 0x1 +if (pdev->cfg_size >RTL_GEN3_RELATED_OFF && +pci_read_config_byte (pdev,RTL_GEN3_RELATED_OFF , &val) ==PCIBIOS_SUCCESSFUL && +pci_write_config_byte (pdev,RTL_GEN3_RELATED_OFF , val & ~RTL_GEN3_ZRXDC_NONCOMPL ) ==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 +3843,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); }
Signature · 1 line
2.43.0
Heiner Kallweit
maintainerRe: [PATCH net-next v2 2/2] r8169: disable RTL8126 ZRX-DC timeout
Quoted 18 lines · 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 <[email protected]>--- drivers/net/ethernet/realtek/r8169_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/net/ethernet/realtek/r8169_main.c +1
-0@@ -2852,6 +2852,25 @@ 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)
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, int addr) · line 2865
Quoted 10 lines
drivers/net/ethernet/realtek/r8169_main.c +10
-0+{ +struct pci_dev *pdev = tp->pci_dev; +u32 csi; +u8 val; + +#define RTL_GEN3_RELATED_OFF 0x0890 +#define RTL_GEN3_ZRXDC_NONCOMPL 0x1 +if (pdev->cfg_size >RTL_GEN3_RELATED_OFF && +pci_read_config_byte (pdev,RTL_GEN3_RELATED_OFF , &val) ==PCIBIOS_SUCCESSFUL && +pci_write_config_byte (pdev,RTL_GEN3_RELATED_OFF , val & ~RTL_GEN3_ZRXDC_NONCOMPL ) ==PCIBIOS_SUCCESSFUL )
These two lines are too long. Netdev allows only 80 chars. checkpatch.pl would have noticed you.
Apart from that, looks good to me.
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, int addr) · line 2871
Quoted 6 lines
drivers/net/ethernet/realtek/r8169_main.c +6
-0+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 );
For my understanding: The csi functions always deal with 32bit values. Does this mean that all Realtek-specific registers in extended config space are 32bit registers?
Quoted 13 lines
drivers/net/ethernet/realtek/r8169_main.c +3
-0+} +static void rtl_set_aspm_entry_latency (struct rtl8169_private *tp,u8 val) {struct pci_dev *pdev = tp->pci_dev;@@ -3824,6 +3843,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); }
RE: [PATCH net-next v2 2/2] r8169: disable RTL8126 ZRX-DC timeout
Quoted 36 lines
External mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp,
Quoted 15 lines · 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 <[email protected]>--- drivers/net/ethernet/realtek/r8169_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/net/ethernet/realtek/r8169_main.c +0
-0@@ -2852,6 +2852,25 @@ static u32 rtl_csi_read(struct rtl8169_private *tp,int addr)
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, int addr)
Quoted 11 lines
drivers/net/ethernet/realtek/r8169_main.c +9
-0RTL_R32(tp, CSIDR) : ~0; } +static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp) { + struct pci_dev *pdev = tp->pci_dev; + u32 csi; + u8 val; + +#define RTL_GEN3_RELATED_OFF 0x0890 +#define RTL_GEN3_ZRXDC_NONCOMPL 0x1 + if (pdev->cfg_size > RTL_GEN3_RELATED_OFF && + pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val) ==
PCIBIOS_SUCCESSFUL&&
Quoted 8 lines
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, · line 2864
Quoted 2 lines
drivers/net/ethernet/realtek/r8169_main.c +2
-0+pci_write_config_byte (pdev,RTL_GEN3_RELATED_OFF , val & +~RTL_GEN3_ZRXDC_NONCOMPL) == PCIBIOS_SUCCESSFUL)These two lines are too long. Netdev allows only 80 chars. checkpatch.pl would have noticed you.
Apart from that, looks good to me.
I will fix it. Thanks.
Quoted 25 lines
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, int addr)
Quoted 4 lines
drivers/net/ethernet/realtek/r8169_main.c +4
-0+return ; + + netdev_notice_once(tp->dev, + "No native access to PCI extended config space, falling back toCSI\n");
drivers/net/ethernet/realtek/r8169_main.c static u32 rtl_csi_read(struct rtl8169_private *tp, · line 2871
Quoted 3 lines
drivers/net/ethernet/realtek/r8169_main.c +3
-0+ csi =rtl_csi_read (tp,RTL_GEN3_RELATED_OFF ); +rtl_csi_write (tp,RTL_GEN3_RELATED_OFF , csi & + ~RTL_GEN3_ZRXDC_NONCOMPL );For my understanding: The csi functions always deal with 32bit values. Does this mean that all Realtek-specific registers in extended config space are 32bit registers?
Quoted 12 lines
drivers/net/ethernet/realtek/r8169_main.c +2
-0+} +static void rtl_set_aspm_entry_latency (struct rtl8169_private *tp,u8 val) { struct pci_dev *pdev = tp->pci_dev; @@ -3824,6 +3843,7 @@ staticvoid
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);}