Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: David Miller <davem@davemloft.net>,
	yevgenyp@mellanox.co.il, netdev@vger.kernel.org
Subject: RE: [PATCH 4/4] net/mlx4_en: Use atomic counter to decide when queue is full
Date: Mon, 25 Jun 2012 12:12:05 +0200	[thread overview]
Message-ID: <1340619125.10893.20.camel@edumazet-glaptop> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6F61@saturn3.aculab.com>

On Mon, 2012-06-25 at 10:00 +0100, David Laight wrote:
> > > The Transmit and transmit completion flows execute from different
> contexts,
> > > which are not synchronized. Hence naive reading the of consumer
> index might
> > > give wrong value by the time it is being used, That could lead to a
> state of transmit timeout.
> > > Fix that by using atomic variable to maintain that index.
> > > 
> > > Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
> > 
> > I'm not convinced.  There is only one place that actually changes
> > the counter.
> > 
> > So it seems more like you have a missing memory barrier somewhere.
> 
> Or just keep the two ring indexes - instead of keeping the
> number of 'active' entries as well.
> Then you don't have a variable which the tx setup and
> tx completion routines both update.

This is what was implied by David.

Using a producer/consumer index and appropriate memory barriers.

start_xmit() and tx completion can be truly lockless and atomicless in
their fast path.

There are many drivers doing that correctly.

tg3 driver is a good example.

  reply	other threads:[~2012-06-25 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21  9:19 [PATCH net 0/4] net/mlx4: Bug fixes for the mlx4_en driver Yevgeny Petrilin
2012-06-21  9:19 ` [PATCH 1/4] net/mlx4_en: Set correct port parameters during device initialization Yevgeny Petrilin
2012-06-21  9:19 ` [PATCH 2/4] net/mlx4: Use single completion vector after NOP failure Yevgeny Petrilin
2012-06-21  9:19 ` [PATCH 3/4] net/mlx4_en: Release QP range in free_resources Yevgeny Petrilin
2012-06-21  9:19 ` [PATCH 4/4] net/mlx4_en: Use atomic counter to decide when queue is full Yevgeny Petrilin
2012-06-23  0:23   ` David Miller
2012-06-25  9:00     ` David Laight
2012-06-25 10:12       ` Eric Dumazet [this message]
2012-06-25 13:06     ` Yevgeny Petrilin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340619125.10893.20.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yevgenyp@mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox