Tips & Tricks

line

WiFi / Wireless

Radios consume power for both transmitting and receiving. A typical laptop WiFi radio may consume a few watts while in use. There are several tricks and tweaks you can perform to reduce the power consumption, even when you are using WiFi all the time.

WiFi power saving mode (Power Save Poll, PS-Poll)

Because of the power requirements for WiFi, the Power Save Poll protocol (PS-Poll) was developed to help reduce the amount of time a radio needs to be powered.


Rather than having the radio on all the time, PS-Poll allows the WiFi adapter to notify the access point when it will be powered down. While the radio is powered down, the access point will hold any network packets which would need to be sent to it. Of course, the longer the radio is off, the more power you save. Device Drivers can control how much time elapses before the radio is turned on again, to get the pending packets from the access point.


The downsides to this power saving technique:

  • network latencies increase, due to the "save up and check once in a while" behavior. This is generally not noticable when you're browsing the web and such. In situations where lower network latency is important (for example online gaming, voice and media streaming, etc.), we don't recommend enabling PS-Poll.
  • a second potential problem is that not all access points (APs) support this technology. While most newer access points support this technique, some older APs may not support it very well. The effect of having an AP that doesn't support the technique is that network connectivity may be lost. If, after enabling PS-Poll you find you are losing network access, check and see if your AP has newer firmware available from the manufacturer.

The mechanism you use to turn on and configure PS-Poll varies depending on the laptop card. To turn on WiFi power saving on a wireless adapter, that uses the ipw2100 or ipw2200 driver, you can use the following command:

iwpriv eth1 set_power 5

Where 'eth1' is the interface name for your network adapter (typically eth1; sometimes it may be eth0, wlan0, etc.). The number 5 in the above iwpriv command is the degree to which the power saving should be enabled:

  • 1 is the lowest number, with the least savings (but also with the lowest added latency)
  • 5 is the highest number
  • 6 disables the power savings feature again (see example below)
iwpriv eth1 set_power 6
Newer adapters, the ones that use the iwl3945 or the iwl4965 drivers, rely more on the kernel for configuring the wireless subsystem. A mechanism still exists for manually configuring the PS-Poll via a sysfs file attribute 'power_level':
  echo 5 > /sys/bus/pci/drivers/iwl4965/*/power_level
NOTE: Substitute iwl3945 for iwl4965, depending on which adapter you have.

Auto association

Most WiFi network drivers available in Linux that were written before the mac80211 subsystem was merged into the 2.6.23 kernel, will, when not associated with an access point, go into an aggressive scanning mode, even if the network interface is down. This behavior allows certain older userspace applications to function. These applications assumed that the WiFi adapter could find access points in that situation.


The unfortunate effect of this behavior is that systems with WiFi may actually consume *more* power when the network interface is down (not in use) than when they are actively connected to an access point and in use. If you are out of reach of your access points, or if you're connected using a fixed wire, you may be in this situation.


Modern Linux distributions have fixed versions (or total replacements) of the applications in question, so as long as you use a relatively modern distribution, you can disable this behavior and save a significant amount of power.


To disable the auto-associate behavior with ipw2100 and ipw2200 wireless drivers, you need to add a kernel module parameter associate=0. To test this, you can use these commands:

rmmod ipw2200
modprobe ipw2200 associate=0
(The above example assumes you are using the ipw2200 driver. If you're using one of the other Intel wireless drives, you need to replace the ipw2200 with the module name of your driver.)


The above does not apply to the newer drivers using the mac80211 stack (such as iwl3945 and iwl4965).


Once you've tested this feature and decided that you want to make the change permanent, you can add the following line to the /etc/modprobe.conf file:

options ipw2200 associate=0

The RFKILL option

There are situations where you know you're not going to use the WiFi radio at all, and you want to just turn the radio off altogether. Being inside an airplane is one such situation, but, of course, there are many other possible situations.


For these situations, the so called rfkill option is a sure way to turn the radio off.


Some laptops come with a hardware rfkill switch, which is a very easy way to achieve the goal. For laptops without such a switch, you can issue the command below to turn all radios off at once:

for i in `find /sys -name "rf_kill" ; do echo 1 > $i ; done  
To turn the radios back on, you can use this command:
for i in `find /sys -name "rf_kill" ; do echo 0 > $i ; done  

beacon intervals

Access points announce their presence at regular intervals by sending a so-called 'beacon packet'. With most access points, the default interval is set to 100 milliseconds. The impact of the beacon interval is most noticeable when it's trying to find a network to associate with. The process of association requires a radio to tune to each channel and listen for the access point to transmit a beacon. The longer between that interval, the longer the radio must wait on each channel, or risk missing the beacon.


The downside of getting a large number of beacon packets, in addition to the radio overhead, is that with some wireless adapters, the computer must come out of power saving idle states to process the packets. If you are normally close to your access point, you may be able to save a little bit of power on your laptop by going into the administrative page of the access point and increasing the beacon interval.

Unused Bluetooth*

Many laptops now come with Bluetooth*.


Just like WiFi, Bluetooth has a radio transmitter, so it can take quite a bit of power.

Unlike WiFi, Bluetooth is rarely used, so it's very possible that your Bluetooth device isn't actually used for anything, and is just consuming battery life.


You can see if there are Bluetooth devices active on your system with the hcitool command:

# hciconfig 
hci0:   Type: USB
        BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
        DOWN 
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:0 acl:0 sco:0 commands:0 errors:0
In the example above, a USB bluetooth dongle is present and active.
Note that many internal bluetooth adapters in laptops now use USB.


The easiest way to disable a USB bluetooth device, is to use these commands:

hciconfig hci0 down
rmmod hci_usb


Deferred Firmware loading

Wireless drivers, for example ipw2100 and ipw2200, load their firmware
during the module initialization time, with the expectation the device is
going to be used in the near future. But this is not always the case, so
the wireless driver consumes more power than is required. This is because once the
firmware is loaded onto the device, it begins working (for example, it
begins to receive beacons, scan available APs nearby, etc). Also,
it sends interrupts to the host CPU when some events happen, which pulls the processor
from deep C state to C0 from time to time.

The solution for this problem is to defer the firmware loading for the
wireless devices from module initialization time to network interface
open time. When the user is about to use the wireless interface, the user
should bring up the interface manually. In other cases, when wireless is
not used, the interface is closed by default.

ifconfig wlan0 up

Currently, you have to apply a separate patch for the ipw2100 [1] and
ipw2200 [2] driver. These patches are likely to be included in the
mainline kernel in the near future.

[1] http://marc.info/?l=linux-netdev&m=117079847405905&w=2
[2] http://ipw2200.sourceforge.net/patches/ipw2200-1.2.2-close_intf.patch


 About | ISN | Intel is a trademark of Intel Corporation in the U.S. and other countries. | * Other names / brands may be claimed as the property of others