xref: /dpdk/drivers/common/mlx5/linux/mlx5_glue.h (revision dfceca7e7e79a0a7f7bb01766284744eeca97e94)
172f75660SOphir Munk /* SPDX-License-Identifier: BSD-3-Clause
272f75660SOphir Munk  * Copyright 2018 6WIND S.A.
372f75660SOphir Munk  * Copyright 2018 Mellanox Technologies, Ltd
472f75660SOphir Munk  */
572f75660SOphir Munk 
672f75660SOphir Munk #ifndef MLX5_GLUE_H_
772f75660SOphir Munk #define MLX5_GLUE_H_
872f75660SOphir Munk 
972f75660SOphir Munk #include <stddef.h>
1072f75660SOphir Munk #include <stdint.h>
1172f75660SOphir Munk /* Verbs headers do not support -pedantic. */
1272f75660SOphir Munk #ifdef PEDANTIC
1372f75660SOphir Munk #pragma GCC diagnostic ignored "-Wpedantic"
1472f75660SOphir Munk #endif
1572f75660SOphir Munk #include <infiniband/mlx5dv.h>
1672f75660SOphir Munk #include <infiniband/verbs.h>
1772f75660SOphir Munk #ifdef PEDANTIC
1872f75660SOphir Munk #pragma GCC diagnostic error "-Wpedantic"
1972f75660SOphir Munk #endif
2072f75660SOphir Munk 
2172f75660SOphir Munk #include <rte_byteorder.h>
2272f75660SOphir Munk 
2372f75660SOphir Munk #include "mlx5_autoconf.h"
2472f75660SOphir Munk 
2572f75660SOphir Munk #ifndef MLX5_GLUE_VERSION
2672f75660SOphir Munk #define MLX5_GLUE_VERSION ""
2772f75660SOphir Munk #endif
2872f75660SOphir Munk 
2972f75660SOphir Munk #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
3072f75660SOphir Munk struct ibv_counter_set;
3172f75660SOphir Munk struct ibv_counter_set_data;
3272f75660SOphir Munk struct ibv_counter_set_description;
3372f75660SOphir Munk struct ibv_counter_set_init_attr;
3472f75660SOphir Munk struct ibv_query_counter_set_attr;
3572f75660SOphir Munk #endif
3672f75660SOphir Munk 
3772f75660SOphir Munk #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
3872f75660SOphir Munk struct ibv_counters;
3972f75660SOphir Munk struct ibv_counters_init_attr;
4072f75660SOphir Munk struct ibv_counter_attach_attr;
4172f75660SOphir Munk #endif
4272f75660SOphir Munk 
4372f75660SOphir Munk #ifndef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
4472f75660SOphir Munk struct mlx5dv_qp_init_attr;
4572f75660SOphir Munk #endif
4672f75660SOphir Munk 
4772f75660SOphir Munk #ifndef HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT
4872f75660SOphir Munk struct mlx5dv_wq_init_attr;
4972f75660SOphir Munk #endif
5072f75660SOphir Munk 
5172f75660SOphir Munk #ifndef HAVE_IBV_FLOW_DV_SUPPORT
5272f75660SOphir Munk struct mlx5dv_flow_matcher;
5372f75660SOphir Munk struct mlx5dv_flow_matcher_attr;
5472f75660SOphir Munk struct mlx5dv_flow_action_attr;
5572f75660SOphir Munk struct mlx5dv_flow_match_parameters;
5672f75660SOphir Munk struct mlx5dv_dr_flow_meter_attr;
5772f75660SOphir Munk struct ibv_flow_action;
5872f75660SOphir Munk enum mlx5dv_flow_action_packet_reformat_type { packet_reformat_type = 0, };
5972f75660SOphir Munk enum mlx5dv_flow_table_type { flow_table_type = 0, };
6072f75660SOphir Munk #endif
6172f75660SOphir Munk 
6272f75660SOphir Munk #ifndef HAVE_IBV_FLOW_DEVX_COUNTERS
6372f75660SOphir Munk #define MLX5DV_FLOW_ACTION_COUNTERS_DEVX 0
6472f75660SOphir Munk #endif
6572f75660SOphir Munk 
6672f75660SOphir Munk #ifndef HAVE_IBV_DEVX_OBJ
6772f75660SOphir Munk struct mlx5dv_devx_obj;
6872f75660SOphir Munk struct mlx5dv_devx_umem { uint32_t umem_id; };
6972f75660SOphir Munk struct mlx5dv_devx_uar { void *reg_addr; void *base_addr; uint32_t page_id; };
7072f75660SOphir Munk #endif
7172f75660SOphir Munk 
7272f75660SOphir Munk #ifndef HAVE_IBV_DEVX_ASYNC
7372f75660SOphir Munk struct mlx5dv_devx_cmd_comp;
7472f75660SOphir Munk struct mlx5dv_devx_async_cmd_hdr;
7572f75660SOphir Munk #endif
7672f75660SOphir Munk 
7772f75660SOphir Munk #ifndef HAVE_MLX5DV_DR
7872f75660SOphir Munk enum  mlx5dv_dr_domain_type { unused, };
7972f75660SOphir Munk struct mlx5dv_dr_domain;
80a3def854SJiawei Wang struct mlx5dv_dr_action;
81e681eb05SMatan Azrad #define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1
8272f75660SOphir Munk #endif
8372f75660SOphir Munk 
8472f75660SOphir Munk #ifndef HAVE_MLX5DV_DR_DEVX_PORT
8572f75660SOphir Munk struct mlx5dv_devx_port;
8672f75660SOphir Munk #endif
8772f75660SOphir Munk 
88d0cf77e8SViacheslav Ovsiienko #ifndef HAVE_MLX5DV_DR_DEVX_PORT_V35
89d0cf77e8SViacheslav Ovsiienko struct mlx5dv_port;
90d0cf77e8SViacheslav Ovsiienko #endif
91d0cf77e8SViacheslav Ovsiienko 
92d0cf77e8SViacheslav Ovsiienko #define MLX5_PORT_QUERY_VPORT (1u << 0)
93d0cf77e8SViacheslav Ovsiienko #define MLX5_PORT_QUERY_REG_C0 (1u << 1)
94*dfceca7eSAlex Vesker #define MLX5_PORT_QUERY_ESW_OWNER_VHCA_ID (1u << 2)
95d0cf77e8SViacheslav Ovsiienko 
96d0cf77e8SViacheslav Ovsiienko struct mlx5_port_info {
97d0cf77e8SViacheslav Ovsiienko 	uint16_t query_flags;
98d0cf77e8SViacheslav Ovsiienko 	uint16_t vport_id; /* Associated VF vport index (if any). */
99*dfceca7eSAlex Vesker 	uint16_t esw_owner_vhca_id; /* Associated the esw_owner that this VF belongs to. */
100d0cf77e8SViacheslav Ovsiienko 	uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
101d0cf77e8SViacheslav Ovsiienko 	uint32_t vport_meta_mask; /* Used for vport index field match mask. */
102d0cf77e8SViacheslav Ovsiienko };
103d0cf77e8SViacheslav Ovsiienko 
10472f75660SOphir Munk #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
10572f75660SOphir Munk struct mlx5dv_dr_flow_meter_attr;
10672f75660SOphir Munk #endif
10772f75660SOphir Munk 
108a3def854SJiawei Wang #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
109a3def854SJiawei Wang struct mlx5dv_dr_flow_sampler_attr {
110a3def854SJiawei Wang 	uint32_t sample_ratio;
111a3def854SJiawei Wang 	void *default_next_table;
112a3def854SJiawei Wang 	size_t num_sample_actions;
113a3def854SJiawei Wang 	struct mlx5dv_dr_action **sample_actions;
114a3def854SJiawei Wang 	uint64_t action;
115a3def854SJiawei Wang };
116a3def854SJiawei Wang #endif
117a3def854SJiawei Wang 
1184d23dd35SJiawei Wang #ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
1194d23dd35SJiawei Wang enum mlx5dv_dr_action_dest_type {
1204d23dd35SJiawei Wang 	MLX5DV_DR_ACTION_DEST,
1214d23dd35SJiawei Wang 	MLX5DV_DR_ACTION_DEST_REFORMAT,
1224d23dd35SJiawei Wang };
1234d23dd35SJiawei Wang struct mlx5dv_dr_action_dest_reformat {
1244d23dd35SJiawei Wang 	struct mlx5dv_dr_action *reformat;
1254d23dd35SJiawei Wang 	struct mlx5dv_dr_action *dest;
1264d23dd35SJiawei Wang };
1274d23dd35SJiawei Wang struct mlx5dv_dr_action_dest_attr {
1284d23dd35SJiawei Wang 	enum mlx5dv_dr_action_dest_type type;
1294d23dd35SJiawei Wang 	union {
1304d23dd35SJiawei Wang 		struct mlx5dv_dr_action *dest;
1314d23dd35SJiawei Wang 		struct mlx5dv_dr_action_dest_reformat *dest_reformat;
1324d23dd35SJiawei Wang 	};
1334d23dd35SJiawei Wang };
1344d23dd35SJiawei Wang #endif
1354d23dd35SJiawei Wang 
13672f75660SOphir Munk #ifndef HAVE_IBV_DEVX_EVENT
13772f75660SOphir Munk struct mlx5dv_devx_event_channel { int fd; };
13872f75660SOphir Munk struct mlx5dv_devx_async_event_hdr;
13972f75660SOphir Munk #define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA 1
14072f75660SOphir Munk #endif
14172f75660SOphir Munk 
14272f75660SOphir Munk #ifndef HAVE_IBV_VAR
14372f75660SOphir Munk struct mlx5dv_var { uint32_t page_id; uint32_t length; off_t mmap_off;
14472f75660SOphir Munk 			uint64_t comp_mask; };
14572f75660SOphir Munk #endif
14672f75660SOphir Munk 
14772f75660SOphir Munk #ifndef HAVE_IBV_RELAXED_ORDERING
14872f75660SOphir Munk #define IBV_ACCESS_RELAXED_ORDERING 0
14972f75660SOphir Munk #endif
15072f75660SOphir Munk 
15172f75660SOphir Munk struct mlx5_glue {
15272f75660SOphir Munk 	const char *version;
15372f75660SOphir Munk 	int (*fork_init)(void);
15472f75660SOphir Munk 	struct ibv_pd *(*alloc_pd)(struct ibv_context *context);
15572f75660SOphir Munk 	int (*dealloc_pd)(struct ibv_pd *pd);
1560777921aSMichael Baum 	struct ibv_pd *(*import_pd)(struct ibv_context *context,
1570777921aSMichael Baum 				    uint32_t pd_handle);
1580777921aSMichael Baum 	int (*unimport_pd)(struct ibv_pd *pd);
15972f75660SOphir Munk 	struct ibv_device **(*get_device_list)(int *num_devices);
16072f75660SOphir Munk 	void (*free_device_list)(struct ibv_device **list);
16172f75660SOphir Munk 	struct ibv_context *(*open_device)(struct ibv_device *device);
1620777921aSMichael Baum 	struct ibv_context *(*import_device)(int cmd_fd);
16372f75660SOphir Munk 	int (*close_device)(struct ibv_context *context);
16472f75660SOphir Munk 	int (*query_device)(struct ibv_context *context,
16572f75660SOphir Munk 			    struct ibv_device_attr *device_attr);
16672f75660SOphir Munk 	int (*query_device_ex)(struct ibv_context *context,
16772f75660SOphir Munk 			       const struct ibv_query_device_ex_input *input,
16872f75660SOphir Munk 			       struct ibv_device_attr_ex *attr);
169*dfceca7eSAlex Vesker 	const char *(*get_device_name)(struct ibv_device *device);
17072f75660SOphir Munk 	int (*query_rt_values_ex)(struct ibv_context *context,
17172f75660SOphir Munk 			       struct ibv_values_ex *values);
17272f75660SOphir Munk 	int (*query_port)(struct ibv_context *context, uint8_t port_num,
17372f75660SOphir Munk 			  struct ibv_port_attr *port_attr);
17472f75660SOphir Munk 	struct ibv_comp_channel *(*create_comp_channel)
17572f75660SOphir Munk 		(struct ibv_context *context);
17672f75660SOphir Munk 	int (*destroy_comp_channel)(struct ibv_comp_channel *channel);
17772f75660SOphir Munk 	struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe,
17872f75660SOphir Munk 				    void *cq_context,
17972f75660SOphir Munk 				    struct ibv_comp_channel *channel,
18072f75660SOphir Munk 				    int comp_vector);
18172f75660SOphir Munk 	int (*destroy_cq)(struct ibv_cq *cq);
18272f75660SOphir Munk 	int (*get_cq_event)(struct ibv_comp_channel *channel,
18372f75660SOphir Munk 			    struct ibv_cq **cq, void **cq_context);
18472f75660SOphir Munk 	void (*ack_cq_events)(struct ibv_cq *cq, unsigned int nevents);
18572f75660SOphir Munk 	struct ibv_rwq_ind_table *(*create_rwq_ind_table)
18672f75660SOphir Munk 		(struct ibv_context *context,
18772f75660SOphir Munk 		 struct ibv_rwq_ind_table_init_attr *init_attr);
18872f75660SOphir Munk 	int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
18972f75660SOphir Munk 	struct ibv_wq *(*create_wq)(struct ibv_context *context,
19072f75660SOphir Munk 				    struct ibv_wq_init_attr *wq_init_attr);
19172f75660SOphir Munk 	int (*destroy_wq)(struct ibv_wq *wq);
19272f75660SOphir Munk 	int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
19372f75660SOphir Munk 	struct ibv_flow *(*create_flow)(struct ibv_qp *qp,
19472f75660SOphir Munk 					struct ibv_flow_attr *flow);
19572f75660SOphir Munk 	int (*destroy_flow)(struct ibv_flow *flow_id);
19672f75660SOphir Munk 	int (*destroy_flow_action)(void *action);
19772f75660SOphir Munk 	struct ibv_qp *(*create_qp)(struct ibv_pd *pd,
19872f75660SOphir Munk 				    struct ibv_qp_init_attr *qp_init_attr);
19972f75660SOphir Munk 	struct ibv_qp *(*create_qp_ex)
20072f75660SOphir Munk 		(struct ibv_context *context,
20172f75660SOphir Munk 		 struct ibv_qp_init_attr_ex *qp_init_attr_ex);
20272f75660SOphir Munk 	int (*destroy_qp)(struct ibv_qp *qp);
20372f75660SOphir Munk 	int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
20472f75660SOphir Munk 			 int attr_mask);
20572f75660SOphir Munk 	struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr,
20672f75660SOphir Munk 				 size_t length, int access);
2076ebd062eSMichael Baum 	struct ibv_mr *(*reg_mr_iova)(struct ibv_pd *pd, void *addr,
2086ebd062eSMichael Baum 				      size_t length, uint64_t iova,
2096ebd062eSMichael Baum 				      int access);
21072f75660SOphir Munk 	struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd);
21172f75660SOphir Munk 	int (*dereg_mr)(struct ibv_mr *mr);
21272f75660SOphir Munk 	struct ibv_counter_set *(*create_counter_set)
21372f75660SOphir Munk 		(struct ibv_context *context,
21472f75660SOphir Munk 		 struct ibv_counter_set_init_attr *init_attr);
21572f75660SOphir Munk 	int (*destroy_counter_set)(struct ibv_counter_set *cs);
21672f75660SOphir Munk 	int (*describe_counter_set)
21772f75660SOphir Munk 		(struct ibv_context *context,
21872f75660SOphir Munk 		 uint16_t counter_set_id,
21972f75660SOphir Munk 		 struct ibv_counter_set_description *cs_desc);
22072f75660SOphir Munk 	int (*query_counter_set)(struct ibv_query_counter_set_attr *query_attr,
22172f75660SOphir Munk 				 struct ibv_counter_set_data *cs_data);
22272f75660SOphir Munk 	struct ibv_counters *(*create_counters)
22372f75660SOphir Munk 		(struct ibv_context *context,
22472f75660SOphir Munk 		 struct ibv_counters_init_attr *init_attr);
22572f75660SOphir Munk 	int (*destroy_counters)(struct ibv_counters *counters);
22672f75660SOphir Munk 	int (*attach_counters)(struct ibv_counters *counters,
22772f75660SOphir Munk 			       struct ibv_counter_attach_attr *attr,
22872f75660SOphir Munk 			       struct ibv_flow *flow);
22972f75660SOphir Munk 	int (*query_counters)(struct ibv_counters *counters,
23072f75660SOphir Munk 			      uint64_t *counters_value,
23172f75660SOphir Munk 			      uint32_t ncounters,
23272f75660SOphir Munk 			      uint32_t flags);
23372f75660SOphir Munk 	void (*ack_async_event)(struct ibv_async_event *event);
23472f75660SOphir Munk 	int (*get_async_event)(struct ibv_context *context,
23572f75660SOphir Munk 			       struct ibv_async_event *event);
23672f75660SOphir Munk 	const char *(*port_state_str)(enum ibv_port_state port_state);
23772f75660SOphir Munk 	struct ibv_cq *(*cq_ex_to_cq)(struct ibv_cq_ex *cq);
23872f75660SOphir Munk 	void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
23972f75660SOphir Munk 	void *(*dr_create_flow_action_dest_port)(void *domain,
24072f75660SOphir Munk 						 uint32_t port);
2414c093ffaSParav Pandit 	void *(*dr_create_flow_action_drop)(void);
24272f75660SOphir Munk 	void *(*dr_create_flow_action_push_vlan)
24372f75660SOphir Munk 					(struct mlx5dv_dr_domain *domain,
24472f75660SOphir Munk 					 rte_be32_t vlan_tag);
2454c093ffaSParav Pandit 	void *(*dr_create_flow_action_pop_vlan)(void);
24672f75660SOphir Munk 	void *(*dr_create_flow_tbl)(void *domain, uint32_t level);
24772f75660SOphir Munk 	int (*dr_destroy_flow_tbl)(void *tbl);
24872f75660SOphir Munk 	void *(*dr_create_domain)(struct ibv_context *ctx,
24972f75660SOphir Munk 				  enum mlx5dv_dr_domain_type domain);
25072f75660SOphir Munk 	int (*dr_destroy_domain)(void *domain);
2516e0cd74aSBing Zhao 	int (*dr_sync_domain)(void *domain, uint32_t flags);
25272f75660SOphir Munk 	struct ibv_cq_ex *(*dv_create_cq)
25372f75660SOphir Munk 		(struct ibv_context *context,
25472f75660SOphir Munk 		 struct ibv_cq_init_attr_ex *cq_attr,
25572f75660SOphir Munk 		 struct mlx5dv_cq_init_attr *mlx5_cq_attr);
25672f75660SOphir Munk 	struct ibv_wq *(*dv_create_wq)
25772f75660SOphir Munk 		(struct ibv_context *context,
25872f75660SOphir Munk 		 struct ibv_wq_init_attr *wq_attr,
25972f75660SOphir Munk 		 struct mlx5dv_wq_init_attr *mlx5_wq_attr);
26072f75660SOphir Munk 	int (*dv_query_device)(struct ibv_context *ctx_in,
26172f75660SOphir Munk 			       struct mlx5dv_context *attrs_out);
26272f75660SOphir Munk 	int (*dv_set_context_attr)(struct ibv_context *ibv_ctx,
26372f75660SOphir Munk 				   enum mlx5dv_set_ctx_attr_type type,
26472f75660SOphir Munk 				   void *attr);
26572f75660SOphir Munk 	int (*dv_init_obj)(struct mlx5dv_obj *obj, uint64_t obj_type);
26672f75660SOphir Munk 	struct ibv_qp *(*dv_create_qp)
26772f75660SOphir Munk 		(struct ibv_context *context,
26872f75660SOphir Munk 		 struct ibv_qp_init_attr_ex *qp_init_attr_ex,
26972f75660SOphir Munk 		 struct mlx5dv_qp_init_attr *dv_qp_init_attr);
27072f75660SOphir Munk 	void *(*dv_create_flow_matcher)
27172f75660SOphir Munk 		(struct ibv_context *context,
27272f75660SOphir Munk 		 struct mlx5dv_flow_matcher_attr *matcher_attr,
27372f75660SOphir Munk 		 void *tbl);
274*dfceca7eSAlex Vesker 	void *(*dv_create_flow_matcher_root)
275*dfceca7eSAlex Vesker 		(struct ibv_context *context,
276*dfceca7eSAlex Vesker 		 struct mlx5dv_flow_matcher_attr *matcher_attr);
27772f75660SOphir Munk 	void *(*dv_create_flow)(void *matcher, void *match_value,
27872f75660SOphir Munk 			  size_t num_actions, void *actions[]);
279*dfceca7eSAlex Vesker 	void *(*dv_create_flow_root)(void *matcher, void *match_value,
280*dfceca7eSAlex Vesker 				     size_t num_actions, void *actions);
28172f75660SOphir Munk 	void *(*dv_create_flow_action_counter)(void *obj, uint32_t  offset);
28272f75660SOphir Munk 	void *(*dv_create_flow_action_dest_ibv_qp)(void *qp);
28372f75660SOphir Munk 	void *(*dv_create_flow_action_dest_devx_tir)(void *tir);
28472f75660SOphir Munk 	void *(*dv_create_flow_action_modify_header)
28572f75660SOphir Munk 		(struct ibv_context *ctx, enum mlx5dv_flow_table_type ft_type,
28672f75660SOphir Munk 		 void *domain, uint64_t flags, size_t actions_sz,
28772f75660SOphir Munk 		 uint64_t actions[]);
288*dfceca7eSAlex Vesker 	void *(*dv_create_flow_action_modify_header_root)
289*dfceca7eSAlex Vesker 		(struct ibv_context *ctx, size_t actions_sz, uint64_t actions[],
290*dfceca7eSAlex Vesker 		 enum mlx5dv_flow_table_type ft_type);
29172f75660SOphir Munk 	void *(*dv_create_flow_action_packet_reformat)
29272f75660SOphir Munk 		(struct ibv_context *ctx,
29372f75660SOphir Munk 		 enum mlx5dv_flow_action_packet_reformat_type reformat_type,
29472f75660SOphir Munk 		 enum mlx5dv_flow_table_type ft_type,
29572f75660SOphir Munk 		 struct mlx5dv_dr_domain *domain,
29672f75660SOphir Munk 		 uint32_t flags, size_t data_sz, void *data);
297*dfceca7eSAlex Vesker 	void *(*dv_create_flow_action_packet_reformat_root)
298*dfceca7eSAlex Vesker 		(struct ibv_context *ctx,
299*dfceca7eSAlex Vesker 		 size_t data_sz, void *data,
300*dfceca7eSAlex Vesker 		 enum mlx5dv_flow_action_packet_reformat_type reformat_type,
301*dfceca7eSAlex Vesker 		 enum mlx5dv_flow_table_type ft_type);
30272f75660SOphir Munk 	void *(*dv_create_flow_action_tag)(uint32_t tag);
30372f75660SOphir Munk 	void *(*dv_create_flow_action_meter)
30472f75660SOphir Munk 		(struct mlx5dv_dr_flow_meter_attr *attr);
30572f75660SOphir Munk 	int (*dv_modify_flow_action_meter)(void *action,
30672f75660SOphir Munk 		struct mlx5dv_dr_flow_meter_attr *attr, uint64_t modify_bits);
307d4d85aa6SShiri Kuzin 	void *(*dr_create_flow_action_default_miss)(void);
30872f75660SOphir Munk 	int (*dv_destroy_flow)(void *flow);
30972f75660SOphir Munk 	int (*dv_destroy_flow_matcher)(void *matcher);
310*dfceca7eSAlex Vesker 	int (*dv_destroy_flow_matcher_root)(void *matcher);
31172f75660SOphir Munk 	struct ibv_context *(*dv_open_device)(struct ibv_device *device);
31272f75660SOphir Munk 	struct mlx5dv_var *(*dv_alloc_var)(struct ibv_context *context,
31372f75660SOphir Munk 					   uint32_t flags);
31472f75660SOphir Munk 	void (*dv_free_var)(struct mlx5dv_var *var);
31572f75660SOphir Munk 	struct mlx5dv_devx_uar *(*devx_alloc_uar)(struct ibv_context *context,
31672f75660SOphir Munk 						  uint32_t flags);
31772f75660SOphir Munk 	void (*devx_free_uar)(struct mlx5dv_devx_uar *devx_uar);
31872f75660SOphir Munk 	struct mlx5dv_devx_obj *(*devx_obj_create)
31972f75660SOphir Munk 					(struct ibv_context *ctx,
32072f75660SOphir Munk 					 const void *in, size_t inlen,
32172f75660SOphir Munk 					 void *out, size_t outlen);
32272f75660SOphir Munk 	int (*devx_obj_destroy)(struct mlx5dv_devx_obj *obj);
32372f75660SOphir Munk 	int (*devx_obj_query)(struct mlx5dv_devx_obj *obj,
32472f75660SOphir Munk 			      const void *in, size_t inlen,
32572f75660SOphir Munk 			      void *out, size_t outlen);
32672f75660SOphir Munk 	int (*devx_obj_modify)(struct mlx5dv_devx_obj *obj,
32772f75660SOphir Munk 			       const void *in, size_t inlen,
32872f75660SOphir Munk 			       void *out, size_t outlen);
32972f75660SOphir Munk 	int (*devx_general_cmd)(struct ibv_context *context,
33072f75660SOphir Munk 				const void *in, size_t inlen,
33172f75660SOphir Munk 				void *out, size_t outlen);
33272f75660SOphir Munk 	struct mlx5dv_devx_cmd_comp *(*devx_create_cmd_comp)
33372f75660SOphir Munk 					(struct ibv_context *context);
33472f75660SOphir Munk 	void (*devx_destroy_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp);
33572f75660SOphir Munk 	int (*devx_obj_query_async)(struct mlx5dv_devx_obj *obj,
33672f75660SOphir Munk 				    const void *in, size_t inlen,
33772f75660SOphir Munk 				    size_t outlen, uint64_t wr_id,
33872f75660SOphir Munk 				    struct mlx5dv_devx_cmd_comp *cmd_comp);
33972f75660SOphir Munk 	int (*devx_get_async_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp,
34072f75660SOphir Munk 				       struct mlx5dv_devx_async_cmd_hdr *resp,
34172f75660SOphir Munk 				       size_t cmd_resp_len);
34272f75660SOphir Munk 	struct mlx5dv_devx_umem *(*devx_umem_reg)(struct ibv_context *context,
34372f75660SOphir Munk 						  void *addr, size_t size,
34472f75660SOphir Munk 						  uint32_t access);
34572f75660SOphir Munk 	int (*devx_umem_dereg)(struct mlx5dv_devx_umem *dv_devx_umem);
34672f75660SOphir Munk 	int (*devx_qp_query)(struct ibv_qp *qp,
34772f75660SOphir Munk 			     const void *in, size_t inlen,
34872f75660SOphir Munk 			     void *out, size_t outlen);
34975a9a73dSMatan Azrad 	int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen,
35075a9a73dSMatan Azrad 			     void *out, size_t outlen);
35172f75660SOphir Munk 	int (*devx_port_query)(struct ibv_context *ctx,
35272f75660SOphir Munk 			       uint32_t port_num,
353d0cf77e8SViacheslav Ovsiienko 			       struct mlx5_port_info *info);
35472f75660SOphir Munk 	int (*dr_dump_domain)(FILE *file, void *domain);
355a38d22edSHaifei Luo 	int (*dr_dump_rule)(FILE *file, void *rule);
35672f75660SOphir Munk 	int (*devx_query_eqn)(struct ibv_context *context, uint32_t cpus,
35772f75660SOphir Munk 			      uint32_t *eqn);
35872f75660SOphir Munk 	struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
35972f75660SOphir Munk 				(struct ibv_context *context, int flags);
36072f75660SOphir Munk 	void (*devx_destroy_event_channel)
36172f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel);
36272f75660SOphir Munk 	int (*devx_subscribe_devx_event)
36372f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
36472f75660SOphir Munk 			 struct mlx5dv_devx_obj *obj,
36572f75660SOphir Munk 			 uint16_t events_sz,
36672f75660SOphir Munk 			 uint16_t events_num[],
36772f75660SOphir Munk 			 uint64_t cookie);
36872f75660SOphir Munk 	int (*devx_subscribe_devx_event_fd)
36972f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
37072f75660SOphir Munk 			 int fd,
37172f75660SOphir Munk 			 struct mlx5dv_devx_obj *obj,
37272f75660SOphir Munk 			 uint16_t event_num);
37372f75660SOphir Munk 	ssize_t (*devx_get_event)
37472f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
37572f75660SOphir Munk 			 struct mlx5dv_devx_async_event_hdr *event_data,
37672f75660SOphir Munk 			 size_t event_resp_len);
377bebee850SSuanming Mou 	void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable);
378e39226bdSJiawei Wang 	void (*dr_allow_duplicate_rules)(void *domain, uint32_t allow);
37979a7e409SViacheslav Ovsiienko 	struct mlx5dv_pp *(*dv_alloc_pp)(struct ibv_context *context,
38079a7e409SViacheslav Ovsiienko 					 size_t pp_context_sz,
38179a7e409SViacheslav Ovsiienko 					 const void *pp_context,
38279a7e409SViacheslav Ovsiienko 					 uint32_t flags);
38379a7e409SViacheslav Ovsiienko 	void (*dv_free_pp)(struct mlx5dv_pp *pp);
384a3def854SJiawei Wang 	void *(*dr_create_flow_action_sampler)
385a3def854SJiawei Wang 			(struct mlx5dv_dr_flow_sampler_attr *attr);
3864d23dd35SJiawei Wang 	void *(*dr_create_flow_action_dest_array)
3874d23dd35SJiawei Wang 			(void *domain,
3884d23dd35SJiawei Wang 			 size_t num_dest,
3894d23dd35SJiawei Wang 			 struct mlx5dv_dr_action_dest_attr *dests[]);
390a2999c7bSDekel Peled 	void *(*dv_create_flow_action_aso)
391a2999c7bSDekel Peled 			(struct mlx5dv_dr_domain *domain, void *aso_obj,
392a2999c7bSDekel Peled 			 uint32_t offset, uint32_t flags, uint8_t return_reg_c);
39380f998daSMichael Savisko 	void *(*dr_create_flow_action_send_to_kernel)(void *tbl,
39480f998daSMichael Savisko 						      uint16_t priority);
39572f75660SOphir Munk };
39672f75660SOphir Munk 
39772f75660SOphir Munk extern const struct mlx5_glue *mlx5_glue;
39872f75660SOphir Munk 
39972f75660SOphir Munk #endif /* MLX5_GLUE_H_ */
400