iwlwifi tricks

Share your own howto's etc. Not for support questions!

iwlwifi tricks

Postby wizard10000 » 2015-04-27 23:53

Have Dell Precision M4500 running Sid with probably not the best wireless card, an Intel 6300. Did a bunch of research this evening on optimizing this particular chipset and after much testing and benchmarking moving a 2gb file over 802.11n with NFS, here's what I came up with. All are easily reversible -

1. First, I added to /etc/rc.local - disables power management on the wireless card and adds stability:

Code: Select all
iwconfig wlan0 power off


2. Created a text file called /etc/modprobe.d/iwlwifi.conf - the file contains

Code: Select all
options iwlwifi led_mode=1 power_save=0 11n_disable=8 swcrypto=1

# parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)
# parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
# parm:           amsdu_size_8K:enable 8K amsdu size (default 0) (int)
# parm:           fw_restart:restart firmware in case of error (default true) (bool)
# parm:           antenna_coupling:specify antenna coupling in dB (defualt: 0 dB) (int)
# parm:           wd_disable:Disable stuck queue watchdog timer 0=system default, 1=disable (default: 1) (int)
# parm:           nvm_file:NVM file name (charp)
# parm:           uapsd_disable:disable U-APSD functionality (default: Y) (bool)
# parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
# parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
# parm:           power_save:enable WiFi power management (default: disable) (bool)
# parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)
# parm:           fw_monitor:firmware monitor - to debug FW (default: false - needs lots of memory) (bool)


Self explanatory, and all options can be reversed by editing a text file.

Some people had better throughput disabling 802.11n altogether; that made things worse in my case.

Anyway, some stuff to play with if you feel like messing around with iwlwifi. I saw pretty solid improvement with just a little tweaking and testing.

cheers -

edit: Changed on 4/29/2016; original had comments that were not on newline and dmesg didn't like that at all.
Last edited by wizard10000 on 2016-04-29 21:00, edited 2 times in total.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1221
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: iwlwifi tricks

Postby hkoster1 » 2015-05-01 15:27

Yes, iwlwifi can be tricky! My own Intel 7260 AC WLAN card is a case in point, for which the iwlwifi-7260-9.ucode firmware packaged with the current 3.16 kernel does not work optimally. Specifically, Power Management cannot be turned off, resulting in terrible lag when there is little network throughput (like when doing some remote system maintenance).

I solved that by using the latest iwlwifi-7260-12.ucode from kernel git sources, which requires kernel 3.17 or later. I installed kernel 3.19 from experimental, and now Power Management on the WLAN card can be switched off, resulting in snappy performance and no more lag. :D

Still, I couldn't get the adapter to honour the kernel option to switch power management off, so I did that with the following entry in /etc/rc.local
Code: Select all
sleep 5 ; /sbin/iw wlan0 set power_save off
There is a timing issue with this command, so adjust the sleep parameter to suit.

Have fun!
Real Debian users don't do chat...
hkoster1
 
Posts: 1265
Joined: 2006-12-18 10:10

Re: iwlwifi tricks

Postby v&n » 2015-05-02 09:47

hkoster1 wrote:Still, I couldn't get the adapter to honour the kernel option to switch power management off, so I did that with the following entry in /etc/rc.local
Code: Select all
sleep 5 ; /sbin/iw wlan0 set power_save off

Two comments on this approach :
1) I think it is not a good practice to add any kind of delay in /etc/rc.local file, as executing this script is part of the booting process, and adding delays will also delay all those processes that take place after executing this script. Some of these processes may not tolerate the delay and may fail or otherwise cause unexpected results. A better approach would be to create an executable script containing the sleep time and the command(s), then add a line like -
Code: Select all
bash /home/user/custom_script &

..in the /etc/rc.local file. The "&" at the end of the line will cause the script to run as a background process and the rc.local script itself will quickly move on to the next line in it.

2) Turning off power management by adding a command in the rc.local file helps ONLY when you need to run it only once, which is not always the case. Sometimes some external scripts (like pm-util ones) or one of the drivers will cause the power management to turn back on.

In such cases, if you are using pm-utils, the correct approach is to add the command to turn power management off into /etc/pm/power.d/wireless file, and make it executable (sometimes just creating a blank file would be sufficient).

The iwlwifi driver in newer kernels also uses 'iwldvm' or 'iwlmvm' driver as a dependency. If it happens to be "iwlmvm" driver, it has a parameter called "power_scheme" that offers three power saving modes - 1: Always Active, 2: Balanced, 3: low-power. Default is '2' (balanced). I personally believe that the default 'balanced' mode is one of the major causes that keep turning power-management "on". A solution that I have tested successfully many times with this driver, is to set the "power_scheme" mode to '1' (Active). This can be applied permanently by creating a conf file in /etc/modprobe.d directory -
Code: Select all
sudo tee /etc/modprobe.d/iwlmvm.conf <<< "options iwlmvm power_scheme=1"


Hope it adds some value to the thread.
v&n
 
Posts: 595
Joined: 2015-02-04 02:57

Re: iwlwifi tricks

Postby wizard10000 » 2015-05-02 13:26

Thanks for the info :)

My card uses iwldvm, so here's where I ended up -

Code: Select all
options iwlwifi led_mode=1 power_save=0 11n_disable=8 swcrypto=1

# parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)
# parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
# parm:           amsdu_size_8K:enable 8K amsdu size (default 0) (int)
# parm:           fw_restart:restart firmware in case of error (default true) (bool)
# parm:           antenna_coupling:specify antenna coupling in dB (defualt: 0 dB) (int)
# parm:           wd_disable:Disable stuck queue watchdog timer 0=system default, 1=disable (default: 1) (int)
# parm:           nvm_file:NVM file name (charp)
# parm:           uapsd_disable:disable U-APSD functionality (default: Y) (bool)
# parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
# parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
# parm:           power_save:enable WiFi power management (default: disable) (bool)
# parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)
# parm:           fw_monitor:firmware monitor - to debug FW (default: false - needs lots of memory) (bool)
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1221
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: iwlwifi tricks

Postby Koniec12 » 2015-06-02 11:03

Great tips, thanks a lot. I new this forum would be the deal:) Cheers to everyone:)
Koniec12
 
Posts: 5
Joined: 2015-06-02 10:56

Re: iwlwifi tricks

Postby v&n » 2015-06-10 16:55

wizard10000 wrote:1. First, I added to /etc/rc.local - disables power management on the wireless card and adds stability:

Code: Select all
ifconfig wlan0 power off

Oops! That ^^ needs correction wizard10000. It is "iwconfig", not "ifconfig" that offers the 'power off' option. So the above should be either -
Code: Select all
iwconfig wlan0 power off

(in the /etc/pm/power.d/wireless file IF using pm-utils, as recommended in my previous post)

Or,
Code: Select all
/sbin/iw wlan0 set power_save off

(same as the 'iwconfig' command I believe, doesn't need "wireless-tools" installed first)

Noticed the 'ifconfig' error just now in another thread where this one was referred to by Head_on_a_Stick.
v&n
 
Posts: 595
Joined: 2015-02-04 02:57

Re: iwlwifi tricks

Postby wizard10000 » 2015-06-10 17:19

v&n wrote:Oops! That ^^ needs correction wizard10000. It is "iwconfig", not "ifconfig" that offers the 'power off' option. So the above should be either -
Code: Select all
iwconfig wlan0 power off

(in the /etc/pm/power.d/wireless file IF using pm-utils, as recommended in my previous post)

Or,
Code: Select all
/sbin/iw wlan0 set power_save off

(same as the 'iwconfig' command I believe, doesn't need "wireless-tools" installed first)

Noticed the 'ifconfig' error just now in another thread where this one was referred to by Head_on_a_Stick.


Thanks - fixed above.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1221
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: iwlwifi tricks

Postby fmp » 2017-11-19 18:07

I tweaked my wifi settings based on some suggestions here and the difference is staggering.

Thanks so much for creating this thread!!
fmp
 
Posts: 26
Joined: 2017-09-09 04:01


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable