r8169 NICs on some platforms have abysmal speed when ASPM is enabled.
Same issue can be observed with older vendor drivers.
The issue is however solved by the latest vendor driver. There's a new
mechanism, which disables r8169's internal ASPM when the NIC has
substantial network traffic, and vice versa.
So implement the same mechanism here to resolve the issue.
Signed-off-by: Kai-Heng Feng <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 36 +++++++++++++++++++++++
1 file changed, 36 insertions(+)
The latest vendor driver enables ASPM for more recent r8168 NICs, do the
same here to match the behavior.
In addition, pci_disable_link_state() is only used for RTL8168D/8111D in
vendor driver, also match that.
Signed-off-by: Kai-Heng Feng <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 34 +++++++++++++++++------
1 file changed, 26 insertions(+), 8 deletions(-)
@@ -2666,8 +2666,11 @@ static void rtl_pcie_state_l2l3_disable(struct rtl8169_private *tp)staticvoidrtl_hw_aspm_clkreq_enable(structrtl8169_private*tp,boolenable){+if(!tp->aspm_supported)+return;+/* Don't enable ASPM in the chip if OS can't control ASPM */-if(enable&&tp->aspm_manageable){+if(enable){RTL_W8(tp,Config5,RTL_R8(tp,Config5)|ASPM_en);RTL_W8(tp,Config2,RTL_R8(tp,Config2)|ClkReqEn);}else{
r8169 NICs on some platforms have abysmal speed when ASPM is enabled.
Same issue can be observed with older vendor drivers.
The issue is however solved by the latest vendor driver. There's a new
Is there any errata document from Realtek recommending this workaround?
Any prove that it solves the issues in all cases of ASPM issues we've
seen so far?
Also your heuristics logic seems to be different from the one in r8168.
The vendor driver considers also rx packets.
In addition you use this logic also for chip versions not covered by
r8168, like RTL8125. Any info from Realtek regarding these chip versions?
mechanism, which disables r8169's internal ASPM when the NIC has
substantial network traffic, and vice versa.
10 packets per second I wouldn't call substantial traffic.
I'm afraid we may open a can of worms and may be bothered
with bug reports and complaints again.
So implement the same mechanism here to resolve the issue.
For me this risk is too high to re-enable ASPM for a lot of chip
versions w/o any official errata and workaround information.
I propose you make this change downstream, and if there are no
user complaints after some months I may consider to have something
like that in the mainline driver.
On Wed, Aug 4, 2021 at 3:57 AM Heiner Kallweit [off-list ref] wrote:
On 03.08.2021 17:28, Kai-Heng Feng wrote:
quoted
r8169 NICs on some platforms have abysmal speed when ASPM is enabled.
Same issue can be observed with older vendor drivers.
The issue is however solved by the latest vendor driver. There's a new
Is there any errata document from Realtek recommending this workaround?
Any prove that it solves the issues in all cases of ASPM issues we've
seen so far?
Actually I don't know. Let me ask Realtek.
Also your heuristics logic seems to be different from the one in r8168.
The vendor driver considers also rx packets.
rx packets are accumulated in rtl_rx().
In addition you use this logic also for chip versions not covered by
r8168, like RTL8125. Any info from Realtek regarding these chip versions?
Right, maybe 8125 doesn't need dynamic ASPM. Let me ask them...
quoted
mechanism, which disables r8169's internal ASPM when the NIC has
substantial network traffic, and vice versa.
10 packets per second I wouldn't call substantial traffic.
I'll change the wording in v2.
I'm afraid we may open a can of worms and may be bothered
with bug reports and complaints again.
Let's hope this time it works.
quoted
So implement the same mechanism here to resolve the issue.
For me this risk is too high to re-enable ASPM for a lot of chip
versions w/o any official errata and workaround information.
I propose you make this change downstream, and if there are no
user complaints after some months I may consider to have something
like that in the mainline driver.
Sure, let's see how it works in downstream kernel first.
Sorry, I forgot the timer is in interrupt context.
Or is it safe to use workqueue for rtl_{,un}lock_config_regs() and
rtl_hw_aspm_clkreq_enable()?
Kai-Heng
r8169 NICs on some platforms have abysmal speed when ASPM is enabled.
Same issue can be observed with older vendor drivers.
The issue is however solved by the latest vendor driver. There's a new
mechanism, which disables r8169's internal ASPM when the NIC has
substantial network traffic, and vice versa.
So implement the same mechanism here to resolve the issue.
Signed-off-by: Kai-Heng Feng <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 36 +++++++++++++++++++++++
1 file changed, 36 insertions(+)
I have one more question / concern regarding this workaround:
If bigger traffic starts and results in a congestion (let's call it like that
because we don't know in detail what happens in the chip), then it may take
up to a second until ASPM gets disabled and traffic gets back to normal.
This second is good enough to prevent that the timeout watchdog fires.
However in this second supposedly traffic is very limited, if possible at all.
Means if we have a network traffic pattern with alternating quiet and busy
periods then we may see a significant impact on performance.
Is this something that you tested?
On Sat, Aug 7, 2021 at 2:47 AM Heiner Kallweit [off-list ref] wrote:
On 03.08.2021 17:28, Kai-Heng Feng wrote:
quoted
r8169 NICs on some platforms have abysmal speed when ASPM is enabled.
Same issue can be observed with older vendor drivers.
The issue is however solved by the latest vendor driver. There's a new
mechanism, which disables r8169's internal ASPM when the NIC has
substantial network traffic, and vice versa.
So implement the same mechanism here to resolve the issue.
Signed-off-by: Kai-Heng Feng <redacted>
---
drivers/net/ethernet/realtek/r8169_main.c | 36 +++++++++++++++++++++++
1 file changed, 36 insertions(+)
I have one more question / concern regarding this workaround:
If bigger traffic starts and results in a congestion (let's call it like that
because we don't know in detail what happens in the chip), then it may take
up to a second until ASPM gets disabled and traffic gets back to normal.
This second is good enough to prevent that the timeout watchdog fires.
However in this second supposedly traffic is very limited, if possible at all.
Means if we have a network traffic pattern with alternating quiet and busy
periods then we may see a significant impact on performance.
Is this something that you tested?
No, we didn't test this scenario.
Realtek told us that dynamic ASPM is also used by Windows driver, but
I don't know the interval used by Windows driver.
For now I think it's better to stick with vendor defined value.
Kai-Heng