From: Jason Gunthorpe <jgg@xxxxxxxxxxxx> Using the driver support macros we can now directly create the required driver structs automatically. Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> --- kernel-headers/CMakeLists.txt | 1 + providers/hns/hns_roce_u_abi.h | 49 +++++++++------------------------------- providers/hns/hns_roce_u_verbs.c | 2 +- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/kernel-headers/CMakeLists.txt b/kernel-headers/CMakeLists.txt index e28ae68ee48b35..1c4662007a02a3 100644 --- a/kernel-headers/CMakeLists.txt +++ b/kernel-headers/CMakeLists.txt @@ -57,6 +57,7 @@ endfunction() rdma_kernel_provider_abi( rdma/bnxt_re-abi.h rdma/cxgb4-abi.h + rdma/hns-abi.h rdma/i40iw-abi.h rdma/ib_user_verbs.h rdma/mlx4-abi.h diff --git a/providers/hns/hns_roce_u_abi.h b/providers/hns/hns_roce_u_abi.h index a3742e2d91bcc2..3b646b6cd6d4ec 100644 --- a/providers/hns/hns_roce_u_abi.h +++ b/providers/hns/hns_roce_u_abi.h @@ -34,43 +34,16 @@ #define _HNS_ROCE_U_ABI_H #include <infiniband/kern-abi.h> +#include <rdma/hns-abi.h> +#include <kernel-abi/hns-abi.h> + +DECLARE_DRV_CMD(hns_roce_alloc_pd, IB_USER_VERBS_CMD_ALLOC_PD, + empty, hns_roce_ib_alloc_pd_resp); +DECLARE_DRV_CMD(hns_roce_create_cq, IB_USER_VERBS_CMD_CREATE_CQ, + hns_roce_ib_create_cq, hns_roce_ib_create_cq_resp); +DECLARE_DRV_CMD(hns_roce_create_qp, IB_USER_VERBS_CMD_CREATE_QP, + hns_roce_ib_create_qp, hns_roce_ib_create_qp_resp); +DECLARE_DRV_CMD(hns_roce_alloc_ucontext, IB_USER_VERBS_CMD_GET_CONTEXT, + empty, hns_roce_ib_alloc_ucontext_resp); -struct hns_roce_alloc_ucontext_resp { - struct ib_uverbs_get_context_resp ibv_resp; - __u32 qp_tab_size; - __u32 reserved; -}; - -struct hns_roce_alloc_pd_resp { - struct ib_uverbs_alloc_pd_resp ibv_resp; - __u32 pdn; - __u32 reserved; -}; - -struct hns_roce_create_cq { - struct ibv_create_cq ibv_cmd; - __u64 buf_addr; - __u64 db_addr; -}; - -struct hns_roce_create_cq_resp { - struct ib_uverbs_create_cq_resp ibv_resp; - __u64 cqn; /* Only 32 bits used, 64 for compat */ - __u64 cap_flags; -}; - -struct hns_roce_create_qp { - struct ibv_create_qp ibv_cmd; - __u64 buf_addr; - __u64 db_addr; - __u8 log_sq_bb_count; - __u8 log_sq_stride; - __u8 sq_no_prefetch; - __u8 reserved[5]; -}; - -struct hns_roce_create_qp_resp { - struct ib_uverbs_create_qp_resp base; - __u64 cap_flags; -}; #endif /* _HNS_ROCE_U_ABI_H */ diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c index 24dbbceb58c263..2fc536782476d6 100644 --- a/providers/hns/hns_roce_u_verbs.c +++ b/providers/hns/hns_roce_u_verbs.c @@ -605,7 +605,7 @@ struct ibv_qp *hns_roce_u_create_qp(struct ibv_pd *pd, pthread_mutex_lock(&to_hr_ctx(pd->context)->qp_table_mutex); ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd.ibv_cmd, - sizeof(cmd), &resp.base, sizeof(resp)); + sizeof(cmd), &resp.ibv_resp, sizeof(resp)); if (ret) { fprintf(stderr, "ibv_cmd_create_qp failed!\n"); goto err_rq_db; -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html