On Fri, 9 Apr 2021 06:37:53 +0000 Claudiu Manoil wrote:
> >On Thu, 8 Apr 2021 09:02:50 -0700 Jakub Kicinski wrote:  
> >>            if (priv->flags & ONESTEP_BUSY) {
> >>                    skb_queue_tail(&priv->tx_skbs, skb);
> >>                    return ...;
> >>            }
> >>            priv->flags |= ONESTEP_BUSY;  
> >
> >Ah, if you have multiple queues this needs to be under a separate
> >spinlock, 'cause netif_tx_lock() won't be enough.  
> 
> Please try test_and_set_bit_lock()/ clear_bit_unlock() based on Jakub's
> suggestion, and see if it works for you / whether it can replace the mutex.

I was thinking that with multiple queues just a bit won't be sufficient
because:

xmit:                           work:
test_bit... // already set
                                dequeue // empty
enqueue
                                clear_bit()

That frame will never get sent, no?

Note that skb_queue already has a lock so you'd just need to make that
lock protect the flag/bit as well, overall the number of locks remains
the same. Take the queue's lock, check the flag, use
__skb_queue_tail(), release etc.

Reply via email to