Re: r8169: Long link becomes ready times

2017-04-22 Thread Francois Romieu
Paul Menzel  :
[...]
> The ASRock E350M1 has a Realtek ethernet controller.
> 
> It takes almost three seconds for the link to become ready. This is
> noticeable after resume from suspend, where the user wants to continue
> working but first has to wait for the network.
> 
> This test is done with Linux 4.10.
[...]
> The test below is done, removing the module, and then inserting it.
> 
> ```
> Apr 22 10:56:11.919311 myasrocke350m1 kernel: r8169 :03:00.0 eth0: 
> RTL8168e/8111e at 0xf82ad000, bc:5f:f4:c8:d3:98, XID 0c20 IRQ 26
> Apr 22 10:56:11.920631 myasrocke350m1 kernel: r8169 :03:00.0 eth0: jumbo 
> features [frames: 9200 bytes, tx checksumming: ko]
> Apr 22 10:56:11.967396 myasrocke350m1 kernel: r8169 :03:00.0 eth6: 
> renamed from eth0
> Apr 22 10:56:12.064323 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_UP): 
> eth6: link is not ready
> Apr 22 10:56:12.179106 myasrocke350m1 kernel: r8169 :03:00.0: firmware: 
> direct-loading firmware rtl_nic/rtl8168e-2.fw
> Apr 22 10:56:12.247858 myasrocke350m1 kernel: r8169 :03:00.0 eth6: link 
> down
> Apr 22 10:56:12.248593 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_UP): 
> eth6: link is not ready
> Apr 22 10:56:14.992108 myasrocke350m1 kernel: r8169 :03:00.0 eth6: link up
> Apr 22 10:56:14.993299 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): 
> eth6: link becomes ready
> ```
> 
> Is it possible to get this well below one second?

Gross as it is, the link detection is already irq driven. Most currently
used delays - see grep -E '(sleep|delay)' drivers/.../r8169.c - are
supposed to be busy waiting loops with a moderate (well...) delay per
loop. The iteration bound is not expected to make a difference.

So, unless there is a big crawling sleep/delay hidden somewhere, this part
of the r8169 driver should not induce huge delays.

Realtek does not communicate hardware documentation, neither programming
specification nor known bugs. Some phy related pieces of material may be
found on their site but you would have to experiment a lot to check if
things can behave differently.

I also experience ~3s link down / link up transition with a 8168c when
connected to a 3Com 4200G. Same 2~3s figures with an intel 82578dc.
It looks similar with a 82574l.

I've never aimed at well below one second (500 ms ?) reliable autoneg.
The phy man may have a different vision.

-- 
Ueimor


r8169: Long link becomes ready times

2017-04-22 Thread Paul Menzel
Dear Linux folks,


The ASRock E350M1 has a Realtek ethernet controller.

It takes almost three seconds for the link to become ready. This is
noticeable after resume from suspend, where the user wants to continue
working but first has to wait for the network.

This test is done with Linux 4.10.

```
$ sudo lspci -s 3:00.0 -nn -v
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. 
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 06)
Subsystem: ASRock Incorporation Motherboard (one of many) [1849:8168]
Flags: bus master, fast devsel, latency 0, IRQ 26
I/O ports at 1000 [size=256]
Memory at f0004000 (64-bit, prefetchable) [size=4K]
Memory at f000 (64-bit, prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Endpoint, MSI 01
Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
Capabilities: [d0] Vital Product Data
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
Kernel driver in use: r8169
Kernel modules: r8169
```

The test below is done, removing the module, and then inserting it.

```
Apr 22 10:56:11.919311 myasrocke350m1 kernel: r8169 :03:00.0 eth0: 
RTL8168e/8111e at 0xf82ad000, bc:5f:f4:c8:d3:98, XID 0c20 IRQ 26
Apr 22 10:56:11.920631 myasrocke350m1 kernel: r8169 :03:00.0 eth0: jumbo 
features [frames: 9200 bytes, tx checksumming: ko]
Apr 22 10:56:11.967396 myasrocke350m1 kernel: r8169 :03:00.0 eth6: renamed 
from eth0
Apr 22 10:56:12.064323 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_UP): eth6: 
link is not ready
Apr 22 10:56:12.179106 myasrocke350m1 kernel: r8169 :03:00.0: firmware: 
direct-loading firmware rtl_nic/rtl8168e-2.fw
Apr 22 10:56:12.247858 myasrocke350m1 kernel: r8169 :03:00.0 eth6: link down
Apr 22 10:56:12.248593 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_UP): eth6: 
link is not ready
Apr 22 10:56:14.992108 myasrocke350m1 kernel: r8169 :03:00.0 eth6: link up
Apr 22 10:56:14.993299 myasrocke350m1 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): 
eth6: link becomes ready
```

Is it possible to get this well below one second?


Thanks,

Paul

signature.asc
Description: This is a digitally signed message part