Skip to content

Commit a588429

Browse files
rpearsonhpe-designjgunthorpe
authored andcommitted
RDMA/rxe: Remove qp->resp.state
The rxe driver has four different QP state variables, qp->attr.qp_state, qp->req.state, qp->comp.state, and qp->resp.state. All of these basically carry the same information. This patch replaces uses of qp->resp.state by qp->attr.qp_state. This is the first of three patches which will remove all but the qp->attr.qp_state variable. This will bring the driver closer to the IBA description. Link: https://lore.kernel.org/r/20230405042611.6467-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent bd4ba60 commit a588429

6 files changed

Lines changed: 8 additions & 14 deletions

File tree

drivers/infiniband/sw/rxe/rxe_net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
414414
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
415415

416416
if ((is_request && (qp->req.state != QP_STATE_READY)) ||
417-
(!is_request && (qp->resp.state != QP_STATE_READY))) {
417+
(!is_request && (qp_state(qp) <= IB_QPS_RTR))) {
418418
rxe_dbg_qp(qp, "Packet dropped. QP is not in ready state\n");
419419
goto drop;
420420
}

drivers/infiniband/sw/rxe/rxe_qp.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
287287

288288
qp->resp.opcode = OPCODE_NONE;
289289
qp->resp.msn = 0;
290-
qp->resp.state = QP_STATE_RESET;
291290

292291
return 0;
293292
}
@@ -479,7 +478,6 @@ static void rxe_qp_reset(struct rxe_qp *qp)
479478
/* move qp to the reset state */
480479
qp->req.state = QP_STATE_RESET;
481480
qp->comp.state = QP_STATE_RESET;
482-
qp->resp.state = QP_STATE_RESET;
483481

484482
/* drain work and packet queuesc */
485483
rxe_requester(qp);
@@ -532,7 +530,6 @@ static void rxe_qp_drain(struct rxe_qp *qp)
532530
void rxe_qp_error(struct rxe_qp *qp)
533531
{
534532
qp->req.state = QP_STATE_ERROR;
535-
qp->resp.state = QP_STATE_ERROR;
536533
qp->comp.state = QP_STATE_ERROR;
537534
qp->attr.qp_state = IB_QPS_ERR;
538535

@@ -663,13 +660,11 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
663660
case IB_QPS_INIT:
664661
rxe_dbg_qp(qp, "state -> INIT\n");
665662
qp->req.state = QP_STATE_INIT;
666-
qp->resp.state = QP_STATE_INIT;
667663
qp->comp.state = QP_STATE_INIT;
668664
break;
669665

670666
case IB_QPS_RTR:
671667
rxe_dbg_qp(qp, "state -> RTR\n");
672-
qp->resp.state = QP_STATE_READY;
673668
break;
674669

675670
case IB_QPS_RTS:

drivers/infiniband/sw/rxe/rxe_recv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
3939
}
4040

4141
if (pkt->mask & RXE_REQ_MASK) {
42-
if (unlikely(qp->resp.state != QP_STATE_READY))
42+
if (unlikely(qp_state(qp) <= IB_QPS_RTR))
4343
return -EINVAL;
4444
} else if (unlikely(qp->req.state < QP_STATE_READY ||
4545
qp->req.state > QP_STATE_DRAINED))

drivers/infiniband/sw/rxe/rxe_resp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ static enum resp_states do_complete(struct rxe_qp *qp,
11371137
return RESPST_ERR_CQ_OVERFLOW;
11381138

11391139
finish:
1140-
if (unlikely(qp->resp.state == QP_STATE_ERROR))
1140+
if (unlikely(qp_state(qp) == IB_QPS_ERR))
11411141
return RESPST_CHK_RESOURCE;
11421142
if (unlikely(!pkt))
11431143
return RESPST_DONE;
@@ -1464,10 +1464,10 @@ int rxe_responder(struct rxe_qp *qp)
14641464
struct rxe_pkt_info *pkt = NULL;
14651465
int ret;
14661466

1467-
if (!qp->valid || qp->resp.state == QP_STATE_ERROR ||
1468-
qp->resp.state == QP_STATE_RESET) {
1469-
bool notify = qp->valid &&
1470-
(qp->resp.state == QP_STATE_ERROR);
1467+
if (!qp->valid || qp_state(qp) == IB_QPS_ERR ||
1468+
qp_state(qp) == IB_QPS_RESET) {
1469+
bool notify = qp->valid && (qp_state(qp) == IB_QPS_ERR);
1470+
14711471
drain_req_pkts(qp);
14721472
flush_recv_queue(qp, notify);
14731473
goto exit;

drivers/infiniband/sw/rxe/rxe_verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
10121012

10131013
spin_unlock_irqrestore(&rq->producer_lock, flags);
10141014

1015-
if (qp->resp.state == QP_STATE_ERROR)
1015+
if (qp_state(qp) == IB_QPS_ERR)
10161016
rxe_sched_task(&qp->resp.task);
10171017

10181018
err_out:

drivers/infiniband/sw/rxe/rxe_verbs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ struct resp_res {
173173
};
174174

175175
struct rxe_resp_info {
176-
enum rxe_qp_state state;
177176
u32 msn;
178177
u32 psn;
179178
u32 ack_psn;

0 commit comments

Comments
 (0)