[openib-general] fix limit event range check for memfree

Michael S. Tsirkin mst at mellanox.co.il
Thu Jul 13 01:05:49 PDT 2006


Hi, Roland!
Here's a small mthca patch from Dotan Barak.

---

mthca: fix limit event range check for memfree.

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

Index: openib/drivers/infiniband/hw/mthca/mthca_srq.c
===================================================================
--- openib/drivers/infiniband/hw/mthca/mthca_srq.c	(revision 8189)
+++ openib/drivers/infiniband/hw/mthca/mthca_srq.c	(working copy)
@@ -370,7 +370,8 @@ int mthca_modify_srq(struct ib_srq *ibsr
 		return -EINVAL;
 
 	if (attr_mask & IB_SRQ_LIMIT) {
-		if (attr->srq_limit > srq->max)
+		u32 max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max;
+		if (attr->srq_limit > max_wr)
 			return -EINVAL;
 
 		mutex_lock(&srq->mutex);

-- 
MST




More information about the general mailing list