Wi-Fi performance bad after redpine driver changes related to interrupt handling
The Wi-Fi performance on the Librem 5 seems to have gotten much worse after a recent kernel update. I ran various tests comparing different versions and found that two commits related to interrupt handling in the redpine driver seem to give problems:
d0ce5dd74f88 (redpine: Clean up loop in the interrupt handler, 2020-11-05)
73e357c5a9cf (redpine: Move card interrupt handling to RX thread, 2020-11-20)
To assess the performance I used the speedtest
command from the speedtest-cli
package. It reports both download and upload speed but I will write only about the download speed here because the difference is bigger for download.
Here is the download speed I get for the current "pureos/amber-phone" branch:
Download: 2.98 Mbit/s
Download: 2.74 Mbit/s
Download: 2.73 Mbit/s
I can get much better performance by reverting the contents of the drivers/net/wireless/redpine/ directory to the way it was before the above two commits, so checkout 48052e0e and save the redpine directory from there, then checkout the pureos/amber-phone branch again and just copy the old redpine directory contents into the drivers/net/wireless/redpine/ directory. Then build and install the kernel. Now performance is much better:
Download: 40.49 Mbit/s
Download: 40.83 Mbit/s
Download: 41.56 Mbit/s
The good news is that the performance I get in this way (around 40 Mbit/s) is better than ever, so probably there have been other kernel changes that help performance, it's just this interrupt handling thing that needs to be fixed somehow.
About the network used for these tests, iw wlan0 info
says the following:
Interface wlan0
ifindex 4
wdev 0x1
[...]
type managed
wiphy 0
channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
txpower 20.00 dBm
I would have liked to test each of the two commits above separately, but there was a compilation error when one was applied and not the other so until now I was only able to test them taken together.
Not sure if it's a good idea to revert the whole redpine directory in this way, but at least it shows that better performance is possible with that kind of changes. Maybe it would be better to figure out what actually goes wrong with the interrupt handling, assuming that probably there were some good reasons for doing those changes.