net/mlx5: wrap sampling actions per OS
[dpdk.git] / drivers / common / mlx5 / windows / mlx5_glue.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #ifndef MLX5_GLUE_H_
6 #define MLX5_GLUE_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <rte_byteorder.h>
12 #include <mlx5_win_defs.h>
13
14 #ifndef MLX5_GLUE_VERSION
15 #define MLX5_GLUE_VERSION ""
16 #endif
17
18 #ifndef HAVE_MLX5DV_DR
19 enum  mlx5dv_dr_domain_type { unused, };
20 struct mlx5dv_dr_domain;
21 struct mlx5dv_dr_action;
22 #endif
23
24 #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
25 struct mlx5dv_dr_flow_sampler_attr {
26         uint32_t sample_ratio;
27         void *default_next_table;
28         size_t num_sample_actions;
29         struct mlx5dv_dr_action **sample_actions;
30         uint64_t action;
31 };
32 #endif
33
34 #ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
35 enum mlx5dv_dr_action_dest_type {
36         MLX5DV_DR_ACTION_DEST,
37         MLX5DV_DR_ACTION_DEST_REFORMAT,
38 };
39 struct mlx5dv_dr_action_dest_reformat {
40         struct mlx5dv_dr_action *reformat;
41         struct mlx5dv_dr_action *dest;
42 };
43 struct mlx5dv_dr_action_dest_attr {
44         enum mlx5dv_dr_action_dest_type type;
45         union {
46                 struct mlx5dv_dr_action *dest;
47                 struct mlx5dv_dr_action_dest_reformat *dest_reformat;
48         };
49 };
50 #endif
51
52 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
53 struct mlx5_glue {
54         const char *version;
55         void *(*devx_obj_create)(void *ctx,
56                                  void *in, size_t inlen,
57                                  void *out, size_t outlen);
58         int (*devx_obj_destroy)(void *obj);
59         int (*devx_obj_query)(void *obj,
60                               void *in, size_t inlen,
61                               void *out, size_t outlen);
62         int (*devx_obj_modify)(void *obj,
63                                void *in, size_t inlen,
64                                void *out, size_t outlen);
65         int (*devx_general_cmd)(void *ctx,
66                                void *in, size_t inlen,
67                                void *out, size_t outlen);
68         int (*devx_umem_dereg)(void *umem);
69         void *(*devx_umem_reg)(void *ctx,
70                         void *addr, size_t size,
71                         uint32_t access, uint32_t *id);
72         void *(*devx_alloc_uar)(void *ctx,
73                         uint32_t flags);
74         void (*devx_free_uar)(void *uar);
75         void *(*get_device_list)(int *num_devices);
76         void (*free_device_list)(void *list);
77         void *(*open_device)(void *device);
78         int (*close_device)(void *ctx);
79         int (*query_device)(void *device_bdf, void *dev_inf);
80         void* (*query_hca_iseg)(void *ctx, uint32_t *cb_iseg);
81         int (*devx_obj_query_async)(void *obj,
82                                     const void *in, size_t inlen,
83                                     size_t outlen, uint64_t wr_id,
84                                     void *cmd_comp);
85         void *(*devx_fs_rule_add)(void *ctx, void *in, uint32_t inlen);
86         int (*devx_fs_rule_del)(void *flow);
87         int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn);
88         int (*query_rt_values)(void *ctx, void *devx_clock);
89         int (*devx_init_showdown_event)(void *ctx);
90 };
91
92 extern const struct mlx5_glue *mlx5_glue;
93
94 #endif /* MLX5_GLUE_H_ */