Skip to content

Commit 62494ec

Browse files
Bob Pearsonjgunthorpe
authored andcommitted
RDMA/rxe: Split qp state for requester and completer
Currently the requester can continue to process send wqes after an local qp operation error is detected because the setting of the qp state to the error state is deferred until later. This patch splits the qp state for the completer and requester into two separate states and sets qp->req.state = QP_STATE_ERROR as soon as the error is detected before another wqe can be executed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bob Pearson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent ae720bd commit 62494ec

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

drivers/infiniband/sw/rxe/rxe_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ int rxe_completer(void *arg)
567567
if (!rxe_get(qp))
568568
return -EAGAIN;
569569

570-
if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
571-
qp->req.state == QP_STATE_RESET) {
570+
if (!qp->valid || qp->comp.state == QP_STATE_ERROR ||
571+
qp->comp.state == QP_STATE_RESET) {
572572
rxe_drain_resp_pkts(qp, qp->valid &&
573-
qp->req.state == QP_STATE_ERROR);
573+
qp->comp.state == QP_STATE_ERROR);
574574
goto exit;
575575
}
576576

drivers/infiniband/sw/rxe/rxe_qp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
228228
QUEUE_TYPE_FROM_CLIENT);
229229

230230
qp->req.state = QP_STATE_RESET;
231+
qp->comp.state = QP_STATE_RESET;
231232
qp->req.opcode = -1;
232233
qp->comp.opcode = -1;
233234

@@ -488,6 +489,7 @@ static void rxe_qp_reset(struct rxe_qp *qp)
488489

489490
/* move qp to the reset state */
490491
qp->req.state = QP_STATE_RESET;
492+
qp->comp.state = QP_STATE_RESET;
491493
qp->resp.state = QP_STATE_RESET;
492494

493495
/* let state machines reset themselves drain work and packet queues
@@ -551,6 +553,7 @@ void rxe_qp_error(struct rxe_qp *qp)
551553
{
552554
qp->req.state = QP_STATE_ERROR;
553555
qp->resp.state = QP_STATE_ERROR;
556+
qp->comp.state = QP_STATE_ERROR;
554557
qp->attr.qp_state = IB_QPS_ERR;
555558

556559
/* drain work and packet queues */
@@ -688,6 +691,7 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
688691
pr_debug("qp#%d state -> INIT\n", qp_num(qp));
689692
qp->req.state = QP_STATE_INIT;
690693
qp->resp.state = QP_STATE_INIT;
694+
qp->comp.state = QP_STATE_INIT;
691695
break;
692696

693697
case IB_QPS_RTR:
@@ -698,6 +702,7 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
698702
case IB_QPS_RTS:
699703
pr_debug("qp#%d state -> RTS\n", qp_num(qp));
700704
qp->req.state = QP_STATE_READY;
705+
qp->comp.state = QP_STATE_READY;
701706
break;
702707

703708
case IB_QPS_SQD:

drivers/infiniband/sw/rxe/rxe_req.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ int rxe_requester(void *arg)
816816
/* update wqe_index for each wqe completion */
817817
qp->req.wqe_index = queue_next_index(qp->sq.queue, qp->req.wqe_index);
818818
wqe->state = wqe_state_error;
819+
qp->req.state = QP_STATE_ERROR;
819820
rxe_run_task(&qp->comp.task, 0);
820821
exit:
821822
ret = -EAGAIN;

drivers/infiniband/sw/rxe/rxe_verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct rxe_req_info {
129129
};
130130

131131
struct rxe_comp_info {
132+
enum rxe_qp_state state;
132133
u32 psn;
133134
int opcode;
134135
int timeout;

0 commit comments

Comments
 (0)