在 2019/1/22 11:57, Jason Gunthorpe 写道: > On Tue, Jan 22, 2019 at 11:36:02AM +0800, oulijun wrote: >> 在 2019/1/22 10:23, Jason Gunthorpe 写道: >>> On Tue, Jan 22, 2019 at 10:23:34AM +0800, Lijun Ou wrote: >>>> The hns_roce_ib_create_srq_resp is used to interact with the >>>> user for data. As a result, it is added to apply with matching >>>> kernel headers. >>>> >>>> Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx> >>>> include/uapi/rdma/hns-abi.h | 5 +++++ >>>> 1 file changed, 5 insertions(+) >>>> >>>> diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h >>>> index ef3c7ec..eb76b38 100644 >>>> +++ b/include/uapi/rdma/hns-abi.h >>>> @@ -52,6 +52,11 @@ struct hns_roce_ib_create_srq { >>>> __aligned_u64 que_addr; >>>> }; >>>> >>>> +struct hns_roce_ib_create_srq_resp { >>>> + __u32 srqn; >>>> + __u32 reserved; >>>> +}; >>>> + >>> This makes no sense, how can uapi headers be added without adding a >>> corresponding kernel code!?!?! What fills in srqn? >>> >>> Jason >> The srqn will be obtained from hns_roce_bitmap_alloc in the kernel mode. When create srq, it need to >> transfer srqn to user by ib_copy_to_udata function. > The srqn is part of the ib_uverbs_create_srq_resp, it has nothing to > do with hns_roce_ib_create_srq_resp. > >> the ofed will report srqn by ib_uverbs_create_srq_resp, >> nextly, the user will use it by resp.srqn when run hns_roce_u_create_srq function. >> cmdof hns_roce_create_srq need be declared by DECLARE_DRV_CMD. > What? > >> for example, >> DECLARE_DRV_CMD(hns_roce_create_srq, >> IB_USER_VERBS_CMD_CREATE_SRQ, hns_roce_ib_create_srq, >> hns_roce_ib_create_srq_resp); > Are you sure this shouldn't be > > DECLARE_DRV_CMD(hns_roce_create_srq, > IB_USER_VERBS_CMD_CREATE_SRQ, hns_roce_ib_create_srq, > empty); > > ? > > Jason Yes. It will build fail and prompt hns_roce_create_srq_resp has no member named srqn information.