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

Michael S. Tsirkin mst at mellanox.co.il
Wed Nov 9 08:04:00 PST 2005


Same thing for kernel level mthca.

---

mthca: fix posting work request lists of length > 255 for Tavor.

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

Index: linux-kernel/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- linux-kernel/drivers/infiniband/hw/mthca/mthca_qp.c	(revision 3992)
+++ linux-kernel/drivers/infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -176,6 +176,8 @@ enum {
 	MTHCA_QP_OPTPAR_SCHED_QUEUE       = 1 << 16
 };
 
+#define MTHCA_TAVOR_WQES_PER_RECV_DOORBELL 256
+
 static const u8 mthca_opcode[] = {
 	[IB_WR_SEND]                 = MTHCA_OPCODE_SEND,
 	[IB_WR_SEND_WITH_IMM]        = MTHCA_OPCODE_SEND_IMM,
@@ -1652,6 +1654,23 @@ int mthca_tavor_post_receive(struct ib_q
 	ind = qp->rq.next_ind;
 
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
+		if (unlikely(nreq == MTHCA_TAVOR_WQES_PER_RECV_DOORBELL)) {
+			__be32 doorbell[2];
+
+			doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
+			doorbell[1] = cpu_to_be32(qp->qpn << 8);
+
+			wmb();
+
+			mthca_write64(doorbell,
+				dev->kar + MTHCA_RECEIVE_DOORBELL,
+				MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+
+			qp->rq.head += nreq;
+			nreq = 0;
+			size0 = 0;
+		}
+		
 		if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
 			mthca_err(dev, "RQ %06x full (%u head, %u tail,"
 					" %d max, %d nreq)\n", qp->qpn,

-- 
MST



More information about the general mailing list