diff options
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_cq.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_cq.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index 205854e9c662..3e27a084257e 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 | ||
@@ -813,6 +822,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, | |||
813 | spin_lock_init(&cq->lock); | 822 | spin_lock_init(&cq->lock); |
814 | cq->refcount = 1; | 823 | cq->refcount = 1; |
815 | init_waitqueue_head(&cq->wait); | 824 | init_waitqueue_head(&cq->wait); |
825 | mutex_init(&cq->mutex); | ||
816 | 826 | ||
817 | memset(cq_context, 0, sizeof *cq_context); | 827 | memset(cq_context, 0, sizeof *cq_context); |
818 | cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK | | 828 | cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK | |