aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_wq.h
diff options
context:
space:
mode:
authorScott Feldman <scofeldm@cisco.com>2008-11-22 00:29:01 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-22 00:29:01 -0500
commit845964515a76381e204d3399af82c149f8abcc1c (patch)
tree46f7f16c17294ccf56bd9f964e74a92cf7e7871e /drivers/net/enic/vnic_wq.h
parentcb3c766975985885e64e20cc72c4a36d90da2b30 (diff)
enic: move wmb closer to where needed: before writing posted_index to hw
Signed-off-by: Scott Feldman <scofeldm@cisco.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/enic/vnic_wq.h')
-rw-r--r--drivers/net/enic/vnic_wq.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/enic/vnic_wq.h b/drivers/net/enic/vnic_wq.h
index 7081828d8a42..c826137dc651 100644
--- a/drivers/net/enic/vnic_wq.h
+++ b/drivers/net/enic/vnic_wq.h
@@ -108,8 +108,15 @@ static inline void vnic_wq_post(struct vnic_wq *wq,
108 buf->len = len; 108 buf->len = len;
109 109
110 buf = buf->next; 110 buf = buf->next;
111 if (eop) 111 if (eop) {
112 /* Adding write memory barrier prevents compiler and/or CPU
113 * reordering, thus avoiding descriptor posting before
114 * descriptor is initialized. Otherwise, hardware can read
115 * stale descriptor fields.
116 */
117 wmb();
112 iowrite32(buf->index, &wq->ctrl->posted_index); 118 iowrite32(buf->index, &wq->ctrl->posted_index);
119 }
113 wq->to_use = buf; 120 wq->to_use = buf;
114 121
115 wq->ring.desc_avail--; 122 wq->ring.desc_avail--;