xref: /dpdk/drivers/common/mlx5/windows/mlx5_glue.h (revision cb91f12f4a0c094b27110ccb7c187b8d260e685f)
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 enum {
53 	ALL_PROMISC,
54 	MC_PROMISC,
55 };
56 
57 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
58 struct mlx5_glue {
59 	const char *version;
60 	void *(*devx_obj_create)(void *ctx,
61 				 void *in, size_t inlen,
62 				 void *out, size_t outlen);
63 	int (*devx_obj_destroy)(void *obj);
64 	int (*devx_obj_query)(void *obj,
65 			      void *in, size_t inlen,
66 			      void *out, size_t outlen);
67 	int (*devx_obj_modify)(void *obj,
68 			       void *in, size_t inlen,
69 			       void *out, size_t outlen);
70 	int (*devx_general_cmd)(void *ctx,
71 			       void *in, size_t inlen,
72 			       void *out, size_t outlen);
73 	int (*devx_umem_dereg)(void *umem);
74 	void *(*devx_umem_reg)(void *ctx,
75 			void *addr, size_t size,
76 			uint32_t access, uint32_t *id);
77 	void *(*devx_alloc_uar)(void *ctx,
78 			uint32_t flags);
79 	void (*devx_free_uar)(void *uar);
80 	void *(*get_device_list)(int *num_devices);
81 	void (*free_device_list)(void *list);
82 	void *(*open_device)(void *device);
83 	int (*close_device)(void *ctx);
84 	int (*query_device)(void *device_bdf, void *dev_inf);
85 	void* (*query_hca_iseg)(void *ctx, uint32_t *cb_iseg);
86 	int (*devx_obj_query_async)(void *obj,
87 				    const void *in, size_t inlen,
88 				    size_t outlen, uint64_t wr_id,
89 				    void *cmd_comp);
90 	void *(*devx_fs_rule_add)(void *ctx, void *in, uint32_t inlen);
91 	int (*devx_fs_rule_del)(void *flow);
92 	int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn);
93 	int (*query_rt_values)(void *ctx, void *devx_clock);
94 	int (*devx_init_showdown_event)(void *ctx);
95 	int (*devx_set_promisc_vport)(void *ctx, uint32_t promisc_type, uint8_t f_enable);
96 	int (*devx_get_mtu)(void *ctx, uint32_t *mtu);
97 	int (*devx_set_mtu)(void *ctx, uint32_t mtu);
98 };
99 
100 extern const struct mlx5_glue *mlx5_glue;
101 
102 #endif /* MLX5_GLUE_H_ */
103