From 5cd805ddfb258b08649bb824ccc8c4a3bd8f56a8 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 25 Nov 2020 05:42:40 +0100 Subject: [PATCH] mt76: add more conditions for stopping tx scheduling Signed-off-by: Felix Fietkau --- tx.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tx.c b/tx.c index 234c8202..e7d2c422 100644 --- a/tx.c +++ b/tx.c @@ -375,6 +375,13 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta, } EXPORT_SYMBOL_GPL(mt76_release_buffered_frames); +static bool +mt76_txq_stopped(struct mt76_queue *q) +{ + return q->stopped || q->blocked || + q->queued + MT_TXQ_FREE_THR >= q->ndesc; +} + static int mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q, struct mt76_txq *mtxq) @@ -413,10 +420,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q, test_bit(MT76_RESET, &phy->state)) return -EBUSY; - if (stop) - break; - - if (q->queued + MT_TXQ_FREE_THR >= q->ndesc) + if (stop || mt76_txq_stopped(q)) break; skb = mt76_txq_dequeue(phy, mtxq); @@ -458,9 +462,6 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) break; } - if (q->stopped || q->blocked) - break; - if (dev->queue_ops->tx_cleanup && q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) { spin_unlock_bh(&q->lock); @@ -468,7 +469,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) spin_lock_bh(&q->lock); } - if (q->queued + MT_TXQ_FREE_THR >= q->ndesc) + if (mt76_txq_stopped(q)) break; txq = ieee80211_next_txq(phy->hw, qid);