diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-05-20 11:06:44 -0700 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-05-20 11:06:44 -0700 |
commit | 4662a6697713aac6c375ad5d73e6566f1cd17aa5 (patch) | |
tree | 111037e3842d9e6b2f2499f49d93f2cfa0dd10a8 | |
parent | 28b139ac1e8ca13f848c69a6d1ba1f9305612033 (diff) | |
download | libmlx4-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.h | 14 | ||||
-rw-r--r-- | src/qp.c | 5 |
2 files changed, 18 insertions, 1 deletions
@@ -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: " @@ -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; |