[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210409090939.0a2c0325@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 9 Apr 2021 09:09:39 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Claudiu Manoil <claudiu.manoil@....com>
Cc: "Y.b. Lu" <yangbo.lu@....com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"David S . Miller" <davem@...emloft.net>,
Richard Cochran <richardcochran@...il.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Russell King <linux@...linux.org.uk>
Subject: Re: [net-next, v2, 2/2] enetc: support PTP Sync packet one-step
timestamping
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.
Powered by blists - more mailing lists