]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/net/mac80211.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[karo-tx-linux.git] / include / net / mac80211.h
index 87d203ff7a8ad4d43ae97bcd91116529934b4ef7..32cd5171fa227c028119a6f44a2ceb9350ddb1de 100644 (file)
@@ -95,9 +95,11 @@ struct device;
  * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
  */
 enum ieee80211_max_queues {
-       IEEE80211_MAX_QUEUES =          4,
+       IEEE80211_MAX_QUEUES =          16,
 };
 
+#define IEEE80211_INVAL_HW_QUEUE       0xff
+
 /**
  * enum ieee80211_ac_numbers - AC numbers as used in mac80211
  * @IEEE80211_AC_VO: voice
@@ -244,7 +246,7 @@ enum ieee80211_rssi_event {
  * @channel_type: Channel type for this BSS -- the hardware might be
  *     configured for HT40+ while this BSS only uses no-HT, for
  *     example.
- * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
+ * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
  *     This field is only valid when the channel type is one of the HT types.
  * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
  *     implies disabled
@@ -522,7 +524,7 @@ struct ieee80211_tx_rate {
  *
  * @flags: transmit info flags, defined above
  * @band: the band to transmit on (use for checking for races)
- * @antenna_sel_tx: antenna to use, 0 for automatic diversity
+ * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
  * @ack_frame_id: internal frame ID for TX status, used internally
  * @control: union for control data
  * @status: union for status data
@@ -538,7 +540,7 @@ struct ieee80211_tx_info {
        u32 flags;
        u8 band;
 
-       u8 antenna_sel_tx;
+       u8 hw_queue;
 
        u16 ack_frame_id;
 
@@ -564,7 +566,8 @@ struct ieee80211_tx_info {
                        u8 ampdu_ack_len;
                        int ack_signal;
                        u8 ampdu_len;
-                       /* 15 bytes free */
+                       u8 antenna;
+                       /* 14 bytes free */
                } status;
                struct {
                        struct ieee80211_tx_rate driver_rates[
@@ -888,6 +891,8 @@ enum ieee80211_vif_flags {
  *     these need to be set (or cleared) when the interface is added
  *     or, if supported by the driver, the interface type is changed
  *     at runtime, mac80211 will never touch this field
+ * @hw_queue: hardware queue for each AC
+ * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
  * @drv_priv: data area for driver use, will always be aligned to
  *     sizeof(void *).
  */
@@ -896,7 +901,12 @@ struct ieee80211_vif {
        struct ieee80211_bss_conf bss_conf;
        u8 addr[ETH_ALEN];
        bool p2p;
+
+       u8 cab_queue;
+       u8 hw_queue[IEEE80211_NUM_ACS];
+
        u32 driver_flags;
+
        /* must be last */
        u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
 };
@@ -1174,6 +1184,15 @@ enum sta_notify_cmd {
  * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
  *     being idle (i.e. mac80211 doesn't have to go idle-off during the
  *     the scan).
+ *
+ * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
+ *     a virtual monitor interface when monitor interfaces are the only
+ *     active interfaces.
+ *
+ * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
+ *     queue mapping in order to use different queues (not just one per AC)
+ *     for different virtual interfaces. See the doc section on HW queue
+ *     control for more details.
  */
 enum ieee80211_hw_flags {
        IEEE80211_HW_HAS_RATE_CONTROL                   = 1<<0,
@@ -1190,13 +1209,13 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_PS_NULLFUNC_STACK                  = 1<<11,
        IEEE80211_HW_SUPPORTS_DYNAMIC_PS                = 1<<12,
        IEEE80211_HW_MFP_CAPABLE                        = 1<<13,
-       /* reuse bit 14 */
+       IEEE80211_HW_WANT_MONITOR_VIF                   = 1<<14,
        IEEE80211_HW_SUPPORTS_STATIC_SMPS               = 1<<15,
        IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS              = 1<<16,
        IEEE80211_HW_SUPPORTS_UAPSD                     = 1<<17,
        IEEE80211_HW_REPORTS_TX_ACK_STATUS              = 1<<18,
        IEEE80211_HW_CONNECTION_MONITOR                 = 1<<19,
-       /* reuse bit 20 */
+       IEEE80211_HW_QUEUE_CONTROL                      = 1<<20,
        IEEE80211_HW_SUPPORTS_PER_STA_GTK               = 1<<21,
        IEEE80211_HW_AP_LINK_PS                         = 1<<22,
        IEEE80211_HW_TX_AMPDU_SETUP_IN_HW               = 1<<23,
@@ -1266,6 +1285,9 @@ enum ieee80211_hw_flags {
  * @max_tx_aggregation_subframes: maximum number of subframes in an
  *     aggregate an HT driver will transmit, used by the peer as a
  *     hint to size its reorder buffer.
+ *
+ * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
+ *     (if %IEEE80211_HW_QUEUE_CONTROL is set)
  */
 struct ieee80211_hw {
        struct ieee80211_conf conf;
@@ -1286,6 +1308,7 @@ struct ieee80211_hw {
        u8 max_rate_tries;
        u8 max_rx_aggregation_subframes;
        u8 max_tx_aggregation_subframes;
+       u8 offchannel_tx_hw_queue;
 };
 
 /**
@@ -1327,7 +1350,7 @@ static inline struct ieee80211_rate *
 ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
                      const struct ieee80211_tx_info *c)
 {
-       if (WARN_ON(c->control.rates[0].idx < 0))
+       if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
                return NULL;
        return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
 }
@@ -1693,6 +1716,61 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
  * The driver may also use ieee80211_sta_eosp_irqsafe() in this case.
  */
 
+/**
+ * DOC: HW queue control
+ *
+ * Before HW queue control was introduced, mac80211 only had a single static
+ * assignment of per-interface AC software queues to hardware queues. This
+ * was problematic for a few reasons:
+ * 1) off-channel transmissions might get stuck behind other frames
+ * 2) multiple virtual interfaces couldn't be handled correctly
+ * 3) after-DTIM frames could get stuck behind other frames
+ *
+ * To solve this, hardware typically uses multiple different queues for all
+ * the different usages, and this needs to be propagated into mac80211 so it
+ * won't have the same problem with the software queues.
+ *
+ * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
+ * flag that tells it that the driver implements its own queue control. To do
+ * so, the driver will set up the various queues in each &struct ieee80211_vif
+ * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
+ * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
+ * if necessary will queue the frame on the right software queue that mirrors
+ * the hardware queue.
+ * Additionally, the driver has to then use these HW queue IDs for the queue
+ * management functions (ieee80211_stop_queue() et al.)
+ *
+ * The driver is free to set up the queue mappings as needed, multiple virtual
+ * interfaces may map to the same hardware queues if needed. The setup has to
+ * happen during add_interface or change_interface callbacks. For example, a
+ * driver supporting station+station and station+AP modes might decide to have
+ * 10 hardware queues to handle different scenarios:
+ *
+ * 4 AC HW queues for 1st vif: 0, 1, 2, 3
+ * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
+ * after-DTIM queue for AP:   8
+ * off-channel queue:         9
+ *
+ * It would then set up the hardware like this:
+ *   hw.offchannel_tx_hw_queue = 9
+ *
+ * and the first virtual interface that is added as follows:
+ *   vif.hw_queue[IEEE80211_AC_VO] = 0
+ *   vif.hw_queue[IEEE80211_AC_VI] = 1
+ *   vif.hw_queue[IEEE80211_AC_BE] = 2
+ *   vif.hw_queue[IEEE80211_AC_BK] = 3
+ *   vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
+ * and the second virtual interface with 4-7.
+ *
+ * If queue 6 gets full, for example, mac80211 would only stop the second
+ * virtual interface's BE queue since virtual interface queues are per AC.
+ *
+ * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
+ * whenever the queue is not used (i.e. the interface is not in AP mode) if the
+ * queue could potentially be shared since mac80211 will look at cab_queue when
+ * a queue is stopped/woken even if the interface is not in AP mode.
+ */
+
 /**
  * enum ieee80211_filter_flags - hardware filter flags
  *
@@ -1779,6 +1857,18 @@ enum ieee80211_frame_release_type {
        IEEE80211_FRAME_RELEASE_UAPSD,
 };
 
+/**
+ * enum ieee80211_rate_control_changed - flags to indicate what changed
+ *
+ * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
+ *     to this station changed.
+ * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
+ */
+enum ieee80211_rate_control_changed {
+       IEEE80211_RC_BW_CHANGED         = BIT(0),
+       IEEE80211_RC_SMPS_CHANGED       = BIT(1),
+};
+
 /**
  * struct ieee80211_ops - callbacks from mac80211 to the driver
  *
@@ -1980,6 +2070,14 @@ enum ieee80211_frame_release_type {
  *     up the list of states.
  *     The callback can sleep.
  *
+ * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
+ *     used to transmit to the station. The changes are advertised with bits
+ *     from &enum ieee80211_rate_control_changed and the values are reflected
+ *     in the station data. This callback should only be used when the driver
+ *     uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
+ *     otherwise the rate control algorithm is notified directly.
+ *     Must be atomic.
+ *
  * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  *     bursting) for a hardware TX queue.
  *     Returns a negative error code on failure.
@@ -2135,6 +2233,7 @@ struct ieee80211_ops {
 #ifdef CONFIG_PM
        int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
        int (*resume)(struct ieee80211_hw *hw);
+       void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
 #endif
        int (*add_interface)(struct ieee80211_hw *hw,
                             struct ieee80211_vif *vif);
@@ -2196,8 +2295,12 @@ struct ieee80211_ops {
                         struct ieee80211_sta *sta,
                         enum ieee80211_sta_state old_state,
                         enum ieee80211_sta_state new_state);
+       void (*sta_rc_update)(struct ieee80211_hw *hw,
+                             struct ieee80211_vif *vif,
+                             struct ieee80211_sta *sta,
+                             u32 changed);
        int (*conf_tx)(struct ieee80211_hw *hw,
-                      struct ieee80211_vif *vif, u16 queue,
+                      struct ieee80211_vif *vif, u16 ac,
                       const struct ieee80211_tx_queue_params *params);
        u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
        void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -3511,19 +3614,6 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
 
 /* 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.
- * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
- *     control algorithm needs to adjust accordingly.
- */
-enum rate_control_changed {
-       IEEE80211_RC_HT_CHANGED         = BIT(0),
-       IEEE80211_RC_SMPS_CHANGED       = BIT(1),
-};
-
 /**
  * struct ieee80211_tx_rate_control - rate control information for/from RC algo
  *
@@ -3569,9 +3659,8 @@ struct rate_control_ops {
        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,
-                           enum nl80211_channel_type oper_chan_type);
+                           struct ieee80211_sta *sta, void *priv_sta,
+                           u32 changed);
        void (*free_sta)(void *priv, struct ieee80211_sta *sta,
                         void *priv_sta);
 
@@ -3706,8 +3795,9 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
 
 void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
 
-int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb);
+int ieee80211_add_srates_ie(struct ieee80211_vif *vif,
+                           struct sk_buff *skb, bool need_basic);
 
 int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
-                               struct sk_buff *skb);
+                               struct sk_buff *skb, bool need_basic);
 #endif /* MAC80211_H */