提交 5121df3a 编写于 作者: D Dotan Barak 提交者: Roland Dreier

IB/mthca: Update QP state if query QP succeeds

If the QP was moved to another state (such as SQE) by the hardware,
then after this change the user won't have to set the IBV_QP_CUR_STATE
mask in order to execute modify QP in order to recover from this state.
Signed-off-by: NDotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 9285faa1
...@@ -437,29 +437,34 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m ...@@ -437,29 +437,34 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m
int mthca_state; int mthca_state;
u8 status; u8 status;
mutex_lock(&qp->mutex);
if (qp->state == IB_QPS_RESET) { if (qp->state == IB_QPS_RESET) {
qp_attr->qp_state = IB_QPS_RESET; qp_attr->qp_state = IB_QPS_RESET;
goto done; goto done;
} }
mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
if (IS_ERR(mailbox)) if (IS_ERR(mailbox)) {
return PTR_ERR(mailbox); err = PTR_ERR(mailbox);
goto out;
}
err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox, &status); err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox, &status);
if (err) if (err)
goto out; goto out_mailbox;
if (status) { if (status) {
mthca_warn(dev, "QUERY_QP returned status %02x\n", status); mthca_warn(dev, "QUERY_QP returned status %02x\n", status);
err = -EINVAL; err = -EINVAL;
goto out; goto out_mailbox;
} }
qp_param = mailbox->buf; qp_param = mailbox->buf;
context = &qp_param->context; context = &qp_param->context;
mthca_state = be32_to_cpu(context->flags) >> 28; mthca_state = be32_to_cpu(context->flags) >> 28;
qp_attr->qp_state = to_ib_qp_state(mthca_state); qp->state = to_ib_qp_state(mthca_state);
qp_attr->qp_state = qp->state;
qp_attr->path_mtu = context->mtu_msgmax >> 5; qp_attr->path_mtu = context->mtu_msgmax >> 5;
qp_attr->path_mig_state = qp_attr->path_mig_state =
to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3); to_ib_mig_state((be32_to_cpu(context->flags) >> 11) & 0x3);
...@@ -506,8 +511,11 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m ...@@ -506,8 +511,11 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m
qp_init_attr->cap = qp_attr->cap; qp_init_attr->cap = qp_attr->cap;
out: out_mailbox:
mthca_free_mailbox(dev, mailbox); mthca_free_mailbox(dev, mailbox);
out:
mutex_unlock(&qp->mutex);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册