raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.21k stars 5.03k forks source link

LAN7800 // USB3 host hangs with 100mbit links #6336

Open pevsonic opened 2 months ago

pevsonic commented 2 months ago

Describe the bug

With a Raspberry Pi 4 Model B I can reproducibly generate an ethernet hang using LAN7800 USB devices. (See steps listed)

Steps to reproduce the behaviour

On test setup here, this starts to fail within a couple of minutes, often as fast as 7 secs in.

Device (s)

Raspberry Pi 4 Mod. B

System

See above.

Logs

user@raspberrypi:~ $ iperf3 -c 10.0.2.230 --bind-dev eth1 -t 0 Connecting to host 10.0.2.230, port 5201 [ 5] local 10.0.2.1 port 39956 connected to 10.0.2.230 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 12.7 MBytes 106 Mbits/sec 0 331 KBytes
[ 5] 1.00-2.00 sec 11.3 MBytes 95.1 Mbits/sec 0 345 KBytes
[ 5] 2.00-3.00 sec 11.7 MBytes 97.9 Mbits/sec 0 363 KBytes
[ 5] 3.00-4.00 sec 10.6 MBytes 89.2 Mbits/sec 0 363 KBytes
[ 5] 4.00-5.00 sec 11.2 MBytes 94.0 Mbits/sec 0 363 KBytes
[ 5] 5.00-6.00 sec 11.5 MBytes 96.6 Mbits/sec 0 363 KBytes
[ 5] 6.00-7.00 sec 11.6 MBytes 97.1 Mbits/sec 0 363 KBytes
[ 5] 7.00-8.00 sec 10.8 MBytes 90.2 Mbits/sec 0 363 KBytes
[ 5] 8.00-9.00 sec 11.5 MBytes 96.8 Mbits/sec 0 363 KBytes
[ 5] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 1 1.41 KBytes
[ 5] 10.00-11.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes
[ 5] 11.00-12.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes
[ 5] 12.00-13.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes
[ 5] 13.00-14.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes
[ 5] 14.00-15.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes

Additional context

Misc notes :

One of the critical elements is that the link needs to be at 100mb. Looking at the LAN78xx driver :

https://github.com/raspberrypi/linux/blob/789af262fb268b2006099a096faf4a383592ce1b/drivers/net/usb/lan78xx.c#L1466C1-L1467C1

There's different behaviour when setting up power management - for 1000mbit the driver enables only U1 acceptance, whilst for everything else (i.e. 100mbit) it enables both U1 and U2 acceptance. If one disables the latter path and only enable U1 acceptance for all link speeds, this hang doesn't occur.

Whilst superficially this might indicate that there's a bug in the LAN78xx driver, once failed it doesn't seem to be able to be recovered without a re-boot so my gut feeling is that it's something in the USB Host Controller driver that's failed :

I've tried reproducing on a standard PC with USB3 but it doesn't occur. If I can find another ARM board with USB3 Ill re-test and update.

gdluca commented 2 months ago

@pevsonic

any messages in dmesg when it hangs?