Thread (9 messages) flat view 9 messages, 5 authors, 2012-06-25

RE: [PATCH 4/4] net/mlx4_en: Use atomic counter to decide when queue is full

From: Eric Dumazet <hidden>
Date: 2012-06-25 10:12:09

On Mon, 2012-06-25 at 10:00 +0100, David Laight wrote:
quoted
quoted
The Transmit and transmit completion flows execute from different
contexts,
quoted
quoted
which are not synchronized. Hence naive reading the of consumer
index might
quoted
quoted
give wrong value by the time it is being used, That could lead to a
state of transmit timeout.
quoted
quoted
Fix that by using atomic variable to maintain that index.

Signed-off-by: Yevgeny Petrilin <redacted>
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help