[openib-general] [PATCH updated] mthca: memfree completion with error workaround

Michael S. Tsirkin mst at mellanox.co.il
Tue Jun 13 07:19:42 PDT 2006


OK, here's an optimized version of the fix. With this, I see:

before
   5994       0       0    5994    176a drivers/infiniband/hw/mthca/mthca_cq.o
after
   5995       0       0    5995    176b drivers/infiniband/hw/mthca/mthca_cq.o

So the cost is minimal. Please consider for 2.6.17.

---

Memfree firmware is in rare cases reporting WQE index == base - 1
in receive completion with error instead of (rq size - 1); base is 0 in mthca.
Here is a patch to avoid kernel crash and report a correct WR id in this case.

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

Index: linux-2.6.16/drivers/infiniband/hw/mthca/mthca_cq.c
===================================================================
--- linux-2.6.16.orig/drivers/infiniband/hw/mthca/mthca_cq.c	2006-05-16 12:33:05.000000000 +0300
+++ linux-2.6.16/drivers/infiniband/hw/mthca/mthca_cq.c	2006-06-13 12:14:13.000000000 +0300
@@ -540,8 +540,17 @@ static inline int mthca_poll_one(struct 
 		entry->wr_id = srq->wrid[wqe_index];
 		mthca_free_srq_wqe(srq, wqe);
 	} else {
+		s32 wqe;
 		wq = &(*cur_qp)->rq;
-		wqe_index = be32_to_cpu(cqe->wqe) >> wq->wqe_shift;
+		wqe = be32_to_cpu(cqe->wqe);
+		wqe_index = wqe >> wq->wqe_shift;
+               /*
+		* WQE addr == base - 1 might be reported in receive completion
+		* with error instead of (rq size - 1) by Sinai FW 1.0.800,
+		* Arbel FW 5.1.400 and should be fixed in later revisions.
+		*/
+		if (unlikely(wqe_index < 0))
+			wqe_index = wq->max - 1;
 		entry->wr_id = (*cur_qp)->wrid[wqe_index];
 	}
 
-- 
MST




More information about the general mailing list