From: Ben Hutchings Date: Mon, 1 Sep 2008 11:50:08 +0000 (+0100) Subject: sfc: Insert read memory barrier after checking MAC statistics flag X-Git-Tag: v2.6.28-rc1~717^2~195^2~47 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=1d0680fd6235e0aa5baf14a8f1ff85eff9dc1fb3;p=linux-2.6-omap-h63xx.git sfc: Insert read memory barrier after checking MAC statistics flag This prevents speculative reading of the statistics before the completion flag. From: Neil Turton Signed-off-by: Ben Hutchings Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 70c681ecdab..3a5289fe8d1 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c @@ -1953,8 +1953,10 @@ int falcon_dma_stats(struct efx_nic *efx, unsigned int done_offset) /* Wait for transfer to complete */ for (i = 0; i < 400; i++) { - if (*(volatile u32 *)dma_done == FALCON_STATS_DONE) + if (*(volatile u32 *)dma_done == FALCON_STATS_DONE) { + rmb(); /* Ensure the stats are valid. */ return 0; + } udelay(10); }