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

Commit dd753d87 authored by Andrew Boyer's avatar Andrew Boyer Committed by Doug Ledford
Browse files

IB/rxe: Advance the consumer pointer before posting the CQE



A simple userspace application might poll the CQ, find a completion,
and then attempt to post a new WQE to the SQ. A spurious error can
occur if the userspace application detects a full SQ in the instant
before the kernel is able to advance the SQ consumer pointer.

This is noticeable when using single-entry SQs with ibv_rc_pingpong
if lots of kernel and userspace library debugging is enabled.

Signed-off-by: default avatarAndrew Boyer <andrew.boyer@dell.com>
Reviewed-by: default avatarYonatan Cohen <yonatanc@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 6e9bb530
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -420,10 +420,11 @@ static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
	    (wqe->wr.send_flags & IB_SEND_SIGNALED) ||
	    (qp->req.state == QP_STATE_ERROR)) {
		make_send_cqe(qp, wqe, &cqe);
		advance_consumer(qp->sq.queue);
		rxe_cq_post(qp->scq, &cqe, 0);
	}

	} else {
		advance_consumer(qp->sq.queue);
	}

	/*
	 * we completed something so let req run again