Skip to content

Commit

Permalink
IB/mthca: don't change driver's copy of attributes if modify QP fails
Browse files Browse the repository at this point in the history
Only change the driver's copy of the QP attributes in modify QP after
checking the modify QP command completed successfully.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Dec 10, 2005
1 parent 6aa2e4e commit 44b5b03
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/infiniband/hw/mthca/mthca_qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,6 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE |
MTHCA_QP_OPTPAR_RRE |
MTHCA_QP_OPTPAR_RAE);

qp->atomic_rd_en = attr->qp_access_flags;
}

if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) {
Expand Down Expand Up @@ -801,8 +799,6 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
cpu_to_be32(fls(attr->max_dest_rd_atomic - 1) << 21);

qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRA_MAX);

qp->resp_depth = attr->max_dest_rd_atomic;
}

qp_context->params2 |= cpu_to_be32(MTHCA_QP_BIT_RSC);
Expand Down Expand Up @@ -844,8 +840,13 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
err = -EINVAL;
}

if (!err)
if (!err) {
qp->state = new_state;
if (attr_mask & IB_QP_ACCESS_FLAGS)
qp->atomic_rd_en = attr->qp_access_flags;
if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
qp->resp_depth = attr->max_dest_rd_atomic;
}

mthca_free_mailbox(dev, mailbox);

Expand Down

0 comments on commit 44b5b03

Please sign in to comment.