Message ID | 1521098594-13305-1-git-send-email-liuyixian@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
On Thu, Mar 15, 2018 at 03:23:14PM +0800, Yixian Liu wrote: > This patch changes the type of cqn from u32 to u64 to keep > userspace and kernel consistent, initializes resp both for > cq and qp to zeros, and also changes the condition judgment > of outlen considering future caps extension according to > Jason's suggestions. > > Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) > Fixes: 9b44703d0a21 (hns: Support cq record doorbell for the user space) > > Signed-off-by: Yixian Liu <liuyixian@huawei.com> > Signed-off-by: Lijun Ou <oulijun@huawei.com> > Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> > Signed-off-by: Shaobo Xu <xushaobo2@huawei.com> > drivers/infiniband/hw/hns/hns_roce_cq.c | 15 +++++++-------- > drivers/infiniband/hw/hns/hns_roce_qp.c | 8 ++++---- > include/uapi/rdma/hns-abi.h | 3 +-- > 3 files changed, 12 insertions(+), 14 deletions(-) Looks good, thanks Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 15, 2018 at 03:23:14PM +0800, Yixian Liu wrote: > This patch changes the type of cqn from u32 to u64 to keep > userspace and kernel consistent, initializes resp both for > cq and qp to zeros, and also changes the condition judgment > of outlen considering future caps extension according to > Jason's suggestions. > > Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) > Fixes: 9b44703d0a21 (hns: Support cq record doorbell for the user space) > > Signed-off-by: Yixian Liu <liuyixian@huawei.com> > Signed-off-by: Lijun Ou <oulijun@huawei.com> > Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> > Signed-off-by: Shaobo Xu <xushaobo2@huawei.com> > drivers/infiniband/hw/hns/hns_roce_cq.c | 15 +++++++-------- > drivers/infiniband/hw/hns/hns_roce_qp.c | 8 ++++---- > include/uapi/rdma/hns-abi.h | 3 +-- > 3 files changed, 12 insertions(+), 14 deletions(-) Applied to rdma for-next! I really appreciate the quick fix on this! Thanks, Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2018/3/16 6:25, Jason Gunthorpe wrote: > On Thu, Mar 15, 2018 at 03:23:14PM +0800, Yixian Liu wrote: >> This patch changes the type of cqn from u32 to u64 to keep >> userspace and kernel consistent, initializes resp both for >> cq and qp to zeros, and also changes the condition judgment >> of outlen considering future caps extension according to >> Jason's suggestions. >> >> Fixes: e088a685eae9 (hns: Support rq record doorbell for the user space) >> Fixes: 9b44703d0a21 (hns: Support cq record doorbell for the user space) >> >> Signed-off-by: Yixian Liu <liuyixian@huawei.com> >> Signed-off-by: Lijun Ou <oulijun@huawei.com> >> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> >> Signed-off-by: Shaobo Xu <xushaobo2@huawei.com> >> drivers/infiniband/hw/hns/hns_roce_cq.c | 15 +++++++-------- >> drivers/infiniband/hw/hns/hns_roce_qp.c | 8 ++++---- >> include/uapi/rdma/hns-abi.h | 3 +-- >> 3 files changed, 12 insertions(+), 14 deletions(-) > > Applied to rdma for-next! > > I really appreciate the quick fix on this! > > Thanks, > Jason Thanks, Jason! I also appreciate the review work on this patch set from you, Doug and Leon! -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c index 462b644..095a910 100644 --- a/drivers/infiniband/hw/hns/hns_roce_cq.c +++ b/drivers/infiniband/hw/hns/hns_roce_cq.c @@ -315,7 +315,7 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); struct device *dev = hr_dev->dev; struct hns_roce_ib_create_cq ucmd; - struct hns_roce_ib_create_cq_resp resp; + struct hns_roce_ib_create_cq_resp resp = {}; struct hns_roce_cq *hr_cq = NULL; struct hns_roce_uar *uar = NULL; int vector = attr->comp_vector; @@ -389,7 +389,7 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, } if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && - (udata->outlen == sizeof(resp))) { + (udata->outlen >= sizeof(resp))) { ret = hns_roce_db_map_user(to_hr_ucontext(context), ucmd.db_addr, &hr_cq->db); if (ret) { @@ -413,15 +413,14 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, hr_cq->cq_depth = cq_entries; if (context) { + resp.cqn = hr_cq->cqn; if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && - (udata->outlen == sizeof(resp))) { + (udata->outlen >= sizeof(resp))) { hr_cq->db_en = 1; - resp.cqn = hr_cq->cqn; resp.cap_flags |= HNS_ROCE_SUPPORT_CQ_RECORD_DB; - ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); - } else - ret = ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64)); + } + ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); if (ret) goto err_dbmap; } @@ -430,7 +429,7 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, err_dbmap: if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && - (udata->outlen == sizeof(resp))) + (udata->outlen >= sizeof(resp))) hns_roce_db_unmap_user(to_hr_ucontext(context), &hr_cq->db); diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index f0ad455..e289a92 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -506,7 +506,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, { struct device *dev = hr_dev->dev; struct hns_roce_ib_create_qp ucmd; - struct hns_roce_ib_create_qp_resp resp; + struct hns_roce_ib_create_qp_resp resp = {}; unsigned long qpn = 0; int ret = 0; u32 page_shift; @@ -614,7 +614,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, } if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && - (udata->outlen == sizeof(resp)) && + (udata->outlen >= sizeof(resp)) && hns_roce_qp_has_rq(init_attr)) { ret = hns_roce_db_map_user( to_hr_ucontext(ib_pd->uobject->context), @@ -730,7 +730,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, else hr_qp->doorbell_qpn = cpu_to_le64(hr_qp->qpn); - if (ib_pd->uobject && (udata->outlen == sizeof(resp)) && + if (ib_pd->uobject && (udata->outlen >= sizeof(resp)) && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB)) { /* indicate kernel supports record db */ @@ -759,7 +759,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, err_wrid: if (ib_pd->uobject) { if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && - (udata->outlen == sizeof(resp)) && + (udata->outlen >= sizeof(resp)) && hns_roce_qp_has_rq(init_attr)) hns_roce_db_unmap_user( to_hr_ucontext(ib_pd->uobject->context), diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h index 38e8f19..f7af7e5 100644 --- a/include/uapi/rdma/hns-abi.h +++ b/include/uapi/rdma/hns-abi.h @@ -42,8 +42,7 @@ struct hns_roce_ib_create_cq { }; struct hns_roce_ib_create_cq_resp { - __u32 cqn; - __u32 reserved; + __u64 cqn; /* Only 32 bits used, 64 for compat */ __u64 cap_flags; };