]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/enic/vnic_wq.h
Merge branches 'irq/sparseirq' and 'linus' into irq/core
[linux-2.6-omap-h63xx.git] / drivers / net / enic / vnic_wq.h
index 7081828d8a42bd98a8ed7bdacf1cc1254da63b9f..c826137dc6517c2d9d5c5bcef23c45b063659f37 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--;