diff options
author | Felix Fietkau <nbd@nbd.name> | 2020-08-23 14:50:13 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-09-24 18:10:16 +0200 |
commit | fe5b5ab52e9d385d5e6d20e3ce2d2af69175f6ad (patch) | |
tree | b6b17fa7c2f983ad1370576ce6653ea318c0dd31 /drivers/net/wireless/mediatek/mt76/sdio.c | |
parent | 16254fc51f7df622bd870f70cf6ae84d2d4c08a3 (diff) | |
download | linux-stable-fe5b5ab52e9d385d5e6d20e3ce2d2af69175f6ad.tar.gz linux-stable-fe5b5ab52e9d385d5e6d20e3ce2d2af69175f6ad.tar.bz2 linux-stable-fe5b5ab52e9d385d5e6d20e3ce2d2af69175f6ad.zip |
mt76: unify queue tx cleanup code
Cleanup and preparation for changing tx scheduling behavior
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/sdio.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/sdio.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index 6c6d4cea2203..326d9c59e8b5 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -133,38 +133,28 @@ mt76s_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q) return nframes; } -static int mt76s_process_tx_queue(struct mt76_dev *dev, enum mt76_txq_id qid) +static void mt76s_process_tx_queue(struct mt76_dev *dev, enum mt76_txq_id qid) { struct mt76_sw_queue *sq = &dev->q_tx[qid]; - u32 n_dequeued = 0, n_sw_dequeued = 0; struct mt76_queue_entry entry; struct mt76_queue *q = sq->q; bool wake; - while (q->queued > n_dequeued) { + while (q->queued > 0) { if (!q->entry[q->tail].done) break; - if (q->entry[q->tail].schedule) { - q->entry[q->tail].schedule = false; - n_sw_dequeued++; - } - entry = q->entry[q->tail]; q->entry[q->tail].done = false; - q->tail = (q->tail + 1) % q->ndesc; - n_dequeued++; + q->entry[q->tail].schedule = false; - if (qid == MT_TXQ_MCU) + if (qid == MT_TXQ_MCU) { dev_kfree_skb(entry.skb); - else - dev->drv->tx_complete_skb(dev, qid, &entry); - } - - spin_lock_bh(&q->lock); + entry.skb = NULL; + } - sq->swq_queued -= n_sw_dequeued; - q->queued -= n_dequeued; + mt76_queue_tx_complete(dev, q, &entry); + } wake = q->stopped && q->queued < q->ndesc - 8; if (wake) @@ -173,18 +163,13 @@ static int mt76s_process_tx_queue(struct mt76_dev *dev, enum mt76_txq_id qid) if (!q->queued) wake_up(&dev->tx_wait); - spin_unlock_bh(&q->lock); - if (qid == MT_TXQ_MCU) - goto out; + return; mt76_txq_schedule(&dev->phy, qid); if (wake) ieee80211_wake_queue(dev->hw, qid); - -out: - return n_dequeued; } static void mt76s_tx_status_data(struct work_struct *work) |