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

Commit 27ca34f5 authored by Steve Wise's avatar Steve Wise Committed by Roland Dreier
Browse files

RDMA/cxgb4: Fix accounting for unsignaled SQ WRs to deal with wrap



When determining how many WRs are completed with a signaled CQE,
correctly deal with queue wraps.

Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarVipul Pandya <vipul@chelsio.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 1cf24dce
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -611,8 +611,11 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,
		* to the first unsignaled one, and idx points to the
		* signaled one.  So adjust in_use based on this delta.
		* if this is not completing any unsigned wrs, then the
		* delta will be 0.
		* delta will be 0. Handle wrapping also!
		*/
		if (idx < wq->sq.cidx)
			wq->sq.in_use -= wq->sq.size + idx - wq->sq.cidx;
		else
			wq->sq.in_use -= idx - wq->sq.cidx;
		BUG_ON(wq->sq.in_use < 0 && wq->sq.in_use < wq->sq.size);