Disable wifi powersave

Configuration: TX2 on a Gumstix carrier board

Problem: Wifi keeps going into powersave mode resulting in horribly unusable latency over even ssh. I can’t even type a piece of code without wanting to pull my hair out. Manually running

sudo /sbin/iw dev wlan0 set power_save off

on every startup works. However, I would like it to be automatic.

What does NOT work:

  • Putting it in /etc/rc.local -- Problem: doesn't do anything at all; still have to run it manually
  • Putting it in /etc/network/if-up.d -- Problem: it works fine for about 10-30 seconds after wlan0 interface goes up, and then powersave goes on again, requiring me to run the command manually again
  • Putting powersave=2 in /etc/NetworkManager/system-connections/SSID -- Problem: same as above

How can I kill powersave once and for all forever? Thanks!

Workaround until there is a better answer:

  1. Save this as /home/nvidia/bin/wifi-powersave-loop
#!/bin/bash

while :
do
    /sbin/iw dev wlan0 set power_save on
    /sbin/iw dev wlan0 set power_save off
    sleep 20
done
  1. sudo apt-get install screen

  2. Add this to /etc/rc.local before “exit 0”:

screen -d -m /home/nvidia/bin/wifi-powersave-loop

Another method is to add below patch to driver.

--- a/drivers/net/wireless/bcmdhd/dhd_linux.c
+++ b/drivers/net/wireless/bcmdhd/dhd_linux.c
@@ -6155,6 +6155,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
 #endif
        }

+       dhd_slpauto_config(dhd, 0);
        DHD_ERROR(("Firmware up: op_mode=0x%04x, MAC="MACDBG"\n",
                dhd->op_mode, MAC2STRDBG(dhd->mac.octet)));
        /* Set Country code  */

Hi,

I have tried to add the modification to the driver as stated but the wifi still goes into power safe mode. Can anybody help me with that?

ack2,

May I ask how do you know wifi is entering powersave??

Hi Wayne,

Thanks for responding.

Initially, I encountered the problem of slow and delayed response when I remote login through ssh, then I have read that it might be because of the power save mode of the wifi, so I tried to disable it through command line commands and it worked for a while. Then I came across this post where it is stated that the patch can turn off the power saving mode of the wifi.

Somehow, it seems that the patch is working now and I don’t have any problems with delayed ssh remote access anymore, I don’t understand why it is working now and not before, but then I don’t think I have the time to delve into that right now.

Hi, @WayneWWW could you please elaborate on this? Because I didn’t understand which file I should modify.
Thanks a lot in advance!

This does not work, at least for me. What does work is to disable the flag WIPHY_FLAG_PS_ON_BY_DEFAULT which seems to be enabled by default. Look in

kernel/nvidia/drivers/net/wireless/bcmdhd/wl_cfg80211.c