On Mon, Mar 25, 2019 at 02:47:35PM +0100, Lorenzo Bianconi wrote: > > On Mon, Mar 25, 2019 at 02:00:36PM +0100, Lorenzo Bianconi wrote: > > > > 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. > > > > > > As Felix suggested, I would set done to false at the end of the loop, after > > > tx_complete_skb > > Why this is needed? > > logically I think it should be the last thing to do on the current skb but Why? This is only marker that urb complete was done. > probably moving it before tx_complete_skb will not make any difference It will not, since code is performed in the same tasklet. Stanislaw