[openib-general] [PATCH] libmthca: work around for cqe with error

Michael S. Tsirkin mst at mellanox.co.il
Mon Jun 12 05:16:47 PDT 2006


Same patch as posted earlier for kernel.

---

libmthca: completion with error for memfree might get WQE index == -1.

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

Index: openib/src/userspace/libmthca/src/cq.c
===================================================================
--- openib/src/userspace/libmthca/src/cq.c	(revision 7890)
+++ openib/src/userspace/libmthca/src/cq.c	(working copy)
@@ -349,6 +349,22 @@
 	} else {
 		wq = &(*cur_qp)->rq;
 		wqe_index = ntohl(cqe->wqe) >> wq->wqe_shift;
+		/* WQE index == -1 might be reported by
+		   Sinai FW 1.0.800, Arbel FW 5.1.400 and should be fixed
+		   in later revisions. */
+		if (wqe_index >= (*cur_qp)->rq.max) {
+			if (is_error &&
+			    (wqe_index == 0xffffffff >> wq->wqe_shift) &&
+			    mthca_is_memfree(cq->ibv_cq.context))
+				wqe_index = wq->max - 1;
+			else {
+				printf("Corrupted RQ CQE. "
+				       "CQ 0x%x QP 0x%x idx 0x%x > 0x%x\n",
+				       cq->cqn, wc->qp_num, wqe_index,
+				       wq->max);
+				return -1;
+			}
+		}
 		wc->wr_id = (*cur_qp)->wrid[wqe_index];
 	}
 

-- 
MST




More information about the general mailing list