xref: /dpdk/drivers/common/mlx5/linux/mlx5_glue.h (revision e681eb0515ffa3f7ebfdc67d854f9e93c8d91f51)
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;
81*e681eb05SMatan 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)
94d0cf77e8SViacheslav Ovsiienko 
95d0cf77e8SViacheslav Ovsiienko struct mlx5_port_info {
96d0cf77e8SViacheslav Ovsiienko 	uint16_t query_flags;
97d0cf77e8SViacheslav Ovsiienko 	uint16_t vport_id; /* Associated VF vport index (if any). */
98d0cf77e8SViacheslav Ovsiienko 	uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
99d0cf77e8SViacheslav Ovsiienko 	uint32_t vport_meta_mask; /* Used for vport index field match mask. */
100d0cf77e8SViacheslav Ovsiienko };
101d0cf77e8SViacheslav Ovsiienko 
10272f75660SOphir Munk #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
10372f75660SOphir Munk struct mlx5dv_dr_flow_meter_attr;
10472f75660SOphir Munk #endif
10572f75660SOphir Munk 
106a3def854SJiawei Wang #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
107a3def854SJiawei Wang struct mlx5dv_dr_flow_sampler_attr {
108a3def854SJiawei Wang 	uint32_t sample_ratio;
109a3def854SJiawei Wang 	void *default_next_table;
110a3def854SJiawei Wang 	size_t num_sample_actions;
111a3def854SJiawei Wang 	struct mlx5dv_dr_action **sample_actions;
112a3def854SJiawei Wang 	uint64_t action;
113a3def854SJiawei Wang };
114a3def854SJiawei Wang #endif
115a3def854SJiawei Wang 
1164d23dd35SJiawei Wang #ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
1174d23dd35SJiawei Wang enum mlx5dv_dr_action_dest_type {
1184d23dd35SJiawei Wang 	MLX5DV_DR_ACTION_DEST,
1194d23dd35SJiawei Wang 	MLX5DV_DR_ACTION_DEST_REFORMAT,
1204d23dd35SJiawei Wang };
1214d23dd35SJiawei Wang struct mlx5dv_dr_action_dest_reformat {
1224d23dd35SJiawei Wang 	struct mlx5dv_dr_action *reformat;
1234d23dd35SJiawei Wang 	struct mlx5dv_dr_action *dest;
1244d23dd35SJiawei Wang };
1254d23dd35SJiawei Wang struct mlx5dv_dr_action_dest_attr {
1264d23dd35SJiawei Wang 	enum mlx5dv_dr_action_dest_type type;
1274d23dd35SJiawei Wang 	union {
1284d23dd35SJiawei Wang 		struct mlx5dv_dr_action *dest;
1294d23dd35SJiawei Wang 		struct mlx5dv_dr_action_dest_reformat *dest_reformat;
1304d23dd35SJiawei Wang 	};
1314d23dd35SJiawei Wang };
1324d23dd35SJiawei Wang #endif
1334d23dd35SJiawei Wang 
13472f75660SOphir Munk #ifndef HAVE_IBV_DEVX_EVENT
13572f75660SOphir Munk struct mlx5dv_devx_event_channel { int fd; };
13672f75660SOphir Munk struct mlx5dv_devx_async_event_hdr;
13772f75660SOphir Munk #define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA 1
13872f75660SOphir Munk #endif
13972f75660SOphir Munk 
14072f75660SOphir Munk #ifndef HAVE_IBV_VAR
14172f75660SOphir Munk struct mlx5dv_var { uint32_t page_id; uint32_t length; off_t mmap_off;
14272f75660SOphir Munk 			uint64_t comp_mask; };
14372f75660SOphir Munk #endif
14472f75660SOphir Munk 
14572f75660SOphir Munk #ifndef HAVE_IBV_RELAXED_ORDERING
14672f75660SOphir Munk #define IBV_ACCESS_RELAXED_ORDERING 0
14772f75660SOphir Munk #endif
14872f75660SOphir Munk 
14972f75660SOphir Munk struct mlx5_glue {
15072f75660SOphir Munk 	const char *version;
15172f75660SOphir Munk 	int (*fork_init)(void);
15272f75660SOphir Munk 	struct ibv_pd *(*alloc_pd)(struct ibv_context *context);
15372f75660SOphir Munk 	int (*dealloc_pd)(struct ibv_pd *pd);
15472f75660SOphir Munk 	struct ibv_device **(*get_device_list)(int *num_devices);
15572f75660SOphir Munk 	void (*free_device_list)(struct ibv_device **list);
15672f75660SOphir Munk 	struct ibv_context *(*open_device)(struct ibv_device *device);
15772f75660SOphir Munk 	int (*close_device)(struct ibv_context *context);
15872f75660SOphir Munk 	int (*query_device)(struct ibv_context *context,
15972f75660SOphir Munk 			    struct ibv_device_attr *device_attr);
16072f75660SOphir Munk 	int (*query_device_ex)(struct ibv_context *context,
16172f75660SOphir Munk 			       const struct ibv_query_device_ex_input *input,
16272f75660SOphir Munk 			       struct ibv_device_attr_ex *attr);
16372f75660SOphir Munk 	int (*query_rt_values_ex)(struct ibv_context *context,
16472f75660SOphir Munk 			       struct ibv_values_ex *values);
16572f75660SOphir Munk 	int (*query_port)(struct ibv_context *context, uint8_t port_num,
16672f75660SOphir Munk 			  struct ibv_port_attr *port_attr);
16772f75660SOphir Munk 	struct ibv_comp_channel *(*create_comp_channel)
16872f75660SOphir Munk 		(struct ibv_context *context);
16972f75660SOphir Munk 	int (*destroy_comp_channel)(struct ibv_comp_channel *channel);
17072f75660SOphir Munk 	struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe,
17172f75660SOphir Munk 				    void *cq_context,
17272f75660SOphir Munk 				    struct ibv_comp_channel *channel,
17372f75660SOphir Munk 				    int comp_vector);
17472f75660SOphir Munk 	int (*destroy_cq)(struct ibv_cq *cq);
17572f75660SOphir Munk 	int (*get_cq_event)(struct ibv_comp_channel *channel,
17672f75660SOphir Munk 			    struct ibv_cq **cq, void **cq_context);
17772f75660SOphir Munk 	void (*ack_cq_events)(struct ibv_cq *cq, unsigned int nevents);
17872f75660SOphir Munk 	struct ibv_rwq_ind_table *(*create_rwq_ind_table)
17972f75660SOphir Munk 		(struct ibv_context *context,
18072f75660SOphir Munk 		 struct ibv_rwq_ind_table_init_attr *init_attr);
18172f75660SOphir Munk 	int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
18272f75660SOphir Munk 	struct ibv_wq *(*create_wq)(struct ibv_context *context,
18372f75660SOphir Munk 				    struct ibv_wq_init_attr *wq_init_attr);
18472f75660SOphir Munk 	int (*destroy_wq)(struct ibv_wq *wq);
18572f75660SOphir Munk 	int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
18672f75660SOphir Munk 	struct ibv_flow *(*create_flow)(struct ibv_qp *qp,
18772f75660SOphir Munk 					struct ibv_flow_attr *flow);
18872f75660SOphir Munk 	int (*destroy_flow)(struct ibv_flow *flow_id);
18972f75660SOphir Munk 	int (*destroy_flow_action)(void *action);
19072f75660SOphir Munk 	struct ibv_qp *(*create_qp)(struct ibv_pd *pd,
19172f75660SOphir Munk 				    struct ibv_qp_init_attr *qp_init_attr);
19272f75660SOphir Munk 	struct ibv_qp *(*create_qp_ex)
19372f75660SOphir Munk 		(struct ibv_context *context,
19472f75660SOphir Munk 		 struct ibv_qp_init_attr_ex *qp_init_attr_ex);
19572f75660SOphir Munk 	int (*destroy_qp)(struct ibv_qp *qp);
19672f75660SOphir Munk 	int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
19772f75660SOphir Munk 			 int attr_mask);
19872f75660SOphir Munk 	struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr,
19972f75660SOphir Munk 				 size_t length, int access);
20072f75660SOphir Munk 	struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd);
20172f75660SOphir Munk 	int (*dereg_mr)(struct ibv_mr *mr);
20272f75660SOphir Munk 	struct ibv_counter_set *(*create_counter_set)
20372f75660SOphir Munk 		(struct ibv_context *context,
20472f75660SOphir Munk 		 struct ibv_counter_set_init_attr *init_attr);
20572f75660SOphir Munk 	int (*destroy_counter_set)(struct ibv_counter_set *cs);
20672f75660SOphir Munk 	int (*describe_counter_set)
20772f75660SOphir Munk 		(struct ibv_context *context,
20872f75660SOphir Munk 		 uint16_t counter_set_id,
20972f75660SOphir Munk 		 struct ibv_counter_set_description *cs_desc);
21072f75660SOphir Munk 	int (*query_counter_set)(struct ibv_query_counter_set_attr *query_attr,
21172f75660SOphir Munk 				 struct ibv_counter_set_data *cs_data);
21272f75660SOphir Munk 	struct ibv_counters *(*create_counters)
21372f75660SOphir Munk 		(struct ibv_context *context,
21472f75660SOphir Munk 		 struct ibv_counters_init_attr *init_attr);
21572f75660SOphir Munk 	int (*destroy_counters)(struct ibv_counters *counters);
21672f75660SOphir Munk 	int (*attach_counters)(struct ibv_counters *counters,
21772f75660SOphir Munk 			       struct ibv_counter_attach_attr *attr,
21872f75660SOphir Munk 			       struct ibv_flow *flow);
21972f75660SOphir Munk 	int (*query_counters)(struct ibv_counters *counters,
22072f75660SOphir Munk 			      uint64_t *counters_value,
22172f75660SOphir Munk 			      uint32_t ncounters,
22272f75660SOphir Munk 			      uint32_t flags);
22372f75660SOphir Munk 	void (*ack_async_event)(struct ibv_async_event *event);
22472f75660SOphir Munk 	int (*get_async_event)(struct ibv_context *context,
22572f75660SOphir Munk 			       struct ibv_async_event *event);
22672f75660SOphir Munk 	const char *(*port_state_str)(enum ibv_port_state port_state);
22772f75660SOphir Munk 	struct ibv_cq *(*cq_ex_to_cq)(struct ibv_cq_ex *cq);
22872f75660SOphir Munk 	void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl);
22972f75660SOphir Munk 	void *(*dr_create_flow_action_dest_port)(void *domain,
23072f75660SOphir Munk 						 uint32_t port);
2314c093ffaSParav Pandit 	void *(*dr_create_flow_action_drop)(void);
23272f75660SOphir Munk 	void *(*dr_create_flow_action_push_vlan)
23372f75660SOphir Munk 					(struct mlx5dv_dr_domain *domain,
23472f75660SOphir Munk 					 rte_be32_t vlan_tag);
2354c093ffaSParav Pandit 	void *(*dr_create_flow_action_pop_vlan)(void);
23672f75660SOphir Munk 	void *(*dr_create_flow_tbl)(void *domain, uint32_t level);
23772f75660SOphir Munk 	int (*dr_destroy_flow_tbl)(void *tbl);
23872f75660SOphir Munk 	void *(*dr_create_domain)(struct ibv_context *ctx,
23972f75660SOphir Munk 				  enum mlx5dv_dr_domain_type domain);
24072f75660SOphir Munk 	int (*dr_destroy_domain)(void *domain);
2416e0cd74aSBing Zhao 	int (*dr_sync_domain)(void *domain, uint32_t flags);
24272f75660SOphir Munk 	struct ibv_cq_ex *(*dv_create_cq)
24372f75660SOphir Munk 		(struct ibv_context *context,
24472f75660SOphir Munk 		 struct ibv_cq_init_attr_ex *cq_attr,
24572f75660SOphir Munk 		 struct mlx5dv_cq_init_attr *mlx5_cq_attr);
24672f75660SOphir Munk 	struct ibv_wq *(*dv_create_wq)
24772f75660SOphir Munk 		(struct ibv_context *context,
24872f75660SOphir Munk 		 struct ibv_wq_init_attr *wq_attr,
24972f75660SOphir Munk 		 struct mlx5dv_wq_init_attr *mlx5_wq_attr);
25072f75660SOphir Munk 	int (*dv_query_device)(struct ibv_context *ctx_in,
25172f75660SOphir Munk 			       struct mlx5dv_context *attrs_out);
25272f75660SOphir Munk 	int (*dv_set_context_attr)(struct ibv_context *ibv_ctx,
25372f75660SOphir Munk 				   enum mlx5dv_set_ctx_attr_type type,
25472f75660SOphir Munk 				   void *attr);
25572f75660SOphir Munk 	int (*dv_init_obj)(struct mlx5dv_obj *obj, uint64_t obj_type);
25672f75660SOphir Munk 	struct ibv_qp *(*dv_create_qp)
25772f75660SOphir Munk 		(struct ibv_context *context,
25872f75660SOphir Munk 		 struct ibv_qp_init_attr_ex *qp_init_attr_ex,
25972f75660SOphir Munk 		 struct mlx5dv_qp_init_attr *dv_qp_init_attr);
26072f75660SOphir Munk 	void *(*dv_create_flow_matcher)
26172f75660SOphir Munk 		(struct ibv_context *context,
26272f75660SOphir Munk 		 struct mlx5dv_flow_matcher_attr *matcher_attr,
26372f75660SOphir Munk 		 void *tbl);
26472f75660SOphir Munk 	void *(*dv_create_flow)(void *matcher, void *match_value,
26572f75660SOphir Munk 			  size_t num_actions, void *actions[]);
26672f75660SOphir Munk 	void *(*dv_create_flow_action_counter)(void *obj, uint32_t  offset);
26772f75660SOphir Munk 	void *(*dv_create_flow_action_dest_ibv_qp)(void *qp);
26872f75660SOphir Munk 	void *(*dv_create_flow_action_dest_devx_tir)(void *tir);
26972f75660SOphir Munk 	void *(*dv_create_flow_action_modify_header)
27072f75660SOphir Munk 		(struct ibv_context *ctx, enum mlx5dv_flow_table_type ft_type,
27172f75660SOphir Munk 		 void *domain, uint64_t flags, size_t actions_sz,
27272f75660SOphir Munk 		 uint64_t actions[]);
27372f75660SOphir Munk 	void *(*dv_create_flow_action_packet_reformat)
27472f75660SOphir Munk 		(struct ibv_context *ctx,
27572f75660SOphir Munk 		 enum mlx5dv_flow_action_packet_reformat_type reformat_type,
27672f75660SOphir Munk 		 enum mlx5dv_flow_table_type ft_type,
27772f75660SOphir Munk 		 struct mlx5dv_dr_domain *domain,
27872f75660SOphir Munk 		 uint32_t flags, size_t data_sz, void *data);
27972f75660SOphir Munk 	void *(*dv_create_flow_action_tag)(uint32_t tag);
28072f75660SOphir Munk 	void *(*dv_create_flow_action_meter)
28172f75660SOphir Munk 		(struct mlx5dv_dr_flow_meter_attr *attr);
28272f75660SOphir Munk 	int (*dv_modify_flow_action_meter)(void *action,
28372f75660SOphir Munk 		struct mlx5dv_dr_flow_meter_attr *attr, uint64_t modify_bits);
284d4d85aa6SShiri Kuzin 	void *(*dr_create_flow_action_default_miss)(void);
28572f75660SOphir Munk 	int (*dv_destroy_flow)(void *flow);
28672f75660SOphir Munk 	int (*dv_destroy_flow_matcher)(void *matcher);
28772f75660SOphir Munk 	struct ibv_context *(*dv_open_device)(struct ibv_device *device);
28872f75660SOphir Munk 	struct mlx5dv_var *(*dv_alloc_var)(struct ibv_context *context,
28972f75660SOphir Munk 					   uint32_t flags);
29072f75660SOphir Munk 	void (*dv_free_var)(struct mlx5dv_var *var);
29172f75660SOphir Munk 	struct mlx5dv_devx_uar *(*devx_alloc_uar)(struct ibv_context *context,
29272f75660SOphir Munk 						  uint32_t flags);
29372f75660SOphir Munk 	void (*devx_free_uar)(struct mlx5dv_devx_uar *devx_uar);
29472f75660SOphir Munk 	struct mlx5dv_devx_obj *(*devx_obj_create)
29572f75660SOphir Munk 					(struct ibv_context *ctx,
29672f75660SOphir Munk 					 const void *in, size_t inlen,
29772f75660SOphir Munk 					 void *out, size_t outlen);
29872f75660SOphir Munk 	int (*devx_obj_destroy)(struct mlx5dv_devx_obj *obj);
29972f75660SOphir Munk 	int (*devx_obj_query)(struct mlx5dv_devx_obj *obj,
30072f75660SOphir Munk 			      const void *in, size_t inlen,
30172f75660SOphir Munk 			      void *out, size_t outlen);
30272f75660SOphir Munk 	int (*devx_obj_modify)(struct mlx5dv_devx_obj *obj,
30372f75660SOphir Munk 			       const void *in, size_t inlen,
30472f75660SOphir Munk 			       void *out, size_t outlen);
30572f75660SOphir Munk 	int (*devx_general_cmd)(struct ibv_context *context,
30672f75660SOphir Munk 				const void *in, size_t inlen,
30772f75660SOphir Munk 				void *out, size_t outlen);
30872f75660SOphir Munk 	struct mlx5dv_devx_cmd_comp *(*devx_create_cmd_comp)
30972f75660SOphir Munk 					(struct ibv_context *context);
31072f75660SOphir Munk 	void (*devx_destroy_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp);
31172f75660SOphir Munk 	int (*devx_obj_query_async)(struct mlx5dv_devx_obj *obj,
31272f75660SOphir Munk 				    const void *in, size_t inlen,
31372f75660SOphir Munk 				    size_t outlen, uint64_t wr_id,
31472f75660SOphir Munk 				    struct mlx5dv_devx_cmd_comp *cmd_comp);
31572f75660SOphir Munk 	int (*devx_get_async_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp,
31672f75660SOphir Munk 				       struct mlx5dv_devx_async_cmd_hdr *resp,
31772f75660SOphir Munk 				       size_t cmd_resp_len);
31872f75660SOphir Munk 	struct mlx5dv_devx_umem *(*devx_umem_reg)(struct ibv_context *context,
31972f75660SOphir Munk 						  void *addr, size_t size,
32072f75660SOphir Munk 						  uint32_t access);
32172f75660SOphir Munk 	int (*devx_umem_dereg)(struct mlx5dv_devx_umem *dv_devx_umem);
32272f75660SOphir Munk 	int (*devx_qp_query)(struct ibv_qp *qp,
32372f75660SOphir Munk 			     const void *in, size_t inlen,
32472f75660SOphir Munk 			     void *out, size_t outlen);
32575a9a73dSMatan Azrad 	int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen,
32675a9a73dSMatan Azrad 			     void *out, size_t outlen);
32772f75660SOphir Munk 	int (*devx_port_query)(struct ibv_context *ctx,
32872f75660SOphir Munk 			       uint32_t port_num,
329d0cf77e8SViacheslav Ovsiienko 			       struct mlx5_port_info *info);
33072f75660SOphir Munk 	int (*dr_dump_domain)(FILE *file, void *domain);
331a38d22edSHaifei Luo 	int (*dr_dump_rule)(FILE *file, void *rule);
33272f75660SOphir Munk 	int (*devx_query_eqn)(struct ibv_context *context, uint32_t cpus,
33372f75660SOphir Munk 			      uint32_t *eqn);
33472f75660SOphir Munk 	struct mlx5dv_devx_event_channel *(*devx_create_event_channel)
33572f75660SOphir Munk 				(struct ibv_context *context, int flags);
33672f75660SOphir Munk 	void (*devx_destroy_event_channel)
33772f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel);
33872f75660SOphir Munk 	int (*devx_subscribe_devx_event)
33972f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
34072f75660SOphir Munk 			 struct mlx5dv_devx_obj *obj,
34172f75660SOphir Munk 			 uint16_t events_sz,
34272f75660SOphir Munk 			 uint16_t events_num[],
34372f75660SOphir Munk 			 uint64_t cookie);
34472f75660SOphir Munk 	int (*devx_subscribe_devx_event_fd)
34572f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
34672f75660SOphir Munk 			 int fd,
34772f75660SOphir Munk 			 struct mlx5dv_devx_obj *obj,
34872f75660SOphir Munk 			 uint16_t event_num);
34972f75660SOphir Munk 	ssize_t (*devx_get_event)
35072f75660SOphir Munk 			(struct mlx5dv_devx_event_channel *event_channel,
35172f75660SOphir Munk 			 struct mlx5dv_devx_async_event_hdr *event_data,
35272f75660SOphir Munk 			 size_t event_resp_len);
353bebee850SSuanming Mou 	void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable);
354e39226bdSJiawei Wang 	void (*dr_allow_duplicate_rules)(void *domain, uint32_t allow);
35579a7e409SViacheslav Ovsiienko 	struct mlx5dv_pp *(*dv_alloc_pp)(struct ibv_context *context,
35679a7e409SViacheslav Ovsiienko 					 size_t pp_context_sz,
35779a7e409SViacheslav Ovsiienko 					 const void *pp_context,
35879a7e409SViacheslav Ovsiienko 					 uint32_t flags);
35979a7e409SViacheslav Ovsiienko 	void (*dv_free_pp)(struct mlx5dv_pp *pp);
360a3def854SJiawei Wang 	void *(*dr_create_flow_action_sampler)
361a3def854SJiawei Wang 			(struct mlx5dv_dr_flow_sampler_attr *attr);
3624d23dd35SJiawei Wang 	void *(*dr_create_flow_action_dest_array)
3634d23dd35SJiawei Wang 			(void *domain,
3644d23dd35SJiawei Wang 			 size_t num_dest,
3654d23dd35SJiawei Wang 			 struct mlx5dv_dr_action_dest_attr *dests[]);
366a2999c7bSDekel Peled 	void *(*dv_create_flow_action_aso)
367a2999c7bSDekel Peled 			(struct mlx5dv_dr_domain *domain, void *aso_obj,
368a2999c7bSDekel Peled 			 uint32_t offset, uint32_t flags, uint8_t return_reg_c);
36972f75660SOphir Munk };
37072f75660SOphir Munk 
37172f75660SOphir Munk extern const struct mlx5_glue *mlx5_glue;
37272f75660SOphir Munk 
37372f75660SOphir Munk #endif /* MLX5_GLUE_H_ */
374