Skip to contentSkip to conversation

RDMA/cma: Remove unnecessary INIT->INIT transition

PATCH In review Håkon Bugge 2 participants 4 messages Jun 18, 2021 – Jun 23, 2021 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RDMA/cma: Remove unnecessary INIT->INIT transition

In rdma_create_qp(), a connected QP will be transitioned to the INIT state.

Afterwards, the QP will be transitioned to the RTR state by the cma_modify_qp_rtr() function. But this function starts by performing an ib_modify_qp() to the INIT state again, before another ib_modify_qp() is performed to transition the QP to the RTR state.

Hence, there is no need to transition the QP to the INIT state in rdma_create_qp().

---

v1 -> v2:
* Fixed uninitialized ret variable as:

---
 drivers/infiniband/core/cma.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/infiniband/core/cma.c +1 -16
index 2b9ffc2..20c155c 100644
@@ -925,25 +925,12 @@ static int cma_init_ud_qp(struct rdma_id_private *id_priv, struct ib_qp *qp)
 	return ret;
 }
 
-static int cma_init_conn_qp(struct rdma_id_private *id_priv, struct ib_qp *qp)
-{
-	struct ib_qp_attr qp_attr;
-	int qp_attr_mask, ret;
-
-	qp_attr.qp_state = IB_QPS_INIT;
-	ret = rdma_init_qp_attr(&id_priv->id, &qp_attr, &qp_attr_mask);
-	if (ret)
-		return ret;
-
-	return ib_modify_qp(qp, &qp_attr, qp_attr_mask);
-}
-
 int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
 		   struct ib_qp_init_attr *qp_init_attr)
 {
 	struct rdma_id_private *id_priv;
 	struct ib_qp *qp;
-	int ret;
+	int ret = 0;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
 	if (id->device != pd->device) {
@@ -960,8 +947,6 @@ int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
 
 	if (id->qp_type == IB_QPT_UD)
 		ret = cma_init_ud_qp(id_priv, qp);
-	else
-		ret = cma_init_conn_qp(id_priv, qp);
 	if (ret)
 		goto out_destroy;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 13 lines · Håkon Bugge

In rdma_create_qp(), a connected QP will be transitioned to the INIT state.

Afterwards, the QP will be transitioned to the RTR state by the cma_modify_qp_rtr() function. But this function starts by performing an ib_modify_qp() to the INIT state again, before another ib_modify_qp() is performed to transition the QP to the RTR state.

Hence, there is no need to transition the QP to the INIT state in rdma_create_qp().

Quoted 9 lines

---

v1 -> v2:
* Fixed uninitialized ret variable as:

---
 drivers/infiniband/core/cma.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

I reviewed v1, let's add this tag to v2 too.

#2 lore raw
Quoted 24 lines · Leon Romanovsky
Quoted 13 lines · Håkon Bugge

In rdma_create_qp(), a connected QP will be transitioned to the INIT state.

Afterwards, the QP will be transitioned to the RTR state by the cma_modify_qp_rtr() function. But this function starts by performing an ib_modify_qp() to the INIT state again, before another ib_modify_qp() is performed to transition the QP to the RTR state.

Hence, there is no need to transition the QP to the INIT state in rdma_create_qp().

Quoted 9 lines

---

v1 -> v2:
* Fixed uninitialized ret variable as:

---
 drivers/infiniband/core/cma.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
Quoted 3 lines

I reviewed v1, let's add this tag to v2 too.

Ahh, you sent this patch as part of other series with same version :(.

Thanks

#3 lore raw
Quoted 29 lines · Leon Romanovsky
Quoted 24 lines · Leon Romanovsky
Quoted 22 lines · Håkon Bugge

In rdma_create_qp(), a connected QP will be transitioned to the INIT state.

Afterwards, the QP will be transitioned to the RTR state by the cma_modify_qp_rtr() function. But this function starts by performing an ib_modify_qp() to the INIT state again, before another ib_modify_qp() is performed to transition the QP to the RTR state.

Hence, there is no need to transition the QP to the INIT state in rdma_create_qp().

---

v1 -> v2:
* Fixed uninitialized ret variable as:

---
drivers/infiniband/core/cma.c | 17 +----------------

1 file changed, 1 insertion(+), 16 deletions(-)
Quoted 5 lines
Quoted 3 lines

I reviewed v1, let's add this tag to v2 too.

Ahh, you sent this patch as part of other series with same version :(.

Oops, yes. Sorry for the confusion ;-)

Håkon

Quoted 2 lines

Thanks