5GHz inbound connection latency spikes on Raspberry Pi
Hi all,
I'm seeing latency spikes on inbound 5GHz connections with brcmfmac on RPi4. For example, this is me pinging an idle RPi4 running today's linux-next build from my work computer (although I can reproduce this with older kernels and/or RPi3):
nico@linux-9qgx:~> ping 192.168.1.18 PING 192.168.1.18 (192.168.1.18) 56(84) bytes of data. 64 bytes from 192.168.1.18: icmp_seq=1 ttl=64 time=306 ms 64 bytes from 192.168.1.18: icmp_seq=2 ttl=64 time=1351 ms 64 bytes from 192.168.1.18: icmp_seq=3 ttl=64 time=326 ms 64 bytes from 192.168.1.18: icmp_seq=4 ttl=64 time=175 ms 64 bytes from 192.168.1.18: icmp_seq=5 ttl=64 time=1431 ms 64 bytes from 192.168.1.18: icmp_seq=6 ttl=64 time=425 ms 64 bytes from 192.168.1.18: icmp_seq=7 ttl=64 time=1457 ms 64 bytes from 192.168.1.18: icmp_seq=8 ttl=64 time=441 ms 64 bytes from 192.168.1.18: icmp_seq=9 ttl=64 time=360 ms 64 bytes from 192.168.1.18: icmp_seq=10 ttl=64 time=1395 ms 64 bytes from 192.168.1.18: icmp_seq=11 ttl=64 time=388 ms 64 bytes from 192.168.1.18: icmp_seq=12 ttl=64 time=1431 ms 64 bytes from 192.168.1.18: icmp_seq=13 ttl=64 time=416 ms 64 bytes from 192.168.1.18: icmp_seq=14 ttl=64 time=1272 ms 64 bytes from 192.168.1.18: icmp_seq=15 ttl=64 time=257 ms 64 bytes from 192.168.1.18: icmp_seq=16 ttl=64 time=1291 ms 64 bytes from 192.168.1.18: icmp_seq=17 ttl=64 time=277 ms
It turns out that if I disable the low power mode on the wireless network
interface: 'iwconfig wlan0 power off', everything behaves as expected, with latencies between averaging 10ms. I've also found this patch[1] from RPi's downstream kernel tree which tweaks the LPM entry delay and makes things a little better. With it, SSHing into the machine is bearable.
I can understand that tweak not being OK for all brcmfmac users so I figured I could apply it conditionally on RPi's compatible strings. That said, before doing anything I wonder if you have a better solution in mind.
Also note that latencies on 2GHz connections are also visible, but in the order of 150-200ms, which is more acceptable.
Regards,
Nicolas