Skip to content

Commit

Permalink
Revert "mt76: dma: reduce lock contention in mt76_dma_tx_cleanup"
Browse files Browse the repository at this point in the history
This reverts commit 2e51013.
  • Loading branch information
nbd168 committed Mar 29, 2022
1 parent 376ea81 commit eed4404
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions dma.c
Expand Up @@ -233,9 +233,7 @@ static void
mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)
{
struct mt76_queue_entry entry;
int done = 0;
int last;
int tail;

if (!q || !q->ndesc)
return;
Expand All @@ -246,39 +244,21 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)
else
last = readl(&q->regs->dma_idx);

tail = q->tail;
while (q->queued - done > 0 && tail != last) {
while (q->queued > 0 && q->tail != last) {
mt76_dma_tx_cleanup_idx(dev, q, q->tail, &entry);
if (entry.skb)
dev->drv->tx_complete_skb(dev, &entry);
tail = (tail + 1) % q->ndesc;
done++;
mt76_queue_tx_complete(dev, q, &entry);

if (entry.txwi) {
if (!(dev->drv->drv_flags & MT_DRV_TXWI_NO_FREE))
mt76_put_txwi(dev, entry.txwi);
}

if (!flush && tail == last)
if (!flush && q->tail == last)
last = readl(&q->regs->dma_idx);

if (done > 16) {
spin_lock_bh(&q->lock);
q->queued -= done;
q->tail = tail;
spin_unlock_bh(&q->lock);
done = 0;
}
}
spin_unlock_bh(&q->cleanup_lock);

if (done) {
spin_lock_bh(&q->lock);
q->queued -= done;
q->tail = tail;
spin_unlock_bh(&q->lock);
}

if (flush) {
spin_lock_bh(&q->lock);
mt76_dma_sync_idx(dev, q);
Expand Down

0 comments on commit eed4404

Please sign in to comment.