[openib-general] [PATCH] mthca: correct max_rd_atomic handling
Michael S. Tsirkin
mst at mellanox.co.il
Tue Dec 13 01:09:19 PST 2005
Fix corner cases in max_rd_atomic value handling in modify-qp.
sae/sre/swe bits should only be set when setting sra_max.
Further, in current code, if caller specifies max_rd_atomic = 0,
the sre and sae bits remain set, with the result that
max_rd_atomic = 1 in effect.
Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: latest/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- latest.orig/drivers/infiniband/hw/mthca/mthca_qp.c
+++ latest/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -714,10 +714,7 @@ int mthca_modify_qp(struct ib_qp *ibqp,
/* leave wqe_base as 0 (we always create an MR based at 0 for WQs) */
qp_context->wqe_lkey = cpu_to_be32(qp->mr.ibmr.lkey);
qp_context->params1 = cpu_to_be32((MTHCA_ACK_REQ_FREQ << 28) |
- (MTHCA_FLIGHT_LIMIT << 24) |
- MTHCA_QP_BIT_SRE |
- MTHCA_QP_BIT_SWE |
- MTHCA_QP_BIT_SAE);
+ (MTHCA_FLIGHT_LIMIT << 24));
if (qp->sq_policy == IB_SIGNAL_ALL_WR)
qp_context->params1 |= cpu_to_be32(MTHCA_QP_BIT_SSC);
if (attr_mask & IB_QP_RETRY_CNT) {
@@ -726,9 +723,14 @@ int mthca_modify_qp(struct ib_qp *ibqp,
}
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC) {
- if (attr->max_rd_atomic)
+ qp_context->params1 = cpu_to_be32(MTHCA_QP_BIT_SWE);
+ if (attr->max_rd_atomic) {
+ qp_context->params1 |=
+ cpu_to_be32(MTHCA_QP_BIT_SRE |
+ MTHCA_QP_BIT_SAE);
qp_context->params1 |=
cpu_to_be32(fls(attr->max_rd_atomic - 1) << 21);
+ }
qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_SRA_MAX);
}
--
MST
More information about the general
mailing list