[XFS] Fix merge failures
[pandora-kernel.git] / drivers / net / enic / vnic_wq.h
index 7081828..c826137 100644 (file)
@@ -108,8 +108,15 @@ static inline void vnic_wq_post(struct vnic_wq *wq,
        buf->len = len;
 
        buf = buf->next;
-       if (eop)
+       if (eop) {
+               /* Adding write memory barrier prevents compiler and/or CPU
+                * reordering, thus avoiding descriptor posting before
+                * descriptor is initialized. Otherwise, hardware can read
+                * stale descriptor fields.
+                */
+               wmb();
                iowrite32(buf->index, &wq->ctrl->posted_index);
+       }
        wq->to_use = buf;
 
        wq->ring.desc_avail--;