aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-03-24 18:47:30 -0500
committerRoland Dreier <rolandd@cisco.com>2006-03-24 18:47:30 -0500
commit192daa18dd7bfcaeb092a2ef928135745f2e6883 (patch)
treef6bff7aac7acd0ec5935fa0ada2889d77f58d6f4 /drivers
parent4e37b956161c3a3b160972c11c55f07b38b9830c (diff)
IB/mthca: Fix modify QP error path
If the call to mthca_MODIFY_QP() failed, then mthca_modify_qp() would still do some things it shouldn't, such as store away attributes for special QPs. Fix this, and simplify the code, by simply jumping to the exit path if mthca_MODIFY_QP() fails. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index a09873d2ef5e..1bc2678c2fae 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -777,21 +777,20 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
777 777
778 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0, 778 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0,
779 mailbox, sqd_event, &status); 779 mailbox, sqd_event, &status);
780 if (err)
781 goto out;
780 if (status) { 782 if (status) {
781 mthca_warn(dev, "modify QP %d->%d returned status %02x.\n", 783 mthca_warn(dev, "modify QP %d->%d returned status %02x.\n",
782 cur_state, new_state, status); 784 cur_state, new_state, status);
783 err = -EINVAL; 785 err = -EINVAL;
786 goto out;
784 } 787 }
785 788
786 if (!err) { 789 qp->state = new_state;
787 qp->state = new_state; 790 if (attr_mask & IB_QP_ACCESS_FLAGS)
788 if (attr_mask & IB_QP_ACCESS_FLAGS) 791 qp->atomic_rd_en = attr->qp_access_flags;
789 qp->atomic_rd_en = attr->qp_access_flags; 792 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
790 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) 793 qp->resp_depth = attr->max_dest_rd_atomic;
791 qp->resp_depth = attr->max_dest_rd_atomic;
792 }
793
794 mthca_free_mailbox(dev, mailbox);
795 794
796 if (is_sqp(dev, qp)) 795 if (is_sqp(dev, qp))
797 store_attrs(to_msqp(qp), attr, attr_mask); 796 store_attrs(to_msqp(qp), attr, attr_mask);
@@ -816,7 +815,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
816 * If we moved a kernel QP to RESET, clean up all old CQ 815 * If we moved a kernel QP to RESET, clean up all old CQ
817 * entries and reinitialize the QP. 816 * entries and reinitialize the QP.
818 */ 817 */
819 if (!err && new_state == IB_QPS_RESET && !qp->ibqp.uobject) { 818 if (new_state == IB_QPS_RESET && !qp->ibqp.uobject) {
820 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn, 819 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn,
821 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 820 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
822 if (qp->ibqp.send_cq != qp->ibqp.recv_cq) 821 if (qp->ibqp.send_cq != qp->ibqp.recv_cq)
@@ -835,6 +834,8 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
835 } 834 }
836 } 835 }
837 836
837out:
838 mthca_free_mailbox(dev, mailbox);
838 return err; 839 return err;
839} 840}
840 841