aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_wq.h
diff options
context:
space:
mode:
authorScott Feldman <scofeldm@cisco.com>2008-11-21 21:29:01 -0800
committerDavid S. Miller <davem@davemloft.net>2008-11-21 21:29:01 -0800
commit845964515a76381e204d3399af82c149f8abcc1c (patch)
tree46f7f16c17294ccf56bd9f964e74a92cf7e7871e /drivers/net/enic/vnic_wq.h
parentcb3c766975985885e64e20cc72c4a36d90da2b30 (diff)
downloadkernel_samsung_aries-845964515a76381e204d3399af82c149f8abcc1c.zip
kernel_samsung_aries-845964515a76381e204d3399af82c149f8abcc1c.tar.gz
kernel_samsung_aries-845964515a76381e204d3399af82c149f8abcc1c.tar.bz2
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 7081828..c826137 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,
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--;