]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/rxe: Split qp state for requester and completer
authorBob Pearson <rpearsonhpe@gmail.com>
Wed, 20 Jul 2022 08:56:07 +0000 (04:56 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 2 Aug 2022 16:53:36 +0000 (13:53 -0300)
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/1658307368-1851-4-git-send-email-lizhijian@fujitsu.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_qp.c
drivers/infiniband/sw/rxe/rxe_req.c
drivers/infiniband/sw/rxe/rxe_verbs.h

index bc53cad077aa28f301ca3f162d907b53b708433b..fb0c008af78cc2db16808165d3548567405df035 100644 (file)
@@ -567,10 +567,10 @@ int rxe_completer(void *arg)
        if (!rxe_get(qp))
                return -EAGAIN;
 
-       if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
-           qp->req.state == QP_STATE_RESET) {
+       if (!qp->valid || qp->comp.state == QP_STATE_ERROR ||
+           qp->comp.state == QP_STATE_RESET) {
                rxe_drain_resp_pkts(qp, qp->valid &&
-                                   qp->req.state == QP_STATE_ERROR);
+                                   qp->comp.state == QP_STATE_ERROR);
                goto exit;
        }
 
index eef91b8cb4ed94fb9a7e52a90d15280044b13c8d..c6519b9b94fbab6b92204ff4af44bf219104c615 100644 (file)
@@ -228,6 +228,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
                                               QUEUE_TYPE_FROM_CLIENT);
 
        qp->req.state           = QP_STATE_RESET;
+       qp->comp.state          = QP_STATE_RESET;
        qp->req.opcode          = -1;
        qp->comp.opcode         = -1;
 
@@ -488,6 +489,7 @@ static void rxe_qp_reset(struct rxe_qp *qp)
 
        /* move qp to the reset state */
        qp->req.state = QP_STATE_RESET;
+       qp->comp.state = QP_STATE_RESET;
        qp->resp.state = QP_STATE_RESET;
 
        /* let state machines reset themselves drain work and packet queues
@@ -551,6 +553,7 @@ void rxe_qp_error(struct rxe_qp *qp)
 {
        qp->req.state = QP_STATE_ERROR;
        qp->resp.state = QP_STATE_ERROR;
+       qp->comp.state = QP_STATE_ERROR;
        qp->attr.qp_state = IB_QPS_ERR;
 
        /* 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,
                        pr_debug("qp#%d state -> INIT\n", qp_num(qp));
                        qp->req.state = QP_STATE_INIT;
                        qp->resp.state = QP_STATE_INIT;
+                       qp->comp.state = QP_STATE_INIT;
                        break;
 
                case IB_QPS_RTR:
@@ -698,6 +702,7 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
                case IB_QPS_RTS:
                        pr_debug("qp#%d state -> RTS\n", qp_num(qp));
                        qp->req.state = QP_STATE_READY;
+                       qp->comp.state = QP_STATE_READY;
                        break;
 
                case IB_QPS_SQD:
index f3bd071d3e7ed223bd5b8f21962c934425bc7031..f637712079705f85f7f4c3547c90b5284ce81cfe 100644 (file)
@@ -816,6 +816,7 @@ err:
        /* update wqe_index for each wqe completion */
        qp->req.wqe_index = queue_next_index(qp->sq.queue, qp->req.wqe_index);
        wqe->state = wqe_state_error;
+       qp->req.state = QP_STATE_ERROR;
        rxe_run_task(&qp->comp.task, 0);
 exit:
        ret = -EAGAIN;
index a24fbe984066eadecd37d4cf461e496d6f881cfc..96af3e054f4d4c47b870eb5586446867e8705c3b 100644 (file)
@@ -129,6 +129,7 @@ struct rxe_req_info {
 };
 
 struct rxe_comp_info {
+       enum rxe_qp_state       state;
        u32                     psn;
        int                     opcode;
        int                     timeout;