Skip to content

Commit fdd0fe9

Browse files
BernardMetzlerjgunthorpe
authored andcommitted
RDMA/siw: Always report immediate post SQ errors
In siw_post_send(), any immediate error encountered during processing of the work request list must be reported to the caller, even if previous work requests in that list were just accepted and added to the send queue. Not reporting those errors confuses the caller, which would wait indefinitely for the failing and potentially subsequently aborted work requests completion. This fixes a case where immediate errors were overwritten by subsequent code in siw_post_send(). Fixes: 303ae1c ("rdma/siw: application interface") Link: https://patch.msgid.link/r/[email protected] Suggested-by: Stefan Metzmacher <[email protected]> Signed-off-by: Bernard Metzler <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent fb0b082 commit fdd0fe9

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/infiniband/sw/siw/siw_verbs.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
769769
struct siw_wqe *wqe = tx_wqe(qp);
770770

771771
unsigned long flags;
772-
int rv = 0;
772+
int rv = 0, imm_err = 0;
773773

774774
if (wr && !rdma_is_kernel_res(&qp->base_qp.res)) {
775775
siw_dbg_qp(qp, "wr must be empty for user mapped sq\n");
@@ -955,9 +955,17 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
955955
* Send directly if SQ processing is not in progress.
956956
* Eventual immediate errors (rv < 0) do not affect the involved
957957
* RI resources (Verbs, 8.3.1) and thus do not prevent from SQ
958-
* processing, if new work is already pending. But rv must be passed
959-
* to caller.
958+
* processing, if new work is already pending. But rv and pointer
959+
* to failed work request must be passed to caller.
960960
*/
961+
if (unlikely(rv < 0)) {
962+
/*
963+
* Immediate error
964+
*/
965+
siw_dbg_qp(qp, "Immediate error %d\n", rv);
966+
imm_err = rv;
967+
*bad_wr = wr;
968+
}
961969
if (wqe->wr_status != SIW_WR_IDLE) {
962970
spin_unlock_irqrestore(&qp->sq_lock, flags);
963971
goto skip_direct_sending;
@@ -982,15 +990,10 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
982990

983991
up_read(&qp->state_lock);
984992

985-
if (rv >= 0)
986-
return 0;
987-
/*
988-
* Immediate error
989-
*/
990-
siw_dbg_qp(qp, "error %d\n", rv);
993+
if (unlikely(imm_err))
994+
return imm_err;
991995

992-
*bad_wr = wr;
993-
return rv;
996+
return (rv >= 0) ? 0 : rv;
994997
}
995998

996999
/*

0 commit comments

Comments
 (0)