Skip to content

Commit d43117e

Browse files
committed
bnxt_re/lib: Direct Verbs: Support CQ and QP verbs
The following Direct Verb (DV) APIs have been implemented in this patch. These are implemented by enhancing the driver specific udata in existing verbs. CQ Direct Verbs: ---------------- - bnxt_re_dv_create_cq(): Create a CQ of requested size (cqe). The application must have already registered this memory using bnxt_re_dv_umem_reg(). The CQ umem-handle and umem-offset provided by the application are translated into an address for mapping and passed to the driver. - bnxt_re_dv_destroy_cq(): Destroy the DV_CQ created earlier. QP Direct Verbs: ---------------- - bnxt_re_dv_create_qp(): Create a QP using specified params (struct bnxt_re_dv_qp_init_attr). The application must have already registered SQ/RQ memory using bnxt_re_dv_umem_reg(). The SQ/RQ umem-handle and umem-offset provided by the application are translated into an address for mapping and passed to the driver. - bnxt_re_dv_destroy_qp(): Destroy the DV_QP created earlier. - bnxt_re_dv_modify_qp(): Modify QP attributes of the DV_QP. - bnxt_re_dv_query_qp(): Return QP attributes of the DV_QP. Note: ----- Some applications might want to allocate memory for all resources of a given type (CQ/QP) in one big chunk and then register that entire memory once using dv_umem_reg(). At the time of creating each individual resource, the application should pass a specific offset/length in the umem registered memory. Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Co-developed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Co-developed-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
1 parent 6ba0107 commit d43117e

11 files changed

Lines changed: 574 additions & 17 deletions

File tree

providers/bnxt_re/CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
rdma_provider(bnxt_re
1+
rdma_shared_provider(bnxt_re bnxt_re.map
2+
1 1.1.${PACKAGE_VERSION}
23
db.c
34
main.c
45
memory.c
56
verbs.c
67
dv.c
78
)
9+
10+
publish_headers(infiniband
11+
bnxt_re_dv.h
12+
)
13+
14+
rdma_pkg_config("bnxt_re" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
15+
16+
if (ENABLE_LTTNG AND LTTNGUST_FOUND)
17+
target_include_directories(bnxt_re PUBLIC ".")
18+
target_link_libraries(bnxt_re LINK_PRIVATE LTTng::UST)
19+
endif()

providers/bnxt_re/bnxt_re-abi.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747

4848
DECLARE_DRV_CMD(ubnxt_re_pd, IB_USER_VERBS_CMD_ALLOC_PD,
4949
empty, bnxt_re_pd_resp);
50-
DECLARE_DRV_CMD(ubnxt_re_cq, IB_USER_VERBS_CMD_CREATE_CQ,
50+
DECLARE_DRV_CMD(ubnxt_re_cq, IB_USER_VERBS_EX_CMD_CREATE_CQ,
5151
bnxt_re_cq_req, bnxt_re_cq_resp);
5252
DECLARE_DRV_CMD(ubnxt_re_resize_cq, IB_USER_VERBS_CMD_RESIZE_CQ,
5353
bnxt_re_resize_cq_req, empty);
54-
DECLARE_DRV_CMD(ubnxt_re_qp, IB_USER_VERBS_CMD_CREATE_QP,
54+
DECLARE_DRV_CMD(ubnxt_re_qp, IB_USER_VERBS_EX_CMD_CREATE_QP,
5555
bnxt_re_qp_req, bnxt_re_qp_resp);
5656
DECLARE_DRV_CMD(ubnxt_re_cntx, IB_USER_VERBS_CMD_GET_CONTEXT,
5757
bnxt_re_uctx_req, bnxt_re_uctx_resp);
@@ -226,6 +226,7 @@ enum {
226226
BNXT_RE_COMP_MASK_UCNTX_DBR_PACING_ENABLED = 0x02,
227227
BNXT_RE_COMP_MASK_UCNTX_POW2_DISABLED = 0x04,
228228
BNXT_RE_COMP_MASK_UCNTX_MSN_TABLE_ENABLED = 0x08,
229+
BNXT_RE_COMP_MASK_UCNTX_UAPI_COMPAT_SUPPORTED = 0x10,
229230
};
230231

231232
enum bnxt_re_que_flags_mask {

providers/bnxt_re/bnxt_re.map

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
{
1+
/* Export symbols should be added below according to
2+
Documentation/versioning.md document. */
3+
BNXT_RE_1.1 {
24
global:
3-
openib_driver_init;
45
bnxt_re_dv_alloc_db_region;
56
bnxt_re_dv_free_db_region;
67
bnxt_re_dv_umem_reg;
78
bnxt_re_dv_umem_dereg;
89
bnxt_re_dv_get_default_db_region;
10+
bnxt_re_dv_create_cq;
11+
bnxt_re_dv_destroy_cq;
12+
bnxt_re_dv_create_qp;
13+
bnxt_re_dv_destroy_qp;
14+
bnxt_re_dv_modify_qp;
15+
bnxt_re_dv_query_qp;
916
local: *;
1017
};

providers/bnxt_re/bnxt_re_dv.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,48 @@ struct bnxt_re_dv_umem_reg_attr {
6464
};
6565

6666
struct bnxt_re_dv_umem;
67+
struct bnxt_re_dv_cq_init_attr {
68+
uint64_t cq_handle;
69+
void *umem_handle; /* umem_handle from umem_reg */
70+
uint64_t cq_umem_offset; /* offset into umem */
71+
uint32_t ncqe;
72+
};
73+
74+
struct bnxt_re_dv_cq_attr {
75+
uint32_t ncqe; /* no. of entries */
76+
uint32_t cqe_size; /* size of entries */
77+
};
78+
79+
struct bnxt_re_dv_qp_init_attr {
80+
/* Standard ibv params */
81+
enum ibv_qp_type qp_type;
82+
uint32_t max_send_wr;
83+
uint32_t max_recv_wr;
84+
uint32_t max_send_sge;
85+
uint32_t max_recv_sge;
86+
uint32_t max_inline_data;
87+
struct ibv_cq *send_cq;
88+
struct ibv_cq *recv_cq;
89+
struct ibv_srq *srq;
90+
91+
/* DV params */
92+
uint64_t qp_handle; /* to match with cqe */
93+
void *dbr_handle; /* dbr_handle from alloc_dbr */
94+
void *sq_umem_handle; /* umem_handle from umem_reg */
95+
uint64_t sq_umem_offset; /* offset into umem */
96+
uint32_t sq_len; /* sq length including MSN area */
97+
uint32_t sq_slots; /* sq length in slots */
98+
void *rq_umem_handle; /* umem_handle from umem_reg */
99+
uint64_t rq_umem_offset; /* offset into umem */
100+
uint32_t sq_wqe_sz; /* sq wqe size */
101+
uint32_t sq_psn_sz; /* sq psn size */
102+
uint32_t sq_npsn; /* sq num psn entries */
103+
uint32_t rq_len; /* rq length */
104+
uint32_t rq_slots; /* rq length in slots */
105+
uint32_t rq_wqe_sz; /* rq wqe size */
106+
uint64_t comp_mask; /* compatibility mask for future updates */
107+
};
108+
67109
struct bnxt_re_dv_db_region_attr *
68110
bnxt_re_dv_alloc_db_region(struct ibv_context *ctx);
69111
int bnxt_re_dv_free_db_region(struct ibv_context *ctx,
@@ -73,6 +115,15 @@ int bnxt_re_dv_get_default_db_region(struct ibv_context *ibvctx,
73115
struct bnxt_re_dv_umem *bnxt_re_dv_umem_reg(struct ibv_context *ibvctx,
74116
struct bnxt_re_dv_umem_reg_attr *in);
75117
int bnxt_re_dv_umem_dereg(struct bnxt_re_dv_umem *umem);
118+
struct ibv_cq *bnxt_re_dv_create_cq(struct ibv_context *ibvctx,
119+
struct bnxt_re_dv_cq_init_attr *cq_attr);
120+
int bnxt_re_dv_destroy_cq(struct ibv_cq *ibv_cq);
121+
struct ibv_qp *bnxt_re_dv_create_qp(struct ibv_pd *pd,
122+
struct bnxt_re_dv_qp_init_attr *qp_attr);
123+
int bnxt_re_dv_destroy_qp(struct ibv_qp *ibvqp);
124+
int bnxt_re_dv_modify_qp(struct ibv_qp *ibv_qp, struct ibv_qp_attr *attr,
125+
int attr_mask);
126+
int bnxt_re_dv_query_qp(void *qp_handle, struct ib_uverbs_qp_attr *attr);
76127
#ifdef __cplusplus
77128
}
78129
#endif

0 commit comments

Comments
 (0)