aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2007-05-20 11:06:44 -0700
committerRoland Dreier <rolandd@cisco.com>2007-05-20 11:06:44 -0700
commit4662a6697713aac6c375ad5d73e6566f1cd17aa5 (patch)
tree111037e3842d9e6b2f2499f49d93f2cfa0dd10a8
parent28b139ac1e8ca13f848c69a6d1ba1f9305612033 (diff)
downloadlibmlx4-4662a6697713aac6c375ad5d73e6566f1cd17aa5.tar.gz
Use wc_wmb() when posting BlueFlame send WQEs
Use wc_wmb() after copying WQE to BlueFlame register to avoid having WQEs reach the device out of order if the BlueFlame page is mapped with write combining. Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--src/mlx4.h14
-rw-r--r--src/qp.c5
2 files changed, 18 insertions, 1 deletions
diff --git a/src/mlx4.h b/src/mlx4.h
index c4d389f..1e92b88 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -65,6 +65,20 @@
# define wmb() mb()
#endif
+#ifndef wc_wmb
+
+#if defined(__i386__)
+#define wc_wmb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
+#elif defined(__x86_64__)
+#define wc_wmb() asm volatile("sfence" ::: "memory")
+#elif defined(__ia64__)
+#define wc_wmb() asm volatile("fwb" ::: "memory")
+#else
+#define wc_wmb() wmb()
+#endif
+
+#endif
+
#define HIDDEN __attribute__((visibility ("hidden")))
#define PFX "mlx4: "
diff --git a/src/qp.c b/src/qp.c
index a70e5f2..a4384f9 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -282,9 +282,12 @@ out:
++qp->sq.head;
pthread_spin_lock(&ctx->bf_lock);
+
memcpy(ctx->bf_page + ctx->bf_offset, ctrl, align(size * 16, 64));
- /* FIXME flush wc buffers */
+ wc_wmb();
+
ctx->bf_offset ^= ctx->bf_buf_size;
+
pthread_spin_unlock(&ctx->bf_lock);
} else if (nreq) {
qp->sq.head += nreq;