Skip to content

Commit 130c041

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 a8deb6a commit 130c041

File tree

9 files changed

+531
-4
lines changed

9 files changed

+531
-4
lines changed

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.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
@@ -63,6 +63,48 @@ struct bnxt_re_dv_umem_reg_attr {
6363
int dmabuf_fd;
6464
};
6565

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

0 commit comments

Comments
 (0)