提交 89e5323c 编写于 作者: N Nelson Escobar 提交者: Doug Ledford

IB/usnic: Support more QP state transitions

They were already implemented at a lower layer, but the upper level
routine placed arbitrary restrictions on which transitions were
permitted.  Simplify the state machine logic to live wholly in
usnic_ib_qp_grp_modify.
Signed-off-by: NDave Goodell <dgoodell@cisco.com>
Reviewed-by: NReese Faucette <rfaucett@cisco.com>
Reviewed-by: NXuyang Wang <xuywang@cisco.com>
Signed-off-by: NNelson Escobar <neescoba@cisco.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 2547a366
......@@ -571,20 +571,20 @@ int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
qp_grp = to_uqp_grp(ibqp);
/* TODO: Future Support All States */
mutex_lock(&qp_grp->vf->pf->usdev_lock);
if ((attr_mask & IB_QP_STATE) && attr->qp_state == IB_QPS_INIT) {
status = usnic_ib_qp_grp_modify(qp_grp, IB_QPS_INIT, NULL);
} else if ((attr_mask & IB_QP_STATE) && attr->qp_state == IB_QPS_RTR) {
status = usnic_ib_qp_grp_modify(qp_grp, IB_QPS_RTR, NULL);
} else if ((attr_mask & IB_QP_STATE) && attr->qp_state == IB_QPS_RTS) {
status = usnic_ib_qp_grp_modify(qp_grp, IB_QPS_RTS, NULL);
if ((attr_mask & IB_QP_PORT) && attr->port_num != 1) {
/* usnic devices only have one port */
status = -EINVAL;
goto out_unlock;
}
if (attr_mask & IB_QP_STATE) {
status = usnic_ib_qp_grp_modify(qp_grp, attr->qp_state, NULL);
} else {
usnic_err("Unexpected combination mask: %u state: %u\n",
attr_mask & IB_QP_STATE, attr->qp_state);
usnic_err("Unhandled request, attr_mask=0x%x\n", attr_mask);
status = -EINVAL;
}
out_unlock:
mutex_unlock(&qp_grp->vf->pf->usdev_lock);
return status;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册