aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mac80211.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-09-29 10:04:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-30 15:57:24 -0400
commit4b801bc969364a980c1366e48155d1a29d20661b (patch)
tree990b0e2ba1a6387f1e4b1f9846bd0246c9c7dbe8 /include/net/mac80211.h
parent37fbd9080088f5f98ab81a6f2ad456857971a089 (diff)
mac80211: document client powersave
With the addition of uAPSD and driver buffering the powersave handling has gotten quite complex. Add a section to the documentation to explain it for anyone wanting to implement it. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r--include/net/mac80211.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3df32a04402c..bc799304be71 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1539,6 +1539,95 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1539 */ 1539 */
1540 1540
1541/** 1541/**
1542 * DOC: AP support for powersaving clients
1543 *
1544 * In order to implement AP and P2P GO modes, mac80211 has support for
1545 * client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD.
1546 * There currently is no support for sAPSD.
1547 *
1548 * There is one assumption that mac80211 makes, namely that a client
1549 * will not poll with PS-Poll and trigger with uAPSD at the same time.
1550 * Both are supported, and both can be used by the same client, but
1551 * they can't be used concurrently by the same client. This simplifies
1552 * the driver code.
1553 *
1554 * The first thing to keep in mind is that there is a flag for complete
1555 * driver implementation: %IEEE80211_HW_AP_LINK_PS. If this flag is set,
1556 * mac80211 expects the driver to handle most of the state machine for
1557 * powersaving clients and will ignore the PM bit in incoming frames.
1558 * Drivers then use ieee80211_sta_ps_transition() to inform mac80211 of
1559 * stations' powersave transitions. In this mode, mac80211 also doesn't
1560 * handle PS-Poll/uAPSD.
1561 *
1562 * In the mode without %IEEE80211_HW_AP_LINK_PS, mac80211 will check the
1563 * PM bit in incoming frames for client powersave transitions. When a
1564 * station goes to sleep, we will stop transmitting to it. There is,
1565 * however, a race condition: a station might go to sleep while there is
1566 * data buffered on hardware queues. If the device has support for this
1567 * it will reject frames, and the driver should give the frames back to
1568 * mac80211 with the %IEEE80211_TX_STAT_TX_FILTERED flag set which will
1569 * cause mac80211 to retry the frame when the station wakes up. The
1570 * driver is also notified of powersave transitions by calling its
1571 * @sta_notify callback.
1572 *
1573 * When the station is asleep, it has three choices: it can wake up,
1574 * it can PS-Poll, or it can possibly start a uAPSD service period.
1575 * Waking up is implemented by simply transmitting all buffered (and
1576 * filtered) frames to the station. This is the easiest case. When
1577 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
1578 * will inform the driver of this with the @allow_buffered_frames
1579 * callback; this callback is optional. mac80211 will then transmit
1580 * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE
1581 * on each frame. The last frame in the service period (or the only
1582 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
1583 * indicate that it ends the service period; as this frame must have
1584 * TX status report it also sets %IEEE80211_TX_CTL_REQ_TX_STATUS.
1585 * When TX status is reported for this frame, the service period is
1586 * marked has having ended and a new one can be started by the peer.
1587 *
1588 * Another race condition can happen on some devices like iwlwifi
1589 * when there are frames queued for the station and it wakes up
1590 * or polls; the frames that are already queued could end up being
1591 * transmitted first instead, causing reordering and/or wrong
1592 * processing of the EOSP. The cause is that allowing frames to be
1593 * transmitted to a certain station is out-of-band communication to
1594 * the device. To allow this problem to be solved, the driver can
1595 * call ieee80211_sta_block_awake() if frames are buffered when it
1596 * is notified that the station went to sleep. When all these frames
1597 * have been filtered (see above), it must call the function again
1598 * to indicate that the station is no longer blocked.
1599 *
1600 * If the driver buffers frames in the driver for aggregation in any
1601 * way, it must use the ieee80211_sta_set_buffered() call when it is
1602 * notified of the station going to sleep to inform mac80211 of any
1603 * TIDs that have frames buffered. Note that when a station wakes up
1604 * this information is reset (hence the requirement to call it when
1605 * informed of the station going to sleep). Then, when a service
1606 * period starts for any reason, @release_buffered_frames is called
1607 * with the number of frames to be released and which TIDs they are
1608 * to come from. In this case, the driver is responsible for setting
1609 * the EOSP (for uAPSD) and MORE_DATA bits in the released frames,
1610 * to help the @more_data paramter is passed to tell the driver if
1611 * there is more data on other TIDs -- the TIDs to release frames
1612 * from are ignored since mac80211 doesn't know how many frames the
1613 * buffers for those TIDs contain.
1614 *
1615 * If the driver also implement GO mode, where absence periods may
1616 * shorten service periods (or abort PS-Poll responses), it must
1617 * filter those response frames except in the case of frames that
1618 * are buffered in the driver -- those must remain buffered to avoid
1619 * reordering. Because it is possible that no frames are released
1620 * in this case, the driver must call ieee80211_sta_eosp_irqsafe()
1621 * to indicate to mac80211 that the service period ended anyway.
1622 *
1623 * Finally, if frames from multiple TIDs are released from mac80211
1624 * but the driver might reorder them, it must clear & set the flags
1625 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
1626 * and also take care of the EOSP and MORE_DATA bits in the frame.
1627 * The driver may also use ieee80211_sta_eosp_irqsafe() in this case.
1628 */
1629
1630/**
1542 * enum ieee80211_filter_flags - hardware filter flags 1631 * enum ieee80211_filter_flags - hardware filter flags
1543 * 1632 *
1544 * These flags determine what the filter in hardware should be 1633 * These flags determine what the filter in hardware should be