[openib-general] [PATCH] mthca: return port number for unconnected QPs as well in query_qp

Jack Morgenstein jackm at mellanox.co.il
Mon Aug 28 09:10:34 PDT 2006


port_num was not being returned for unconnected QPs.

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: ofed_1_1/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- ofed_1_1.orig/drivers/infiniband/hw/mthca/mthca_qp.c	2006-08-23 10:33:04.000000000 +0300
+++ ofed_1_1/drivers/infiniband/hw/mthca/mthca_qp.c	2006-08-23 18:46:08.330885000 +0300
@@ -468,10 +474,14 @@ int mthca_query_qp(struct ib_qp *ibqp, s
 	if (qp->transport == RC || qp->transport == UC) {
 		to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path);
 		to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path);
+		qp_attr->alt_pkey_index =
+			be32_to_cpu(context->alt_path.port_pkey) & 0x7f;
+		qp_attr->alt_port_num 	= qp_attr->alt_ah_attr.port_num;
 	}
 
-	qp_attr->pkey_index     = be32_to_cpu(context->pri_path.port_pkey) & 0x7f;
-	qp_attr->alt_pkey_index = be32_to_cpu(context->alt_path.port_pkey) & 0x7f;
+	qp_attr->pkey_index = be32_to_cpu(context->pri_path.port_pkey) & 0x7f;
+	qp_attr->port_num   =
+		(be32_to_cpu(context->pri_path.port_pkey) >> 24) & 0x3;
 
 	/* qp_attr->en_sqd_async_notify is only applicable in modify qp */
 	qp_attr->sq_draining = mthca_state == MTHCA_QP_STATE_DRAINING;
@@ -482,11 +492,9 @@ int mthca_query_qp(struct ib_qp *ibqp, s
 		1 << ((be32_to_cpu(context->params2) >> 21) & 0x7);
 	qp_attr->min_rnr_timer 	    =
 		(be32_to_cpu(context->rnr_nextrecvpsn) >> 24) & 0x1f;
-	qp_attr->port_num 	    = qp_attr->ah_attr.port_num;
 	qp_attr->timeout 	    = context->pri_path.ackto >> 3;
 	qp_attr->retry_cnt 	    = (be32_to_cpu(context->params1) >> 16) & 0x7;
 	qp_attr->rnr_retry 	    = context->pri_path.rnr_retry >> 5;
-	qp_attr->alt_port_num 	    = qp_attr->alt_ah_attr.port_num;
 	qp_attr->alt_timeout 	    = context->alt_path.ackto >> 3;
 	qp_init_attr->cap 	    = qp_attr->cap;
 
 




More information about the general mailing list