[openib-general] [PATCH] mthca: various bug fixes for mthca_query_qp
Jack Morgenstein
jackm at mellanox.co.il
Wed Aug 23 08:54:03 PDT 2006
Fixed various bugs in mthca_query_qp:
1. correct port_num was not being returned for unconnected QPs.
2. Incorrect number of bits was taken for static_rate field.
3. When default static rate is returned for Tavor, forgot to translate it
to an ib rate value.
4. Return sq signalling attribute in query-qp.
5. Return the send_cq, receive cq and srq handles. ib_query_qp() needs them
(required by IB Spec). ibv_query_qp() overwrites these values in user-space
with appropriate user-space values.
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
@@ -391,6 +391,12 @@ static int to_ib_qp_access_flags(int mth
return ib_flags;
}
+static enum ib_sig_type to_ib_qp_sq_signal(int params1)
+{
+ return (params1 & MTHCA_QP_BIT_SSC) ?
+ IB_SIGNAL_ALL_WR : IB_SIGNAL_REQ_WR;
+}
+
static void to_ib_ah_attr(struct mthca_dev *dev, struct ib_ah_attr *ib_ah_attr,
struct mthca_qp_path *path)
{
@@ -404,7 +410,7 @@ static void to_ib_ah_attr(struct mthca_d
ib_ah_attr->sl = be32_to_cpu(path->sl_tclass_flowlabel) >> 28;
ib_ah_attr->src_path_bits = path->g_mylmc & 0x7f;
ib_ah_attr->static_rate = mthca_rate_to_ib(dev,
- path->static_rate & 0x7,
+ path->static_rate & 0xf,
ib_ah_attr->port_num);
ib_ah_attr->ah_flags = (path->g_mylmc & (1 << 7)) ? IB_AH_GRH : 0;
if (ib_ah_attr->ah_flags) {
@@ -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,13 +492,16 @@ 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;
+ qp_init_attr->sq_sig_type =
+ to_ib_qp_sq_signal(be32_to_cpu(context->params1));
+ qp_init_attr->send_cq = ibqp->send_cq;
+ qp_init_attr->recv_cq = ibqp->recv_cq;
+ qp_init_attr->srq = ibqp->srq;
out:
mthca_free_mailbox(dev, mailbox);
Index: ofed_1_1/drivers/infiniband/hw/mthca/mthca_av.c
===================================================================
--- ofed_1_1.orig/drivers/infiniband/hw/mthca/mthca_av.c 2006-08-03 14:30:21.000000000 +0300
+++ ofed_1_1/drivers/infiniband/hw/mthca/mthca_av.c 2006-08-23 17:53:01.227220000 +0300
@@ -90,7 +90,7 @@ static enum ib_rate tavor_rate_to_ib(u8
case MTHCA_RATE_TAVOR_1X: return IB_RATE_2_5_GBPS;
case MTHCA_RATE_TAVOR_1X_DDR: return IB_RATE_5_GBPS;
case MTHCA_RATE_TAVOR_4X: return IB_RATE_10_GBPS;
- default: return port_rate;
+ default: return mult_to_ib_rate(port_rate);
}
}
More information about the general
mailing list