[openib-general] [PATCH] mthca: check that srq wqe size does not exceed DEV_LIM max value

Jack Morgenstein jackm at mellanox.co.il
Mon Mar 20 02:35:34 PST 2006


Guarantee that do not exceed max allowable wqe size when creating srq.
(Is a problem in Arbel/Tavor-mode with current wqe size computation method 
which rounds up to next power of 2).

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: drivers/infiniband/hw/mthca/mthca_srq.c
===================================================================
--- drivers/infiniband/hw/mthca/mthca_srq.c	(revision 5887)
+++ drivers/infiniband/hw/mthca/mthca_srq.c	(working copy)
@@ -205,6 +205,10 @@ int mthca_alloc_srq(struct mthca_dev *de
 	ds = max(64UL,
 		 roundup_pow_of_two(sizeof (struct mthca_next_seg) +
 				    srq->max_gs * sizeof (struct mthca_data_seg)));
+
+	if (ds > dev->limits.max_desc_sz)
+		return -EINVAL;
+
 	srq->wqe_shift = long_log2(ds);
 
 	srq->srqn = mthca_alloc(&dev->srq_table.alloc);



More information about the general mailing list