Commit 9d9d4ff7 authored by Lijun Ou's avatar Lijun Ou Committed by Jason Gunthorpe

RDMA/hns: Update the kernel header file of hns

The hns_roce_ib_create_srq_resp is used to interact with the user for
data, this was open coded to use a u32 directly, instead use a properly
sized structure.

Fixes: c7bcb134 ("RDMA/hns: Add SRQ support for hip08 kernel mode")
Signed-off-by: default avatarLijun Ou <oulijun@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 951d01b9
...@@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, ...@@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd,
struct ib_udata *udata) struct ib_udata *udata)
{ {
struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); struct hns_roce_dev *hr_dev = to_hr_dev(pd->device);
struct hns_roce_ib_create_srq_resp resp = {};
struct hns_roce_srq *srq; struct hns_roce_srq *srq;
int srq_desc_size; int srq_desc_size;
int srq_buf_size; int srq_buf_size;
...@@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, ...@@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd,
srq->event = hns_roce_ib_srq_event; srq->event = hns_roce_ib_srq_event;
srq->ibsrq.ext.xrc.srq_num = srq->srqn; srq->ibsrq.ext.xrc.srq_num = srq->srqn;
resp.srqn = srq->srqn;
if (udata) { if (udata) {
if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { if (ib_copy_to_udata(udata, &resp,
min(udata->outlen, sizeof(resp)))) {
ret = -EFAULT; ret = -EFAULT;
goto err_wrid; goto err_srqc_alloc;
} }
} }
return &srq->ibsrq; return &srq->ibsrq;
err_srqc_alloc:
hns_roce_srq_free(hr_dev, srq);
err_wrid: err_wrid:
kvfree(srq->wrid); kvfree(srq->wrid);
......
...@@ -52,6 +52,11 @@ struct hns_roce_ib_create_srq { ...@@ -52,6 +52,11 @@ struct hns_roce_ib_create_srq {
__aligned_u64 que_addr; __aligned_u64 que_addr;
}; };
struct hns_roce_ib_create_srq_resp {
__u32 srqn;
__u32 reserved;
};
struct hns_roce_ib_create_qp { struct hns_roce_ib_create_qp {
__aligned_u64 buf_addr; __aligned_u64 buf_addr;
__aligned_u64 db_addr; __aligned_u64 db_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment