[openib-general] libmthca: make fence work

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


libmthca: fence bit must be set in doorbell, not only in WQE

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

Index: openib/src/userspace/libmthca/src/qp.c
===================================================================
--- openib/src/userspace/libmthca/src/qp.c	(revision 8841)
+++ openib/src/userspace/libmthca/src/qp.c	(working copy)
@@ -106,7 +106,8 @@ int mthca_tavor_post_send(struct ibv_qp 
 	int ret = 0;
 	int size, size0 = 0;
 	int i;
-	uint32_t f0 = 0, op0 = 0;
+	uint32_t f0 = (wr->send_flags & IBV_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
+	uint32_t op0 = 0;
 
 	pthread_spin_lock(&qp->sq.lock);
 
@@ -436,7 +437,8 @@ int mthca_arbel_post_send(struct ibv_qp 
 	int ret = 0;
 	int size, size0 = 0;
 	int i;
-	uint32_t f0 = 0, op0 = 0;
+	uint32_t f0 = (wr->send_flags & IBV_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
+	uint32_t op0 = 0;
 
 	pthread_spin_lock(&qp->sq.lock);
 
@@ -469,6 +471,7 @@ int mthca_arbel_post_send(struct ibv_qp 
 			mthca_write64(doorbell, to_mctx(ibqp->context), MTHCA_SEND_DOORBELL);
 
 			size0 = 0;
+			f0 = (wr->send_flags & IBV_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 		}
 
 		if (wq_overflow(&qp->sq, nreq, to_mcq(qp->ibv_qp.send_cq))) {
Index: openib/src/userspace/libmthca/src/wqe.h
===================================================================
--- openib/src/userspace/libmthca/src/wqe.h	(revision 8841)
+++ openib/src/userspace/libmthca/src/wqe.h	(working copy)
@@ -42,6 +42,10 @@ enum {
 };
 
 enum {
+	MTHCA_SEND_DOORBELL_FENCE = 1 << 5
+};
+
+enum {
 	MTHCA_NEXT_DBD       = 1 << 7,
 	MTHCA_NEXT_FENCE     = 1 << 6,
 	MTHCA_NEXT_CQ_UPDATE = 1 << 3,

-- 
MST




More information about the general mailing list