[openib-general] [PATCH] mthca - query qp

Eli Cohen eli at mellanox.co.il
Wed Mar 8 06:31:51 PST 2006


1. Fix error flow - if status is not zero exit with error
2. Few more values extracted

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

Index: last_stable/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- last_stable.orig/drivers/infiniband/hw/mthca/mthca_qp.c
+++ last_stable/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -427,6 +427,12 @@ int mthca_query_qp(struct ib_qp *ibqp, s
 	if (err)
 		goto out;
 
+	if (status) {
+		mthca_warn(dev, "QUERY_QP returned status %02x\n", status);
+		err = -EINVAL;
+		goto out;
+	}
+
 	qp_param    = mailbox->buf;
 	context     = &qp_param->context;
 	mthca_state = be32_to_cpu(context->flags) >> 28;
@@ -454,6 +460,9 @@ int mthca_query_qp(struct ib_qp *ibqp, s
 	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->timeout     = context->pri_path.ackto >> 3;
+	qp_attr->alt_timeout = context->alt_path.ackto >> 3;
+
 	/* qp_attr->en_sqd_async_notify is only applicable in modify qp */
 	qp_attr->sq_draining = mthca_state == MTHCA_QP_STATE_DRAINING;
 
@@ -469,7 +478,17 @@ int mthca_query_qp(struct ib_qp *ibqp, s
 	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->event_handler = ibqp->event_handler;
+	qp_init_attr->qp_context    = ibqp->qp_context;
+	qp_init_attr->send_cq       = ibqp->send_cq;
+	qp_init_attr->recv_cq       = ibqp->recv_cq;
+	qp_init_attr->srq           = ibqp->srq;
 	qp_init_attr->cap 	    = qp_attr->cap;
+	qp_init_attr->sq_sig_type   = ((be32_to_cpu(context->params1) >> 3) & 0x1) ?
+		IB_SIGNAL_REQ_WR : IB_SIGNAL_ALL_WR;
+	qp_init_attr->qp_type       = ibqp->qp_type;
+	qp_init_attr->port_num      = qp_attr->ah_attr.port_num;
 
 out:
 	mthca_free_mailbox(dev, mailbox);




More information about the general mailing list