[openib-general] [PATCH] libmthca: fix posting long send lists on arbel

Michael S. Tsirkin mst at mellanox.co.il
Tue Nov 29 02:30:59 PST 2005


libmthca: fix posting send work request lists of length >= 255 on Arbel.

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

Index: trunk/src/userspace/libmthca/src/qp.c
===================================================================
--- trunk/src/userspace/libmthca/src/qp.c	(revision 4126)
+++ trunk/src/userspace/libmthca/src/qp.c	(working copy)
@@ -422,6 +422,31 @@ int mthca_arbel_post_send(struct ibv_qp 
 	ind = qp->sq.head & (qp->sq.max - 1);
 
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
+		if (nreq == MTHCA_ARBEL_MAX_WQES_PER_SEND_DB) {
+			uint32_t doorbell[2];
+			nreq = 0;
+			doorbell[0] = htonl((MTHCA_ARBEL_MAX_WQES_PER_SEND_DB << 24) |
+					    ((qp->sq.head & 0xffff) << 8) | f0 | op0);
+			doorbell[1] = htonl((ibqp->qp_num << 8) | size0);
+			size0 = 0;
+
+			qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB;
+
+			/*
+			 * Make sure that descriptors are written before
+			 * doorbell record.
+			 */
+			mb();
+			*qp->sq.db = htonl(qp->sq.head & 0xffff);
+
+			/*
+			 * Make sure doorbell record is written before we
+			 * write MMIO send doorbell.
+			 */
+			mb();
+			mthca_write64(doorbell, to_mctx(ibqp->context), MTHCA_SEND_DOORBELL);
+		}
+
 		if (wq_overflow(&qp->sq, nreq, to_mcq(qp->ibv_qp.send_cq))) {
 			ret = -1;
 			*bad_wr = wr;
Index: trunk/src/userspace/libmthca/src/wqe.h
===================================================================
--- trunk/src/userspace/libmthca/src/wqe.h	(revision 4126)
+++ trunk/src/userspace/libmthca/src/wqe.h	(working copy)
@@ -55,7 +55,8 @@ enum {
 
 enum {
 	MTHCA_INVAL_LKEY			= 0x100,
-	MTHCA_TAVOR_MAX_WQES_PER_RECV_DB	= 256
+	MTHCA_TAVOR_MAX_WQES_PER_RECV_DB	= 256,
+	MTHCA_ARBEL_MAX_WQES_PER_SEND_DB	= 255
 };
 
 struct mthca_next_seg {

-- 
MST



More information about the general mailing list