On 8/2/21 3:30 AM, Leon Romanovsky wrote: > On Fri, Jul 30, 2021 at 10:21:58AM -0500, Bob Pearson wrote: >> Extended create_qp and create_qp_ex verbs to support XRC QP types. >> Extended WRs to support XRC operations. >> >> Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx> >> --- >> providers/rxe/rxe.c | 132 ++++++++++++++++++++++++++++++++------------ >> 1 file changed, 96 insertions(+), 36 deletions(-) > > <...> > >> +static void wr_set_xrc_srqn(struct ibv_qp_ex *ibqp, uint32_t remote_srqn) >> +{ >> + struct rxe_qp *qp = container_of(ibqp, struct rxe_qp, vqp.qp_ex); >> + struct rxe_send_wqe *wqe = addr_from_index(qp->sq.queue, >> + qp->cur_index - 1); >> + >> + if (qp->err) >> + return; > > Why is that? > >> + >> + wqe->wr.wr.xrc.srq_num = remote_srqn; >> +} >> + qp->err is used to detect overrun in the send WQ. Each of the 'builders' calls check_qp_queue_full() and sets qp->err if there isn't any more room in the send queue. Since the routines are of type void there is no way to tell the caller that something bad has happened. Once the builder fails the 'setters' have to fail as well because there is no place to write the WQE parameters. If this happens the user space caller will will see the operations succeed up to the point that it ran out of room and then stop. This is sort of a half solution to the problem. The alternative is to say that the user can never make this mistake and just keep building WQEs wrapping around the queue. Bob