Re: [RFC PATCH] bnx2x: fix tx queue locking and memory barriers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Howells
Date: Wednesday, March 10, 2010 - 10:19 am

David Howells <dhowells@redhat.com> wrote:


Having said that, you might need a memory barrier before reading tx_bd_prod in
the consumer if the producer waggles a flag in memory to indicate to the
consumer that it should consume, and a memory barrier in the producer before
waggling that flag:

	[producer]
	...
	smp_wmb(); /* commit buffer contents before incrementing index */
	fp->tx_bd_prod = TX_BD(bd_prod + 1);
	smp_wmb(); /* commit increment index before prodding consumer */
	prod_consumer();

	[consumer]
	check_prod_flag();
	smp_rmb(); /* read producer index after checking prod flag */
	bd_prod = fp->tx_bd_prod;
	bd_cons = fp->tx_bd_cons;
	smp_read_barrier_depends(); /* read index before reading contents */

David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC PATCH] bnx2x: fix tx queue locking and memory barriers, Stanislaw Gruszka, (Thu Feb 25, 6:08 am)
RE: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Vladislav Zolotarov, (Thu Feb 25, 6:28 am)
Re: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Stanislaw Gruszka, (Thu Feb 25, 8:40 am)
RE: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Vladislav Zolotarov, (Thu Feb 25, 8:49 am)
Re: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Stanislaw Gruszka, (Thu Feb 25, 9:03 am)
RE: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Vladislav Zolotarov, (Thu Feb 25, 9:14 am)
Re: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Stanislaw Gruszka, (Thu Feb 25, 9:16 am)
Re: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., David Howells, (Wed Mar 10, 10:19 am)
Re: [RFC PATCH] bnx2x: fix tx queue locking and memory bar ..., Stanislaw Gruszka, (Thu Mar 11, 6:10 am)