summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@mellanox.co.il>2006-03-20 12:35:34 +0200
committerRoland Dreier <rolandd@cisco.com>2006-03-24 15:47:27 -0800
commitded9ad721d220d47989177076a181ae1f1b93af5 (patch)
tree4cd58fe6bccaaa133fbba3f22729dda3e6cb213f /drivers
parent0ef61db837c93d4377fabd37182bb6f83ea5ca70 (diff)
downloadop-kernel-dev-ded9ad721d220d47989177076a181ae1f1b93af5.zip
op-kernel-dev-ded9ad721d220d47989177076a181ae1f1b93af5.tar.gz
IB/mthca: Check that SRQ WQE size does not exceed device's max value
Guarantee the calculated work queue entry size does not exceed the max allowable WQE size when creating an SRQ. This is a problem with Arbel in Tavor-compatibility mode because the current WQE size computation method rounds up to next power of 2. Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 47a6a75..4e671e0 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -205,6 +205,10 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
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);
OpenPOWER on IntegriCloud