mac80211 has support for various powersave implementations.
First, it can support hardware that handles all powersaving by
itself, such hardware should simply set the IEEE80211_HW_SUPPORTS_PS
hardware flag. In that case, it will be told about the desired
powersave mode depending on the association status, and the driver
must take care of sending nullfunc frames when necessary, i.e. when
entering and leaving powersave mode. The driver is required to look at
the AID in beacons and signal to the AP that it woke up when it finds
traffic directed to it. This mode supports dynamic PS by simply
enabling/disabling PS.
Additionally, such hardware may set the IEEE80211_HW_SUPPORTS_DYNAMIC_PS
flag to indicate that it can support dynamic PS mode itself (see below).
Other hardware designs cannot send nullfunc frames by themselves and also
need software support for parsing the TIM bitmap. This is also supported
by mac80211 by combining the IEEE80211_HW_SUPPORTS_PS
and
IEEE80211_HW_PS_NULLFUNC_STACK
flags. The hardware is of course still
required to pass up beacons. The hardware is still required to handle
waking up for multicast traffic; if it cannot the driver must handle that
as best as it can, mac80211 is too slow.
Dynamic powersave mode is an extension to normal powersave mode in which
the hardware stays awake for a user-specified period of time after sending
a frame so that reply frames need not be buffered and therefore delayed
to the next wakeup. This can either be supported by hardware, in which case
the driver needs to look at the dynamic_ps_timeout
hardware configuration
value, or by the stack if all nullfunc handling is in the stack.