[openib-general] [PATCH] mthca: make IB_SEND_FENCE work

Michael S. Tsirkin mst at mellanox.co.il
Wed Aug 9 00:04:35 PDT 2006


IB/mthca: make IB_SEND_FENCE work

Fence bit must be set in the doorbell, not only in WQE

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

diff --git a/drivers/infiniband/hw/mthca/mthca_doorbell.h b/drivers/infiniband/hw/mthca/mthca_doorbell.h
index dd9a44d..e5f0ad6 100644
--- a/drivers/infiniband/hw/mthca/mthca_doorbell.h
+++ b/drivers/infiniband/hw/mthca/mthca_doorbell.h
@@ -42,6 +42,10 @@ #define MTHCA_RECEIVE_DOORBELL 0x18
 #define MTHCA_CQ_DOORBELL      0x20
 #define MTHCA_EQ_DOORBELL      0x28
 
+enum {
+	MTHCA_SEND_DOORBELL_FENCE = 1 << 5
+};
+
 #if BITS_PER_LONG == 64
 /*
  * Assume that we can just write a 64-bit doorbell atomically.  s390
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index cd8b672..6efba4a 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1502,7 +1502,7 @@ int mthca_tavor_post_send(struct ib_qp *
 	int i;
 	int size;
 	int size0 = 0;
-	u32 f0 = 0;
+	u32 f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 	int ind;
 	u8 op0 = 0;
 
@@ -1843,7 +1843,7 @@ int mthca_arbel_post_send(struct ib_qp *
 	int i;
 	int size;
 	int size0 = 0;
-	u32 f0 = 0;
+	u32 f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 	int ind;
 	u8 op0 = 0;
 
@@ -1864,6 +1864,7 @@ int mthca_arbel_post_send(struct ib_qp *
 
 			qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB;
 			size0 = 0;
+			f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 
 			/*
 			 * Make sure that descriptors are written before

-- 
MST




More information about the general mailing list