Skip to content

Commit

Permalink
RDMA/hns: Fix QP state judgement before sending work requests
Browse files Browse the repository at this point in the history
The QP can accept send work requests only when the QP is
in the states that allow them to be submitted.

This patch updates the QP state judgement based on the
specification.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Shaobo Xu <xushaobo2@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Yixian Liu authored and Jason Gunthorpe committed Jan 3, 2018
1 parent 52e3b42 commit 10bd2ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/hw/hns/hns_roce_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
return -EOPNOTSUPP;
}

if (unlikely(qp->state != IB_QPS_RTS && qp->state != IB_QPS_SQD)) {
if (unlikely(qp->state == IB_QPS_RESET || qp->state == IB_QPS_INIT ||
qp->state == IB_QPS_RTR)) {
dev_err(dev, "Post WQE fail, QP state %d err!\n", qp->state);
*bad_wr = wr;
return -EINVAL;
Expand Down

0 comments on commit 10bd2ad

Please sign in to comment.