From 6de34bfb56ad8c24bf63b243b5f32b345d9cdd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20V=C4=83n=20Cao=20Nguy=C3=AAn?= Date: Wed, 30 Sep 2026 14:51:42 +0700 Subject: [PATCH] RDMA/irdma: Do not move a fresh RoCE QP to ERROR on RESET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit irdma_modify_qp_roce() handles IB_QPS_RESET like IB_QPS_ERR and moves the QP to ERROR. On a QP that was never moved to INIT, this makes the following RESET->INIT fail with -EINVAL, while ibv_query_qp() still reports RESET. RESET->RESET is a valid transition. The Mooncake transfer engine resets every new QP before INIT, so it cannot connect over an E810, while mlx5 accepts the same sequence: ibv_create_qp(RC) -> RESET ibv_modify_qp(RESET) -> 0 ibv_modify_qp(INIT, ...) -> -EINVAL Skip the hardware modify when the QP has not been moved to INIT yet (iwarp_state is IRDMA_QP_STATE_INVALID), as there is nothing to flush. RESET after INIT still goes to ERROR. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Assisted-by: LLM Signed-off-by: Nguyễn Văn Cao Nguyên Link: https://patch.msgid.link/20260930-irdma-reset-fresh-qp-v1-1-065327274e2b@greennode.ai Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/irdma/verbs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 22a8511fffea..71d7ae7baa47 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -1576,9 +1576,17 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, issue_modify_qp = 1; iwqp->suspend_pending = true; break; + case IB_QPS_RESET: + /* + * A QP that was never moved to INIT has nothing to + * flush, so skip the hardware modify. Moving it to + * ERROR would make the following INIT fail. + */ + if (iwqp->iwarp_state == IRDMA_QP_STATE_INVALID) + break; + fallthrough; case IB_QPS_SQE: case IB_QPS_ERR: - case IB_QPS_RESET: if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { iwqp->ibqp_state = attr->qp_state; spin_unlock_irqrestore(&iwqp->lock, flags);