6b078b2863d2c2a240f780618b1bcad088879f4d
[dpdk.git] / drivers / common / mlx5 / mlx5_common_devx.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #ifndef RTE_PMD_MLX5_COMMON_DEVX_H_
6 #define RTE_PMD_MLX5_COMMON_DEVX_H_
7
8 #include "mlx5_devx_cmds.h"
9
10 /* The standard page size */
11 #define MLX5_LOG_PAGE_SIZE 12
12
13 /* DevX Completion Queue structure. */
14 struct mlx5_devx_cq {
15         struct mlx5_devx_obj *cq; /* The CQ DevX object. */
16         void *umem_obj; /* The CQ umem object. */
17         union {
18                 volatile void *umem_buf;
19                 volatile struct mlx5_cqe *cqes; /* The CQ ring buffer. */
20         };
21         volatile uint32_t *db_rec; /* The CQ doorbell record. */
22 };
23
24 /* DevX Send Queue structure. */
25 struct mlx5_devx_sq {
26         struct mlx5_devx_obj *sq; /* The SQ DevX object. */
27         void *umem_obj; /* The SQ umem object. */
28         union {
29                 volatile void *umem_buf;
30                 volatile struct mlx5_wqe *wqes; /* The SQ ring buffer. */
31         };
32         volatile uint32_t *db_rec; /* The SQ doorbell record. */
33 };
34
35
36 /* mlx5_common_devx.c */
37
38 __rte_internal
39 void mlx5_devx_cq_destroy(struct mlx5_devx_cq *cq);
40
41 __rte_internal
42 int mlx5_devx_cq_create(void *ctx, struct mlx5_devx_cq *cq_obj,
43                         uint16_t log_desc_n,
44                         struct mlx5_devx_cq_attr *attr, int socket);
45
46 __rte_internal
47 void mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq);
48
49 __rte_internal
50 int mlx5_devx_sq_create(void *ctx, struct mlx5_devx_sq *sq_obj,
51                         uint16_t log_wqbb_n,
52                         struct mlx5_devx_create_sq_attr *attr, int socket);
53
54 #endif /* RTE_PMD_MLX5_COMMON_DEVX_H_ */