Atheros HAL: Network Sleep support

| Driver | HAL | Supported Hardware | 802.11n support | Debugging |

Network Sleep is the Atheros term for allowing the MAC to drive whether to put itself and the PHY/radio to sleep for certain amounts of time. It forms part of the overall power saving strategy.

Overview

The Atheros MAC supports three power modes:

"Full-sleep" is where the MAC, radio and PHY are forced asleep. In this mode only registers in the host interface (eg SYNC interrupts and power control registers) can be modified.

"Force-awake" is where the MAC, radio and PHY are constantly on.

"Network-sleep" is where the MAC controls whether itself, radio and PHY are required to be on.

Network Sleep

The network sleep functionality requires a handful of pieces in order to allow the hardware to determine whether it needs to be awake or not.

In order for the MAC to wake up for each beacon interval, the MAC beacon interval timers must be configured correctly in order for the NIC to wake up around the time the access point or IBSS will be broadcasting a beacon. The MAC will then listen for the beacon from the BSS and synchronize its own TSF timer value against the beacon TSF. If the beacon interval isn't configured correctly then the NIC will not wake up in time to hear the beacon and will simply go back to sleep.

Since some frames are generated by the MAC itself, a separate bit in AR_STA_ID1 is used to determine whether self-generated frames have the power management bit in the 802.11 header set or not. If this isn't set correctly then the MAC may respond with a frame with pwrmgt=0, which hints to the AP or IBSS node that it's awake when it may not be.

Programming

The HAL method "ah_setPowerMode(powerMode, setChip) controls both whether the MAC is considered awake or asleep and whether to configure the hardware for a sleep state.

The NIC must be forced awake before most registers are touched. The NIC can be put back to sleep afterwards. For example, to transmit a frame:

The NIC will then transmit the frame(s) and go to sleep when completed.

In order for the NIC to wakeup for each beacon, one of the HAL beacon setup routines must be used to configure the beacon interval, the initial TSF and how long to stay awake during each beacon interval.

TODO

dev/ath_hal(4)/NetworkSleep (last edited 2014-04-25T01:14:52+0000 by AdrianChadd)