On Sun, Mar 24, 2019 at 03:51:43PM +0100, Lorenzo Bianconi wrote: > + int idx; > + > sq = &dev->q_tx[i]; > q = sq->q; > > - spin_lock_bh(&q->lock); > - while (true) { > - if (!q->entry[q->head].done || !q->queued) > + while (q->queued > n_queued) { > + if (!q->entry[q->head].done) > break; If you place done = false here you will not need additional idx variable. > dev->drv->tx_complete_skb(dev, i, &entry); > - spin_lock_bh(&q->lock); > + q->entry[idx].done = false; > } > > + spin_lock_bh(&q->lock); This patch does not apply for me as there is missing mt76_txq_schedule(dev, sq); > + > + sq->swq_queued -= n_sw_queued; > + q->queued -= n_queued; > + Naming is confusing, it should rather be n_dequeued, n_sw_dequeued. Stanislaw