在 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 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. 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); lastly, it will be used to issue srq db by srqn when post srq recv in user mode. >