[openib-general] [PATCH] libmthca: fix posting long work request lists

Michael S. Tsirkin mst at mellanox.co.il
Wed Nov 9 07:51:31 PST 2005


Hello, Roland!
Tavor requires ringing a recv doorbell at least each 256 WQEs.
WQE count in doorbell must be set to 0 in this case.
Here's a patch.

---

Fix posting work request lists of length > 255 for Tavor.

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

Index: src/userspace/libmthca/src/qp.c
===================================================================
--- src/userspace/libmthca/src/qp.c	(revision 3994)
+++ src/userspace/libmthca/src/qp.c	(working copy)
@@ -45,6 +45,8 @@
 #include "doorbell.h"
 #include "wqe.h"
 
+#define MTHCA_TAVOR_WQES_PER_RECV_DOORBELL 256
+
 static const uint8_t mthca_opcode[] = {
 	[IBV_WR_SEND]                 = MTHCA_OPCODE_SEND,
 	[IBV_WR_SEND_WITH_IMM]        = MTHCA_OPCODE_SEND_IMM,
@@ -313,6 +315,18 @@ int mthca_tavor_post_recv(struct ibv_qp 
 	ind = qp->rq.next_ind;
 
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
+		if (nreq == MTHCA_TAVOR_WQES_PER_RECV_DOORBELL) {
+			uint32_t doorbell[2];
+
+			doorbell[0] = htonl((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
+			doorbell[1] = htonl(ibqp->qp_num << 8);
+
+			mthca_write64(doorbell, to_mctx(ibqp->context), MTHCA_RECV_DOORBELL);
+			qp->rq.head += nreq;
+			nreq = 0;
+			size0 = 0;
+		}
+
 		if (wq_overflow(&qp->rq, nreq, to_mcq(qp->ibv_qp.send_cq))) {
 			ret = -1;
 			*bad_wr = wr;

-- 
MST



More information about the general mailing list