8484 *
8585 */
8686
87+ /**
88+ * DOC: mac80211 software tx queueing
89+ *
90+ * mac80211 provides an optional intermediate queueing implementation designed
91+ * to allow the driver to keep hardware queues short and provide some fairness
92+ * between different stations/interfaces.
93+ * In this model, the driver pulls data frames from the mac80211 queue instead
94+ * of letting mac80211 push them via drv_tx().
95+ * Other frames (e.g. control or management) are still pushed using drv_tx().
96+ *
97+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
98+ * driver operation.
99+ *
100+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
101+ * single per-vif queue for multicast data frames.
102+ *
103+ * The driver is expected to initialize its private per-queue data for stations
104+ * and interfaces in the .add_interface and .sta_add ops.
105+ *
106+ * The driver can't access the queue directly. To dequeue a frame, it calls
107+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
108+ * calls the .wake_tx_queue driver op.
109+ *
110+ * For AP powersave TIM handling, the driver only needs to indicate if it has
111+ * buffered packets in the driver specific data structures by calling
112+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
113+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
114+ * .release_buffered_frames().
115+ * In that callback the driver is therefore expected to release its own
116+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
117+ * via the usual ieee80211_tx_dequeue).
118+ */
119+
87120struct device ;
88121
89122/**
@@ -1306,6 +1339,7 @@ enum ieee80211_vif_flags {
13061339 * monitor interface (if that is requested.)
13071340 * @drv_priv: data area for driver use, will always be aligned to
13081341 * sizeof(void *).
1342+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
13091343 */
13101344struct ieee80211_vif {
13111345 enum nl80211_iftype type ;
@@ -1317,6 +1351,8 @@ struct ieee80211_vif {
13171351 u8 cab_queue ;
13181352 u8 hw_queue [IEEE80211_NUM_ACS ];
13191353
1354+ struct ieee80211_txq * txq ;
1355+
13201356 struct ieee80211_chanctx_conf __rcu * chanctx_conf ;
13211357
13221358 u32 driver_flags ;
@@ -1575,6 +1611,7 @@ struct ieee80211_sta_rates {
15751611 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
15761612 * valid if the STA is a TDLS peer in the first place.
15771613 * @mfp: indicates whether the STA uses management frame protection or not.
1614+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
15781615 */
15791616struct ieee80211_sta {
15801617 u32 supp_rates [IEEE80211_NUM_BANDS ];
@@ -1593,6 +1630,8 @@ struct ieee80211_sta {
15931630 bool tdls_initiator ;
15941631 bool mfp ;
15951632
1633+ struct ieee80211_txq * txq [IEEE80211_NUM_TIDS ];
1634+
15961635 /* must be last */
15971636 u8 drv_priv [0 ] __aligned (sizeof (void * ));
15981637};
@@ -1620,6 +1659,27 @@ struct ieee80211_tx_control {
16201659 struct ieee80211_sta * sta ;
16211660};
16221661
1662+ /**
1663+ * struct ieee80211_txq - Software intermediate tx queue
1664+ *
1665+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1666+ * @sta: station table entry, %NULL for per-vif queue
1667+ * @tid: the TID for this queue (unused for per-vif queue)
1668+ * @ac: the AC for this queue
1669+ *
1670+ * The driver can obtain packets from this queue by calling
1671+ * ieee80211_tx_dequeue().
1672+ */
1673+ struct ieee80211_txq {
1674+ struct ieee80211_vif * vif ;
1675+ struct ieee80211_sta * sta ;
1676+ u8 tid ;
1677+ u8 ac ;
1678+
1679+ /* must be last */
1680+ u8 drv_priv [0 ] __aligned (sizeof (void * ));
1681+ };
1682+
16231683/**
16241684 * enum ieee80211_hw_flags - hardware flags
16251685 *
@@ -1844,6 +1904,8 @@ enum ieee80211_hw_flags {
18441904 * within &struct ieee80211_sta.
18451905 * @chanctx_data_size: size (in bytes) of the drv_priv data area
18461906 * within &struct ieee80211_chanctx_conf.
1907+ * @txq_data_size: size (in bytes) of the drv_priv data area
1908+ * within @struct ieee80211_txq.
18471909 *
18481910 * @max_rates: maximum number of alternate rate retry stages the hw
18491911 * can handle.
@@ -1892,6 +1954,9 @@ enum ieee80211_hw_flags {
18921954 * @n_cipher_schemes: a size of an array of cipher schemes definitions.
18931955 * @cipher_schemes: a pointer to an array of cipher scheme definitions
18941956 * supported by HW.
1957+ *
1958+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
1959+ * entries for a vif.
18951960 */
18961961struct ieee80211_hw {
18971962 struct ieee80211_conf conf ;
@@ -1904,6 +1969,7 @@ struct ieee80211_hw {
19041969 int vif_data_size ;
19051970 int sta_data_size ;
19061971 int chanctx_data_size ;
1972+ int txq_data_size ;
19071973 u16 queues ;
19081974 u16 max_listen_interval ;
19091975 s8 max_signal ;
@@ -1920,6 +1986,7 @@ struct ieee80211_hw {
19201986 u8 uapsd_max_sp_len ;
19211987 u8 n_cipher_schemes ;
19221988 const struct ieee80211_cipher_scheme * cipher_schemes ;
1989+ int txq_ac_max_pending ;
19231990};
19241991
19251992/**
@@ -3082,6 +3149,8 @@ enum ieee80211_reconfig_type {
30823149 * response template is provided, together with the location of the
30833150 * switch-timing IE within the template. The skb can only be used within
30843151 * the function call.
3152+ *
3153+ * @wake_tx_queue: Called when new packets have been added to the queue.
30853154 */
30863155struct ieee80211_ops {
30873156 void (* tx )(struct ieee80211_hw * hw ,
@@ -3313,6 +3382,9 @@ struct ieee80211_ops {
33133382 void (* tdls_recv_channel_switch )(struct ieee80211_hw * hw ,
33143383 struct ieee80211_vif * vif ,
33153384 struct ieee80211_tdls_ch_sw_params * params );
3385+
3386+ void (* wake_tx_queue )(struct ieee80211_hw * hw ,
3387+ struct ieee80211_txq * txq );
33163388};
33173389
33183390/**
@@ -5334,4 +5406,15 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
53345406 */
53355407size_t ieee80211_ie_split (const u8 * ies , size_t ielen ,
53365408 const u8 * ids , int n_ids , size_t offset );
5409+
5410+ /**
5411+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
5412+ *
5413+ * @hw: pointer as obtained from ieee80211_alloc_hw()
5414+ * @txq: pointer obtained from station or virtual interface
5415+ *
5416+ * Returns the skb if successful, %NULL if no frame was available.
5417+ */
5418+ struct sk_buff * ieee80211_tx_dequeue (struct ieee80211_hw * hw ,
5419+ struct ieee80211_txq * txq );
53375420#endif /* MAC80211_H */
0 commit comments