> On Mon, Mar 18, 2019 at 12:09:32PM +0100, Lorenzo Bianconi wrote: > > Similar to pci counterpart, reduce locking in mt76u_tx_tasklet since > > q->head is managed just in mt76u_tx_tasklet and q->queued is updated > > holding q->lock > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> > > --- > > drivers/net/wireless/mediatek/mt76/usb.c | 18 +++++++++++------- > > 1 file changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c > > index ac03acdae279..8cd70c32d77a 100644 > > --- a/drivers/net/wireless/mediatek/mt76/usb.c > > +++ b/drivers/net/wireless/mediatek/mt76/usb.c > > @@ -634,29 +634,33 @@ static void mt76u_tx_tasklet(unsigned long data) > > int i; > > > > for (i = 0; i < IEEE80211_NUM_ACS; i++) { > > + u32 n_queued = 0, n_sw_queued = 0; > > + > > sq = &dev->q_tx[i]; > > q = sq->q; > > > > - spin_lock_bh(&q->lock); > > - while (true) { > > + while (q->queued > n_queued) { > > buf = &q->entry[q->head].ubuf; > > - if (!buf->done || !q->queued) > > + if (!buf->done) > > break; > > I'm still thinking if this is safe or not. Is somewhat tricky to > read variable outside the lock because in such case there is no time > guarantee when variable written on one CPU gets updated value on > different CPU. And for USB is not only q->queued but also buf->done. Hi Stanislaw, I was wondering if this is safe as well, but q->queued is updated holding q->lock and I guess it will ensure to not overlap tx and status code path. Regarding buf->done, it is already updated without holding the lock in mt76u_complete_tx Regards, Lorenzo > > Stanislaw >
Attachment:
signature.asc
Description: PGP signature