[PATCH v2] gianfar: Add I/O barriers when touching buffer descriptor ownership.

Scott Wood scottwood at freescale.com
Fri May 4 02:00:50 EST 2007


Kumar Gala wrote:
> So what about some thing like this where we do the read only once?
> 
> - k
> 
> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
> index a06d8d1..9cd7d1e 100644
> --- a/drivers/net/gianfar.c
> +++ b/drivers/net/gianfar.c
> @@ -1438,31 +1438,35 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
>  {
>  	struct rxbd8 *bdp;
>  	struct sk_buff *skb;
> -	u16 pkt_len;
> +	u16 pkt_len, status;
> +	u32 bd_info;


I suggested that on IRC yesterday, and Segher was concerned that the 
compiler might, in theory, "optimize" it into to two lhz instructions. 
I'm rather skeptical that it would actually do so (even if it needs to 
load twice due to register pressure, why not just use lwz both times?), 
and there's probably many other places that would break if it did, but I 
wasn't up for digging around GCC to prove otherwise.

Plus, that wouldn't synchronize the bd_info read with the buffer data reads.

-Scott



More information about the Linuxppc-dev mailing list