Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2ac7e30 authored by Michal Kazior's avatar Michal Kazior Committed by Johannes Berg
Browse files

mac80211: expose txq queue depth and size to drivers



This will allow drivers to make more educated
decisions whether to defer transmission or not.

Relying on wake_tx_queue() call count implicitly
was not possible because it could be called
without queued frame count actually changing on
software tx aggregation start/stop code paths.

It was also not possible to know how long
byte-wise queue was without dequeueing.

Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent dfdfc2be
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -5596,4 +5596,19 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
 */
 */
struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
				     struct ieee80211_txq *txq);
				     struct ieee80211_txq *txq);

/**
 * ieee80211_txq_get_depth - get pending frame/byte count of given txq
 *
 * The values are not guaranteed to be coherent with regard to each other, i.e.
 * txq state can change half-way of this function and the caller may end up
 * with "new" frame_cnt and "old" byte_cnt or vice-versa.
 *
 * @txq: pointer obtained from station or virtual interface
 * @frame_cnt: pointer to store frame count
 * @byte_cnt: pointer to store byte count
 */
void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
			     unsigned long *frame_cnt,
			     unsigned long *byte_cnt);
#endif /* MAC80211_H */
#endif /* MAC80211_H */
+1 −0
Original line number Original line Diff line number Diff line
@@ -804,6 +804,7 @@ enum txq_info_flags {
struct txq_info {
struct txq_info {
	struct sk_buff_head queue;
	struct sk_buff_head queue;
	unsigned long flags;
	unsigned long flags;
	unsigned long byte_cnt;


	/* keep last! */
	/* keep last! */
	struct ieee80211_txq txq;
	struct ieee80211_txq txq;
+1 −0
Original line number Original line Diff line number Diff line
@@ -979,6 +979,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,


		spin_lock_bh(&txqi->queue.lock);
		spin_lock_bh(&txqi->queue.lock);
		ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
		ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
		txqi->byte_cnt = 0;
		spin_unlock_bh(&txqi->queue.lock);
		spin_unlock_bh(&txqi->queue.lock);


		atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
		atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
+1 −0
Original line number Original line Diff line number Diff line
@@ -116,6 +116,7 @@ static void __cleanup_single_sta(struct sta_info *sta)


			ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
			ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
			atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
			atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
			txqi->byte_cnt = 0;
		}
		}
	}
	}


+7 −1
Original line number Original line Diff line number Diff line
@@ -1270,7 +1270,11 @@ static void ieee80211_drv_tx(struct ieee80211_local *local,
	if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
	if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
		netif_stop_subqueue(sdata->dev, ac);
		netif_stop_subqueue(sdata->dev, ac);


	skb_queue_tail(&txqi->queue, skb);
	spin_lock_bh(&txqi->queue.lock);
	txqi->byte_cnt += skb->len;
	__skb_queue_tail(&txqi->queue, skb);
	spin_unlock_bh(&txqi->queue.lock);

	drv_wake_tx_queue(local, txqi);
	drv_wake_tx_queue(local, txqi);


	return;
	return;
@@ -1298,6 +1302,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
	if (!skb)
	if (!skb)
		goto out;
		goto out;


	txqi->byte_cnt -= skb->len;

	atomic_dec(&sdata->txqs_len[ac]);
	atomic_dec(&sdata->txqs_len[ac]);
	if (__netif_subqueue_stopped(sdata->dev, ac))
	if (__netif_subqueue_stopped(sdata->dev, ac))
		ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
		ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
Loading