[ofa-general] [PATCH] IB/cm: change cma_modify_qp_err() to handle QP in RESET state

Ralph Campbell ralph.campbell at qlogic.com
Fri Dec 5 17:25:32 PST 2008


Since the IBTA 1.2.1 spec. clarified that the RESET to ERROR QP state
transition is not valid but earlier the openfabrics code supported it,
the code in cma_modify_qp_err() will now return an error if the QP
is in the RESET state. This can cause RDS to go into a loop trying to
call rdma_disconnect() continuously.

Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
---

 drivers/infiniband/core/cma.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d951896..a1f9781 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -545,6 +545,7 @@ out:
 
 static int cma_modify_qp_err(struct rdma_id_private *id_priv)
 {
+	struct ib_qp_init_attr qp_init_attr;
 	struct ib_qp_attr qp_attr;
 	int ret;
 
@@ -554,8 +555,12 @@ static int cma_modify_qp_err(struct rdma_id_private *id_priv)
 		goto out;
 	}
 
-	qp_attr.qp_state = IB_QPS_ERR;
-	ret = ib_modify_qp(id_priv->id.qp, &qp_attr, IB_QP_STATE);
+	ret = ib_query_qp(id_priv->id.qp, &qp_attr, IB_QP_STATE, &qp_init_attr);
+	if (!ret && qp_attr.qp_state != IB_QPS_RESET &&
+	    qp_attr.qp_state != IB_QPS_ERR) {
+		qp_attr.qp_state = IB_QPS_ERR;
+		ret = ib_modify_qp(id_priv->id.qp, &qp_attr, IB_QP_STATE);
+	}
 out:
 	mutex_unlock(&id_priv->qp_mutex);
 	return ret;




More information about the general mailing list