Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e56ea79 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Roland Dreier
Browse files

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: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 13aa6ecb
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -540,8 +540,17 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
		entry->wr_id = srq->wrid[wqe_index];
		entry->wr_id = srq->wrid[wqe_index];
		mthca_free_srq_wqe(srq, wqe);
		mthca_free_srq_wqe(srq, wqe);
	} else {
	} else {
		s32 wqe;
		wq = &(*cur_qp)->rq;
		wq = &(*cur_qp)->rq;
		wqe_index = be32_to_cpu(cqe->wqe) >> wq->wqe_shift;
		wqe = be32_to_cpu(cqe->wqe);
		wqe_index = wqe >> wq->wqe_shift;
               /*
		* WQE addr == base - 1 might be reported in receive completion
		* with error instead of (rq size - 1) by Sinai FW 1.0.800 and
		* Arbel FW 5.1.400.  This bug should be fixed in later FW revs.
		*/
		if (unlikely(wqe_index < 0))
			wqe_index = wq->max - 1;
		entry->wr_id = (*cur_qp)->wrid[wqe_index];
		entry->wr_id = (*cur_qp)->wrid[wqe_index];
	}
	}