Dynamic power save
mac80211 has a feature called Dynamic power save which allows the wireless device to dynamically go into power save mode if the device is associated and no network traffic is going through the card for a certain period of time, with a default value set to 500ms. To enable dynamic power save the wireless driver must support power save mode of operation.
Some device drivers only power save manually. Some others have it enabled all the time. To enable/disable power save manually you would use:
iwconfig wlan0 power on
BIG FAT TODO: add support for this to nl80211
To enable power save a wireless device can sleep at most the duration of the BSS DTIM interval. It will wake up during that period to listen for beacons from the AP to see if the AP has buffered frames for it. Refer to the power savings guide for more details as to how this works.
Drivers with power save enabled by default
Atheros ath9k for single-chips (>= AR9280)
- TI wl1251
- TI wl1271
Ways to tune dynamic power save from userspace
You can tune dynamic power save by tuning the default timeout.
iwconfig wlan0 power 500m
You can also user pm-qos to tune dynamic power save based on network latency requirements of your userspace applications.