[openib-general] [PATCH] mthca: fix max_wr value in create_srq/query_srq when using memfree devices

Dotan Barak dotanb at mellanox.co.il
Thu Mar 9 04:11:00 PST 2006


mthca: in create_srq and in query_srq the returned value of max_wr should be
       decremented because memfree devices need to reserve one wr.

Signed-off-by: Dotan Barak <dotanb at mellanox.co.il>

Index: latest/drivers/infiniband/hw/mthca/mthca_srq.c
===================================================================
--- latest.orig/drivers/infiniband/hw/mthca/mthca_srq.c	2006-03-09 
09:30:36.000000000 +0200
+++ latest/drivers/infiniband/hw/mthca/mthca_srq.c	2006-03-09 
11:27:47.000000000 +0200
@@ -271,7 +271,7 @@ int mthca_alloc_srq(struct mthca_dev *de
 	srq->first_free = 0;
 	srq->last_free  = srq->max - 1;
 
-	attr->max_wr    = srq->max;
+	attr->max_wr    = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max;
 	attr->max_sge   = srq->max_gs;
 
 	return 0;
@@ -386,7 +386,7 @@ int mthca_query_srq(struct ib_srq *ibsrq
 	} else
 		srq_attr->srq_limit = 0;
 
-	srq_attr->max_wr  = srq->max;
+	srq_attr->max_wr  = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max;
 	srq_attr->max_sge = srq->max_gs;
 
 out:



More information about the general mailing list