Skip to content

Commit

Permalink
IB/mthca: Fix SRQ limit event range check
Browse files Browse the repository at this point in the history
Mem-free HCAs always keep one spare SRQ WQE, so the SRQ limit cannot
be set beyond srq->max - 1.

Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Dotan Barak authored and Roland Dreier committed Jul 24, 2006
1 parent 43db2bc commit 1252c51
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/hw/mthca/mthca_srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
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);
Expand Down

0 comments on commit 1252c51

Please sign in to comment.