RDMA/hns: Fix QP's resp incomplete assignment
authorWenpeng Liang <liangwenpeng@huawei.com>
Thu, 26 Aug 2021 13:37:31 +0000 (21:37 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 26 Aug 2021 15:12:20 +0000 (12:12 -0300)
The resp passed to the user space represents the enable flag of qp,
incomplete assignment will cause some features of the user space to be
disabled.

Fixes: 90ae0b57e4a5 ("RDMA/hns: Combine enable flags of qp")
Fixes: aba457ca890c ("RDMA/hns: Support owner mode doorbell")
Link: https://lore.kernel.org/r/1629985056-57004-3-git-send-email-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_qp.c

index 0d0d5aa..bddc952 100644 (file)
@@ -848,7 +848,6 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
                                goto err_out;
                        }
                        hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
-                       resp->cap_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
                }
 
                if (user_qp_has_rdb(hr_dev, init_attr, udata, resp)) {
@@ -861,7 +860,6 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
                                goto err_sdb;
                        }
                        hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
-                       resp->cap_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
                }
        } else {
                if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
@@ -1071,6 +1069,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
        }
 
        if (udata) {
+               resp.cap_flags = hr_qp->en_flags;
                ret = ib_copy_to_udata(udata, &resp,
                                       min(udata->outlen, sizeof(resp)));
                if (ret) {