Skip to content

Commit

Permalink
IB/mthca: Check that SRQ WQE size does not exceed device's max value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Mar 24, 2006
1 parent 0ef61db commit ded9ad7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/infiniband/hw/mthca/mthca_srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ded9ad7

Please sign in to comment.