]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
RDMA/hns: Fix QP state judgement before sending work requests
authorYixian Liu <liuyixian@huawei.com>
Wed, 3 Jan 2018 02:44:07 +0000 (10:44 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 16 Mar 2018 15:46:45 +0000 (10:46 -0500)
BugLink: http://bugs.launchpad.net/bugs/1756097
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>
(cherry picked from commit 10bd2ade4b5fe0e8d0f3a4c4b20f008c4cb06bd2)
Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index 4c37f43d60a62ed372f9dc23470a2eb2a95c9221..2ca35e341d0912f54a4f90335948403038ea6405 100644 (file)
@@ -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;