diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-06-13 10:19:42 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-06-17 23:37:20 -0400 |
commit | 4e56ea794ec8636991e21942fc2e0d071ea8ee1d (patch) | |
tree | eb03f5a3246c69fdaf6dd485395b13d33aef158d /drivers/infiniband/hw | |
parent | 13aa6ecb47990cfc78e20e347fdd3f1df6189426 (diff) |
IB/mthca: memfree completion with error FW bug workaround
Memfree firmware is in rare cases reporting WQE index == base - 1 in
receive completion with error, instead of (rq size - 1); base is 0 in
mthca. Here is a patch to avoid kernel crash and report a correct WR
id in this case.
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_cq.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index 205854e9c662..87a8f1166a3b 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -540,8 +540,17 @@ static inline int mthca_poll_one(struct mthca_dev *dev, | |||
540 | entry->wr_id = srq->wrid[wqe_index]; | 540 | entry->wr_id = srq->wrid[wqe_index]; |
541 | mthca_free_srq_wqe(srq, wqe); | 541 | mthca_free_srq_wqe(srq, wqe); |
542 | } else { | 542 | } else { |
543 | s32 wqe; | ||
543 | wq = &(*cur_qp)->rq; | 544 | wq = &(*cur_qp)->rq; |
544 | wqe_index = be32_to_cpu(cqe->wqe) >> wq->wqe_shift; | 545 | wqe = be32_to_cpu(cqe->wqe); |
546 | wqe_index = wqe >> wq->wqe_shift; | ||
547 | /* | ||
548 | * WQE addr == base - 1 might be reported in receive completion | ||
549 | * with error instead of (rq size - 1) by Sinai FW 1.0.800 and | ||
550 | * Arbel FW 5.1.400. This bug should be fixed in later FW revs. | ||
551 | */ | ||
552 | if (unlikely(wqe_index < 0)) | ||
553 | wqe_index = wq->max - 1; | ||
545 | entry->wr_id = (*cur_qp)->wrid[wqe_index]; | 554 | entry->wr_id = (*cur_qp)->wrid[wqe_index]; |
546 | } | 555 | } |
547 | 556 | ||