diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-10-09 12:06:32 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-10-10 15:50:38 -0400 |
commit | 2cbe19d48af198f0070470a2d836828de24fe163 (patch) | |
tree | 4e6c27a49dc2aa5a4cf3c026b8cdcbfe9b15be72 /drivers/infiniband/hw | |
parent | 73fbe8be73512b8a3ffa3d20c9d7f531af99679c (diff) |
IB/mthca: Fix off-by-one in mthca SRQ creation
All HCAs (not just mem-free) need a spare SRQ entry, so bump srq->max
by 1 in all cases.
Noted by Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_srq.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 0f316c87bf64..92a72f521528 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -201,6 +201,8 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
201 | 201 | ||
202 | if (mthca_is_memfree(dev)) | 202 | if (mthca_is_memfree(dev)) |
203 | srq->max = roundup_pow_of_two(srq->max + 1); | 203 | srq->max = roundup_pow_of_two(srq->max + 1); |
204 | else | ||
205 | srq->max = srq->max + 1; | ||
204 | 206 | ||
205 | ds = max(64UL, | 207 | ds = max(64UL, |
206 | roundup_pow_of_two(sizeof (struct mthca_next_seg) + | 208 | roundup_pow_of_two(sizeof (struct mthca_next_seg) + |
@@ -277,7 +279,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
277 | srq->first_free = 0; | 279 | srq->first_free = 0; |
278 | srq->last_free = srq->max - 1; | 280 | srq->last_free = srq->max - 1; |
279 | 281 | ||
280 | attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max; | 282 | attr->max_wr = srq->max - 1; |
281 | attr->max_sge = srq->max_gs; | 283 | attr->max_sge = srq->max_gs; |
282 | 284 | ||
283 | return 0; | 285 | return 0; |
@@ -413,7 +415,7 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr) | |||
413 | srq_attr->srq_limit = be16_to_cpu(tavor_ctx->limit_watermark); | 415 | srq_attr->srq_limit = be16_to_cpu(tavor_ctx->limit_watermark); |
414 | } | 416 | } |
415 | 417 | ||
416 | srq_attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max; | 418 | srq_attr->max_wr = srq->max - 1; |
417 | srq_attr->max_sge = srq->max_gs; | 419 | srq_attr->max_sge = srq->max_gs; |
418 | 420 | ||
419 | out: | 421 | out: |