Thread (8 messages) flat view 8 messages, 5 authors, 2011-03-24

Re: [RFC] myri10ge: small rx_done refactoring

From: Stephen Hemminger <hidden>
Date: 2011-03-24 15:15:44

On Thu, 24 Mar 2011 09:16:21 +0100
Stanislaw Gruszka [off-list ref] wrote:
On Wed, Mar 23, 2011 at 08:33:57AM -0700, Stephen Hemminger wrote:
quoted
On Wed, 23 Mar 2011 13:52:04 +0100
Stanislaw Gruszka [off-list ref] wrote:
quoted
Add lro_enable variable to read NETIF_F_LRO flag only once per napi poll
call. This should fix theoretical race condition with
myri10ge_set_rx_csum() and myri10ge_set_flags() where flag NETIF_F_LRO
can be changed.
You may need a barrier or the race may still be there.
I don't understand why barrier in that case is need.

What I tried to avoid is.

myri10ge_clean_rx_done():

if (dev->features & NETIF_F_LRO) 
	setup lro 
					myri10ge_set_flags()

if (dev->features & NETIF_F_LRO)
	flush lro

Now we read dev->features & NETIF_F_LRO only once to local
lro_enabled variable. So we can not flush without setup
or setup without flush. No idea why memory barries is still
needed.
quoted
The driver seems to use mb() where wmb() is intended, and never use rmb()?
Yes, I think we can have some optimalization here.
Without barrier there is no guarantee that compiler read the flags
into a local variable. It is free to do the same thing as the original
code.

-- 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help