mac80211: unify and fix TX aggregation start
[linux-block.git] / include / net / mac80211.h
index 409e2c69269d30cd06658e2a1ff3e3fe29b60977..07fe9875506ed5f7943400c5d8ca403d8ced8919 100644 (file)
@@ -97,7 +97,7 @@ struct ieee80211_ht_bss_info {
  *     for A-MPDU operation.
  */
 enum ieee80211_max_queues {
-       IEEE80211_MAX_QUEUES =          16,
+       IEEE80211_MAX_QUEUES =          4,
        IEEE80211_MAX_AMPDU_QUEUES =    16,
 };
 
@@ -245,6 +245,9 @@ struct ieee80211_bss_conf {
  * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
  *     set by rate control algorithms to indicate probe rate, will
  *     be cleared for fragmented frames (except on the last fragment)
+ * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
+ *     set this flag in the driver; indicates that the rate control
+ *     algorithm was used and should be notified of TX status
  */
 enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_REQ_TX_STATUS          = BIT(0),
@@ -260,6 +263,7 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_STAT_AMPDU                 = BIT(10),
        IEEE80211_TX_STAT_AMPDU_NO_BACK         = BIT(11),
        IEEE80211_TX_CTL_RATE_CTRL_PROBE        = BIT(12),
+       IEEE80211_TX_INTFL_RCALGO               = BIT(13),
 };
 
 /**
@@ -520,12 +524,6 @@ enum ieee80211_conf_flags {
        IEEE80211_CONF_PS               = (1<<1),
 };
 
-/* XXX: remove all this once drivers stop trying to use it */
-static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
-{
-       return 0;
-}
-#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
 
 /**
  * enum ieee80211_conf_changed - denotes which configuration changed
@@ -888,6 +886,10 @@ enum ieee80211_tkip_key_type {
  *
  * @IEEE80211_HW_MFP_CAPABLE:
  *     Hardware supports management frame protection (MFP, IEEE 802.11w).
+ *
+ * @IEEE80211_HW_BEACON_FILTER:
+ *     Hardware supports dropping of irrelevant beacon frames to
+ *     avoid waking up cpu.
  */
 enum ieee80211_hw_flags {
        IEEE80211_HW_RX_INCLUDES_FCS                    = 1<<1,
@@ -903,6 +905,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_PS_NULLFUNC_STACK                  = 1<<11,
        IEEE80211_HW_SUPPORTS_DYNAMIC_PS                = 1<<12,
        IEEE80211_HW_MFP_CAPABLE                        = 1<<13,
+       IEEE80211_HW_BEACON_FILTER                      = 1<<14,
 };
 
 /**
@@ -1017,16 +1020,6 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
        memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
 }
 
-static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
-{
-       return hw->queues;
-}
-
-static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
-{
-       return hw->queues + hw->ampdu_queues;
-}
-
 static inline struct ieee80211_rate *
 ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
                      const struct ieee80211_tx_info *c)
@@ -1136,6 +1129,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
  * value, or by the stack if all nullfunc handling is in the stack.
  */
 
+/**
+ * DOC: Beacon filter support
+ *
+ * Some hardware have beacon filter support to reduce host cpu wakeups
+ * which will reduce system power consumption. It usuallly works so that
+ * the firmware creates a checksum of the beacon but omits all constantly
+ * changing elements (TSF, TIM etc). Whenever the checksum changes the
+ * beacon is forwarded to the host, otherwise it will be just dropped. That
+ * way the host will only receive beacons where some relevant information
+ * (for example ERP protection or WMM settings) have changed.
+ *
+ * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
+ * The driver needs to enable beacon filter support whenever power save is
+ * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
+ * the stack will not check for beacon miss at all and the driver needs to
+ * notify about complete loss of beacons with ieee80211_beacon_loss().
+ */
+
 /**
  * DOC: Frame filtering
  *
@@ -1225,14 +1236,14 @@ enum ieee80211_filter_flags {
  * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
  * @IEEE80211_AMPDU_TX_START: start Tx aggregation
  * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
- * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation
+ * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
  */
 enum ieee80211_ampdu_mlme_action {
        IEEE80211_AMPDU_RX_START,
        IEEE80211_AMPDU_RX_STOP,
        IEEE80211_AMPDU_TX_START,
        IEEE80211_AMPDU_TX_STOP,
-       IEEE80211_AMPDU_TX_RESUME,
+       IEEE80211_AMPDU_TX_OPERATIONAL,
 };
 
 /**
@@ -1323,11 +1334,19 @@ enum ieee80211_ampdu_mlme_action {
  *
  * @hw_scan: Ask the hardware to service the scan request, no need to start
  *     the scan state machine in stack. The scan must honour the channel
- *     configuration done by the regulatory agent in the wiphy's registered
- *     bands. When the scan finishes, ieee80211_scan_completed() must be
- *     called; note that it also must be called when the scan cannot finish
- *     because the hardware is turned off! Anything else is a bug!
- *     Returns a negative error code which will be seen in userspace.
+ *     configuration done by the regulatory agent in the wiphy's
+ *     registered bands. The hardware (or the driver) needs to make sure
+ *     that power save is disabled. When the scan finishes,
+ *     ieee80211_scan_completed() must be called; note that it also must
+ *     be called when the scan cannot finish because the hardware is
+ *     turned off! Anything else is a bug! Returns a negative error code
+ *     which will be seen in userspace.
+ *
+ * @sw_scan_start: Notifier function that is called just before a software scan
+ *     is started. Can be NULL, if the driver doesn't need this notification.
+ *
+ * @sw_scan_complete: Notifier function that is called just after a software scan
+ *     finished. Can be NULL, if the driver doesn't need this notification.
  *
  * @get_stats: Return low-level statistics.
  *     Returns zero if statistics are available.
@@ -1354,11 +1373,11 @@ enum ieee80211_ampdu_mlme_action {
  *
  * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
  *     this is only used for IBSS mode BSSID merging and debugging. Is not a
- *     required function. Must be atomic.
+ *     required function.
  *
  * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
  *      Currently, this is only used for IBSS mode debugging. Is not a
- *     required function. Must be atomic.
+ *     required function.
  *
  * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
  *     with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1406,7 +1425,10 @@ struct ieee80211_ops {
        void (*update_tkip_key)(struct ieee80211_hw *hw,
                        struct ieee80211_key_conf *conf, const u8 *address,
                        u32 iv32, u16 *phase1key);
-       int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
+       int (*hw_scan)(struct ieee80211_hw *hw,
+                      struct cfg80211_scan_request *req);
+       void (*sw_scan_start)(struct ieee80211_hw *hw);
+       void (*sw_scan_complete)(struct ieee80211_hw *hw);
        int (*get_stats)(struct ieee80211_hw *hw,
                         struct ieee80211_low_level_stats *stats);
        void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1844,8 +1866,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
  * mac80211 that the scan finished.
  *
  * @hw: the hardware that finished the scan
+ * @aborted: set to true if scan was aborted
  */
-void ieee80211_scan_completed(struct ieee80211_hw *hw);
+void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
 
 /**
  * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1974,9 +1997,29 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
                                         const u8 *addr);
 
+/**
+ * ieee80211_beacon_loss - inform hardware does not receive beacons
+ *
+ * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
+ *
+ * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
+ * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
+ * hardware is not receiving beacons with this function.
+ */
+void ieee80211_beacon_loss(struct ieee80211_vif *vif);
 
 /* Rate control API */
 
+/**
+ * enum rate_control_changed - flags to indicate which parameter changed
+ *
+ * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
+ *     changed, rate control algorithm can update its internal state if needed.
+ */
+enum rate_control_changed {
+       IEEE80211_RC_HT_CHANGED = BIT(0)
+};
+
 /**
  * struct ieee80211_tx_rate_control - rate control information for/from RC algo
  *
@@ -2013,6 +2056,9 @@ struct rate_control_ops {
        void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
        void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
                          struct ieee80211_sta *sta, void *priv_sta);
+       void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
+                           struct ieee80211_sta *sta,
+                           void *priv_sta, u32 changed);
        void (*free_sta)(void *priv, struct ieee80211_sta *sta,
                         void *priv_sta);