From 4a3ca401024dbc920bf75893d65731c2b45930c1 Mon Sep 17 00:00:00 2001 From: leonidk Date: Thu, 1 Jun 2006 09:40:28 +0000 Subject: [PATCH] [MTHCA] 1. support *bad_wr as an optional parameter; 2. (bugfix) set static rate always to 0 (i.e. full speed). The latter one enters a limitation of the same rate of all the inter-operating HCAs. The right setting of the static rate is more complicate and will be eventually added. git-svn-id: svn://openib.tc.cornell.edu/gen1@369 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/hw/mthca/kernel/mthca_qp.c | 39 +++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/trunk/hw/mthca/kernel/mthca_qp.c b/trunk/hw/mthca/kernel/mthca_qp.c index 30d34a12..1fd54f79 100644 --- a/trunk/hw/mthca/kernel/mthca_qp.c +++ b/trunk/hw/mthca/kernel/mthca_qp.c @@ -678,7 +678,8 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) if (attr_mask & IB_QP_AV) { qp_context->pri_path.g_mylmc = attr->ah_attr.src_path_bits & 0x7f; qp_context->pri_path.rlid = cl_hton16(attr->ah_attr.dlid); - qp_context->pri_path.static_rate = (u8)!!attr->ah_attr.static_rate; + //TODO: work around: set always full speed - really, it's much more complicate + qp_context->pri_path.static_rate = 0; if (attr->ah_attr.ah_flags & IB_AH_GRH) { qp_context->pri_path.g_mylmc |= 1 << 7; qp_context->pri_path.mgid_index = attr->ah_attr.grh.sgid_index; @@ -1522,7 +1523,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, qp->sq.head, qp->sq.tail, qp->sq.max, nreq)); err = -ENOMEM; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1631,7 +1633,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, (void*)(wqe - sizeof (struct mthca_next_seg)), (void*)wqe); if (err) { - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } wqe += sizeof (struct mthca_data_seg); @@ -1642,7 +1645,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, if ((int)(int)wr->num_ds > qp->sq.max_gs) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("SQ %06x too many gathers\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1673,7 +1677,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, if (opcode == MTHCA_OPCODE_INVALID) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("SQ %06x opcode invalid\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1763,7 +1768,8 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr, qp->rq.head, qp->rq.tail, qp->rq.max, nreq)); err = -ENOMEM; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1782,7 +1788,8 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr, if (unlikely((int)wr->num_ds > qp->rq.max_gs)) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("RQ %06x too many gathers\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1891,7 +1898,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, qp->sq.head, qp->sq.tail, qp->sq.max, nreq)); err = -ENOMEM; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -1996,7 +2004,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, (void*)(wqe - sizeof (struct mthca_next_seg)), (void*)wqe); if (err) { - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } wqe += sizeof (struct mthca_data_seg); @@ -2007,7 +2016,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, if ((int)wr->num_ds > qp->sq.max_gs) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("SQ %06x full too many gathers\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -2036,7 +2046,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr, if (opcode == MTHCA_OPCODE_INVALID) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("SQ %06x opcode invalid\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -2111,7 +2122,8 @@ int mthca_arbel_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr, qp->rq.head, qp->rq.tail, qp->rq.max, nreq)); err = -ENOMEM; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } @@ -2124,7 +2136,8 @@ int mthca_arbel_post_receive(struct ib_qp *ibqp, struct _ib_recv_wr *wr, if (unlikely((int)wr->num_ds > qp->rq.max_gs)) { HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_QP ,("RQ %06x full too many scatter\n",qp->qpn)); err = -EINVAL; - *bad_wr = wr; + if (bad_wr) + *bad_wr = wr; goto out; } -- 2.41.0