Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b6330ce2a3e1f152f79a6203f73d23356e243a7
Commit:     3b6330ce2a3e1f152f79a6203f73d23356e243a7
Parent:     dbf2e8585971f2a8b1f60a188dc245fd2f8f81b3
Author:     Scott Wood <[EMAIL PROTECTED]>
AuthorDate: Wed May 16 15:06:59 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Thu May 17 20:43:15 2007 -0400

    gianfar: Add I/O barriers when touching buffer descriptor ownership.
    
    The hardware must not see that is given ownership of a buffer until it is
    completely written, and when the driver receives ownership of a buffer,
    it must ensure that any other reads to the buffer reflect its final
    state.  Thus, I/O barriers are added where required.
    
    Without this patch, I have observed GCC reordering the setting of
    bdp->length and bdp->status in gfar_new_skb.  Hardware reordering
    was also theoretically possible.
    
    Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/gianfar.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index b666a0c..f5b3cba 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1025,6 +1025,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
 
        dev->trans_start = jiffies;
 
+       /* The powerpc-specific eieio() is used, as wmb() has too strong
+        * semantics (it requires synchronization between cacheable and
+        * uncacheable mappings, which eieio doesn't provide and which we
+        * don't need), thus requiring a more expensive sync instruction.  At
+        * some point, the set of architecture-independent barrier functions
+        * should be expanded to include weaker barriers.
+        */
+
+       eieio();
        txbdp->status = status;
 
        /* If this was the last BD in the ring, the next one */
@@ -1301,6 +1310,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, 
struct rxbd8 *bdp)
        bdp->length = 0;
 
        /* Mark the buffer empty */
+       eieio();
        bdp->status |= (RXBD_EMPTY | RXBD_INTERRUPT);
 
        return skb;
@@ -1484,6 +1494,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int 
rx_work_limit)
        bdp = priv->cur_rx;
 
        while (!((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))) {
+               rmb();
                skb = priv->rx_skbuff[priv->skb_currx];
 
                if (!(bdp->status &
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to