Slow wifi on Ubuntu/Debian

Has anyone experienced issues with wifi “speed” on Ubuntu/Debian images? On speedtest-cli, the speed is fine ( around 200Mbs ) but, on ping from the local network, I have a reponse around 350ms and also ssh is working very slow, with a lot of lag. This problem i have on two new rock960 boards , one in my home and one in a friend’s home. I can put more info about this , but I’m wondering if anyone else had this behavior.

Since it’s not a throughput issue but seems to be a latency issue with sporadic packets, I bet it’s due to 802.11 power-save. This mechanism which is part of the WiFi specification allow to suspend the radio between AP beacons (which is usually every 100ms), this allows to save power but increase the latency. The client usually exit PS mode on packet reception and re-enter it if no packet received for a certain time (~500ms/1s).

I assume it can be a bit frustrating when using ssh since PS mode will need to be exited each time you type a letter (if no other traffic), but hey, you just need to type faster than the PS trigger :wink:

The following command is supposed to disable PS mode:

iw dev wlan0 set power_save off

and get the state with:

iw dev wlan0 get power_save

Let us know if it works.

2 Likes

Thanks Loic. Last night , after the post, i digged a little bit the same problem on other devices on ubuntu, and I came to the same conclusion. I will try it as u said, and came later with the result.
Thanks again for your so fast answer.

Sorry for the delay, but i din’t have time to try it before.
So:
I’ve tried : iw dev wlan0 set power_save off
Is working just for a few seconds and after that the power management is on again.

After a lot of searching and trying some solutions. The only one that worked is this

iwconfig wlan0 power off.

What has to be done, is to add the following line into /etc/rc.local file ( above the ‘exit 0’ line)

(sleep 30 && iwconfig wlan0 power off) &

The command execution has to be delayed ( 30 seconds), because something , don’t know exactly what, is making the power saving be on again.

Even if you run

iw dev wlan0 get power_save

you will see that the power management shows that is on, but actually is not making any problem anymore.

Instead, If you’ll run

iw dev wlan0 set power_save off

after the

iwconfig wlan0 power off

the problems appear again. So what I found was just that solution with iwconfig command.

P.S. I’ve tried also solutions with /etc/pm/power.d/wireless (you will find a lot on the net) and others but neither worked for me. I don’t think this is the best clean solution, but this makes the work done.

2 Likes

Thanks for the feedback and solution.

Yes, I have same behavior on my side, it looks like a bug for me.

I got fed up of this. My Rock960 is basically unusable over SSH. I fixed the problem in a more brute force way. I created a small script:


#!/bin/bash

management_off="Power Management: off"

while true; do
  status=`/sbin/iw wlan0 | grep "Power Management"`

  if  [ "$status" != "$management_off" ]; then
    /sbin/iw wlan0 set power_save off
  fi

  sleep 5

done

which I run in /etc/rc.local. I tried turning power management off in a crontab every minute, but even that takes too long; my system turns it back on seemingly randomly after a few seconds.

I’ve tried all sorts of solutions from StackOverflow using NetworkManager, config.d scripts and whatnot. I have no idea what’s overriding the setting. This is the only thing that worked for me.

1 Like