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) 94dfceca7eSAlex 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). */ 99dfceca7eSAlex 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 151*be8476ddSHamdan Igbaria #ifndef HAVE_MLX5DV_CREATE_STEERING_ANCHOR 152*be8476ddSHamdan Igbaria struct mlx5dv_steering_anchor_attr { 153*be8476ddSHamdan Igbaria uint32_t ft_type; 154*be8476ddSHamdan Igbaria uint16_t priority; 155*be8476ddSHamdan Igbaria uint64_t comp_mask; 156*be8476ddSHamdan Igbaria }; 157*be8476ddSHamdan Igbaria 158*be8476ddSHamdan Igbaria struct mlx5dv_steering_anchor { 159*be8476ddSHamdan Igbaria uint32_t id; 160*be8476ddSHamdan Igbaria }; 161*be8476ddSHamdan Igbaria #endif 162*be8476ddSHamdan Igbaria 16372f75660SOphir Munk struct mlx5_glue { 16472f75660SOphir Munk const char *version; 16572f75660SOphir Munk int (*fork_init)(void); 16672f75660SOphir Munk struct ibv_pd *(*alloc_pd)(struct ibv_context *context); 16772f75660SOphir Munk int (*dealloc_pd)(struct ibv_pd *pd); 1680777921aSMichael Baum struct ibv_pd *(*import_pd)(struct ibv_context *context, 1690777921aSMichael Baum uint32_t pd_handle); 1700777921aSMichael Baum int (*unimport_pd)(struct ibv_pd *pd); 17172f75660SOphir Munk struct ibv_device **(*get_device_list)(int *num_devices); 17272f75660SOphir Munk void (*free_device_list)(struct ibv_device **list); 17372f75660SOphir Munk struct ibv_context *(*open_device)(struct ibv_device *device); 1740777921aSMichael Baum struct ibv_context *(*import_device)(int cmd_fd); 17572f75660SOphir Munk int (*close_device)(struct ibv_context *context); 17672f75660SOphir Munk int (*query_device)(struct ibv_context *context, 17772f75660SOphir Munk struct ibv_device_attr *device_attr); 17872f75660SOphir Munk int (*query_device_ex)(struct ibv_context *context, 17972f75660SOphir Munk const struct ibv_query_device_ex_input *input, 18072f75660SOphir Munk struct ibv_device_attr_ex *attr); 181dfceca7eSAlex Vesker const char *(*get_device_name)(struct ibv_device *device); 18272f75660SOphir Munk int (*query_rt_values_ex)(struct ibv_context *context, 18372f75660SOphir Munk struct ibv_values_ex *values); 18472f75660SOphir Munk int (*query_port)(struct ibv_context *context, uint8_t port_num, 18572f75660SOphir Munk struct ibv_port_attr *port_attr); 18672f75660SOphir Munk struct ibv_comp_channel *(*create_comp_channel) 18772f75660SOphir Munk (struct ibv_context *context); 18872f75660SOphir Munk int (*destroy_comp_channel)(struct ibv_comp_channel *channel); 18972f75660SOphir Munk struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe, 19072f75660SOphir Munk void *cq_context, 19172f75660SOphir Munk struct ibv_comp_channel *channel, 19272f75660SOphir Munk int comp_vector); 19372f75660SOphir Munk int (*destroy_cq)(struct ibv_cq *cq); 19472f75660SOphir Munk int (*get_cq_event)(struct ibv_comp_channel *channel, 19572f75660SOphir Munk struct ibv_cq **cq, void **cq_context); 19672f75660SOphir Munk void (*ack_cq_events)(struct ibv_cq *cq, unsigned int nevents); 19772f75660SOphir Munk struct ibv_rwq_ind_table *(*create_rwq_ind_table) 19872f75660SOphir Munk (struct ibv_context *context, 19972f75660SOphir Munk struct ibv_rwq_ind_table_init_attr *init_attr); 20072f75660SOphir Munk int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table); 20172f75660SOphir Munk struct ibv_wq *(*create_wq)(struct ibv_context *context, 20272f75660SOphir Munk struct ibv_wq_init_attr *wq_init_attr); 20372f75660SOphir Munk int (*destroy_wq)(struct ibv_wq *wq); 20472f75660SOphir Munk int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr); 20572f75660SOphir Munk struct ibv_flow *(*create_flow)(struct ibv_qp *qp, 20672f75660SOphir Munk struct ibv_flow_attr *flow); 20772f75660SOphir Munk int (*destroy_flow)(struct ibv_flow *flow_id); 20872f75660SOphir Munk int (*destroy_flow_action)(void *action); 20972f75660SOphir Munk struct ibv_qp *(*create_qp)(struct ibv_pd *pd, 21072f75660SOphir Munk struct ibv_qp_init_attr *qp_init_attr); 21172f75660SOphir Munk struct ibv_qp *(*create_qp_ex) 21272f75660SOphir Munk (struct ibv_context *context, 21372f75660SOphir Munk struct ibv_qp_init_attr_ex *qp_init_attr_ex); 21472f75660SOphir Munk int (*destroy_qp)(struct ibv_qp *qp); 21572f75660SOphir Munk int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr, 21672f75660SOphir Munk int attr_mask); 21772f75660SOphir Munk struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr, 21872f75660SOphir Munk size_t length, int access); 2196ebd062eSMichael Baum struct ibv_mr *(*reg_mr_iova)(struct ibv_pd *pd, void *addr, 2206ebd062eSMichael Baum size_t length, uint64_t iova, 2216ebd062eSMichael Baum int access); 22272f75660SOphir Munk struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd); 22372f75660SOphir Munk int (*dereg_mr)(struct ibv_mr *mr); 22472f75660SOphir Munk struct ibv_counter_set *(*create_counter_set) 22572f75660SOphir Munk (struct ibv_context *context, 22672f75660SOphir Munk struct ibv_counter_set_init_attr *init_attr); 22772f75660SOphir Munk int (*destroy_counter_set)(struct ibv_counter_set *cs); 22872f75660SOphir Munk int (*describe_counter_set) 22972f75660SOphir Munk (struct ibv_context *context, 23072f75660SOphir Munk uint16_t counter_set_id, 23172f75660SOphir Munk struct ibv_counter_set_description *cs_desc); 23272f75660SOphir Munk int (*query_counter_set)(struct ibv_query_counter_set_attr *query_attr, 23372f75660SOphir Munk struct ibv_counter_set_data *cs_data); 23472f75660SOphir Munk struct ibv_counters *(*create_counters) 23572f75660SOphir Munk (struct ibv_context *context, 23672f75660SOphir Munk struct ibv_counters_init_attr *init_attr); 23772f75660SOphir Munk int (*destroy_counters)(struct ibv_counters *counters); 23872f75660SOphir Munk int (*attach_counters)(struct ibv_counters *counters, 23972f75660SOphir Munk struct ibv_counter_attach_attr *attr, 24072f75660SOphir Munk struct ibv_flow *flow); 24172f75660SOphir Munk int (*query_counters)(struct ibv_counters *counters, 24272f75660SOphir Munk uint64_t *counters_value, 24372f75660SOphir Munk uint32_t ncounters, 24472f75660SOphir Munk uint32_t flags); 24572f75660SOphir Munk void (*ack_async_event)(struct ibv_async_event *event); 24672f75660SOphir Munk int (*get_async_event)(struct ibv_context *context, 24772f75660SOphir Munk struct ibv_async_event *event); 24872f75660SOphir Munk const char *(*port_state_str)(enum ibv_port_state port_state); 24972f75660SOphir Munk struct ibv_cq *(*cq_ex_to_cq)(struct ibv_cq_ex *cq); 25072f75660SOphir Munk void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl); 25172f75660SOphir Munk void *(*dr_create_flow_action_dest_port)(void *domain, 25272f75660SOphir Munk uint32_t port); 2534c093ffaSParav Pandit void *(*dr_create_flow_action_drop)(void); 25472f75660SOphir Munk void *(*dr_create_flow_action_push_vlan) 25572f75660SOphir Munk (struct mlx5dv_dr_domain *domain, 25672f75660SOphir Munk rte_be32_t vlan_tag); 2574c093ffaSParav Pandit void *(*dr_create_flow_action_pop_vlan)(void); 25872f75660SOphir Munk void *(*dr_create_flow_tbl)(void *domain, uint32_t level); 25972f75660SOphir Munk int (*dr_destroy_flow_tbl)(void *tbl); 26072f75660SOphir Munk void *(*dr_create_domain)(struct ibv_context *ctx, 26172f75660SOphir Munk enum mlx5dv_dr_domain_type domain); 26272f75660SOphir Munk int (*dr_destroy_domain)(void *domain); 2636e0cd74aSBing Zhao int (*dr_sync_domain)(void *domain, uint32_t flags); 26472f75660SOphir Munk struct ibv_cq_ex *(*dv_create_cq) 26572f75660SOphir Munk (struct ibv_context *context, 26672f75660SOphir Munk struct ibv_cq_init_attr_ex *cq_attr, 26772f75660SOphir Munk struct mlx5dv_cq_init_attr *mlx5_cq_attr); 26872f75660SOphir Munk struct ibv_wq *(*dv_create_wq) 26972f75660SOphir Munk (struct ibv_context *context, 27072f75660SOphir Munk struct ibv_wq_init_attr *wq_attr, 27172f75660SOphir Munk struct mlx5dv_wq_init_attr *mlx5_wq_attr); 27272f75660SOphir Munk int (*dv_query_device)(struct ibv_context *ctx_in, 27372f75660SOphir Munk struct mlx5dv_context *attrs_out); 27472f75660SOphir Munk int (*dv_set_context_attr)(struct ibv_context *ibv_ctx, 27572f75660SOphir Munk enum mlx5dv_set_ctx_attr_type type, 27672f75660SOphir Munk void *attr); 27772f75660SOphir Munk int (*dv_init_obj)(struct mlx5dv_obj *obj, uint64_t obj_type); 27872f75660SOphir Munk struct ibv_qp *(*dv_create_qp) 27972f75660SOphir Munk (struct ibv_context *context, 28072f75660SOphir Munk struct ibv_qp_init_attr_ex *qp_init_attr_ex, 28172f75660SOphir Munk struct mlx5dv_qp_init_attr *dv_qp_init_attr); 28272f75660SOphir Munk void *(*dv_create_flow_matcher) 28372f75660SOphir Munk (struct ibv_context *context, 28472f75660SOphir Munk struct mlx5dv_flow_matcher_attr *matcher_attr, 28572f75660SOphir Munk void *tbl); 286dfceca7eSAlex Vesker void *(*dv_create_flow_matcher_root) 287dfceca7eSAlex Vesker (struct ibv_context *context, 288dfceca7eSAlex Vesker struct mlx5dv_flow_matcher_attr *matcher_attr); 28972f75660SOphir Munk void *(*dv_create_flow)(void *matcher, void *match_value, 29072f75660SOphir Munk size_t num_actions, void *actions[]); 291dfceca7eSAlex Vesker void *(*dv_create_flow_root)(void *matcher, void *match_value, 292dfceca7eSAlex Vesker size_t num_actions, void *actions); 29372f75660SOphir Munk void *(*dv_create_flow_action_counter)(void *obj, uint32_t offset); 29472f75660SOphir Munk void *(*dv_create_flow_action_dest_ibv_qp)(void *qp); 29572f75660SOphir Munk void *(*dv_create_flow_action_dest_devx_tir)(void *tir); 29672f75660SOphir Munk void *(*dv_create_flow_action_modify_header) 29772f75660SOphir Munk (struct ibv_context *ctx, enum mlx5dv_flow_table_type ft_type, 29872f75660SOphir Munk void *domain, uint64_t flags, size_t actions_sz, 29972f75660SOphir Munk uint64_t actions[]); 300dfceca7eSAlex Vesker void *(*dv_create_flow_action_modify_header_root) 301dfceca7eSAlex Vesker (struct ibv_context *ctx, size_t actions_sz, uint64_t actions[], 302dfceca7eSAlex Vesker enum mlx5dv_flow_table_type ft_type); 30372f75660SOphir Munk void *(*dv_create_flow_action_packet_reformat) 30472f75660SOphir Munk (struct ibv_context *ctx, 30572f75660SOphir Munk enum mlx5dv_flow_action_packet_reformat_type reformat_type, 30672f75660SOphir Munk enum mlx5dv_flow_table_type ft_type, 30772f75660SOphir Munk struct mlx5dv_dr_domain *domain, 30872f75660SOphir Munk uint32_t flags, size_t data_sz, void *data); 309dfceca7eSAlex Vesker void *(*dv_create_flow_action_packet_reformat_root) 310dfceca7eSAlex Vesker (struct ibv_context *ctx, 311dfceca7eSAlex Vesker size_t data_sz, void *data, 312dfceca7eSAlex Vesker enum mlx5dv_flow_action_packet_reformat_type reformat_type, 313dfceca7eSAlex Vesker enum mlx5dv_flow_table_type ft_type); 31472f75660SOphir Munk void *(*dv_create_flow_action_tag)(uint32_t tag); 31572f75660SOphir Munk void *(*dv_create_flow_action_meter) 31672f75660SOphir Munk (struct mlx5dv_dr_flow_meter_attr *attr); 31772f75660SOphir Munk int (*dv_modify_flow_action_meter)(void *action, 31872f75660SOphir Munk struct mlx5dv_dr_flow_meter_attr *attr, uint64_t modify_bits); 319d4d85aa6SShiri Kuzin void *(*dr_create_flow_action_default_miss)(void); 32072f75660SOphir Munk int (*dv_destroy_flow)(void *flow); 32172f75660SOphir Munk int (*dv_destroy_flow_matcher)(void *matcher); 322dfceca7eSAlex Vesker int (*dv_destroy_flow_matcher_root)(void *matcher); 32372f75660SOphir Munk struct ibv_context *(*dv_open_device)(struct ibv_device *device); 32472f75660SOphir Munk struct mlx5dv_var *(*dv_alloc_var)(struct ibv_context *context, 32572f75660SOphir Munk uint32_t flags); 32672f75660SOphir Munk void (*dv_free_var)(struct mlx5dv_var *var); 32772f75660SOphir Munk struct mlx5dv_devx_uar *(*devx_alloc_uar)(struct ibv_context *context, 32872f75660SOphir Munk uint32_t flags); 32972f75660SOphir Munk void (*devx_free_uar)(struct mlx5dv_devx_uar *devx_uar); 33072f75660SOphir Munk struct mlx5dv_devx_obj *(*devx_obj_create) 33172f75660SOphir Munk (struct ibv_context *ctx, 33272f75660SOphir Munk const void *in, size_t inlen, 33372f75660SOphir Munk void *out, size_t outlen); 33472f75660SOphir Munk int (*devx_obj_destroy)(struct mlx5dv_devx_obj *obj); 33572f75660SOphir Munk int (*devx_obj_query)(struct mlx5dv_devx_obj *obj, 33672f75660SOphir Munk const void *in, size_t inlen, 33772f75660SOphir Munk void *out, size_t outlen); 33872f75660SOphir Munk int (*devx_obj_modify)(struct mlx5dv_devx_obj *obj, 33972f75660SOphir Munk const void *in, size_t inlen, 34072f75660SOphir Munk void *out, size_t outlen); 34172f75660SOphir Munk int (*devx_general_cmd)(struct ibv_context *context, 34272f75660SOphir Munk const void *in, size_t inlen, 34372f75660SOphir Munk void *out, size_t outlen); 34472f75660SOphir Munk struct mlx5dv_devx_cmd_comp *(*devx_create_cmd_comp) 34572f75660SOphir Munk (struct ibv_context *context); 34672f75660SOphir Munk void (*devx_destroy_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp); 34772f75660SOphir Munk int (*devx_obj_query_async)(struct mlx5dv_devx_obj *obj, 34872f75660SOphir Munk const void *in, size_t inlen, 34972f75660SOphir Munk size_t outlen, uint64_t wr_id, 35072f75660SOphir Munk struct mlx5dv_devx_cmd_comp *cmd_comp); 35172f75660SOphir Munk int (*devx_get_async_cmd_comp)(struct mlx5dv_devx_cmd_comp *cmd_comp, 35272f75660SOphir Munk struct mlx5dv_devx_async_cmd_hdr *resp, 35372f75660SOphir Munk size_t cmd_resp_len); 35472f75660SOphir Munk struct mlx5dv_devx_umem *(*devx_umem_reg)(struct ibv_context *context, 35572f75660SOphir Munk void *addr, size_t size, 35672f75660SOphir Munk uint32_t access); 35772f75660SOphir Munk int (*devx_umem_dereg)(struct mlx5dv_devx_umem *dv_devx_umem); 35872f75660SOphir Munk int (*devx_qp_query)(struct ibv_qp *qp, 35972f75660SOphir Munk const void *in, size_t inlen, 36072f75660SOphir Munk void *out, size_t outlen); 36175a9a73dSMatan Azrad int (*devx_wq_query)(struct ibv_wq *wq, const void *in, size_t inlen, 36275a9a73dSMatan Azrad void *out, size_t outlen); 36372f75660SOphir Munk int (*devx_port_query)(struct ibv_context *ctx, 36472f75660SOphir Munk uint32_t port_num, 365d0cf77e8SViacheslav Ovsiienko struct mlx5_port_info *info); 36672f75660SOphir Munk int (*dr_dump_domain)(FILE *file, void *domain); 367a38d22edSHaifei Luo int (*dr_dump_rule)(FILE *file, void *rule); 36872f75660SOphir Munk int (*devx_query_eqn)(struct ibv_context *context, uint32_t cpus, 36972f75660SOphir Munk uint32_t *eqn); 37072f75660SOphir Munk struct mlx5dv_devx_event_channel *(*devx_create_event_channel) 37172f75660SOphir Munk (struct ibv_context *context, int flags); 37272f75660SOphir Munk void (*devx_destroy_event_channel) 37372f75660SOphir Munk (struct mlx5dv_devx_event_channel *event_channel); 37472f75660SOphir Munk int (*devx_subscribe_devx_event) 37572f75660SOphir Munk (struct mlx5dv_devx_event_channel *event_channel, 37672f75660SOphir Munk struct mlx5dv_devx_obj *obj, 37772f75660SOphir Munk uint16_t events_sz, 37872f75660SOphir Munk uint16_t events_num[], 37972f75660SOphir Munk uint64_t cookie); 38072f75660SOphir Munk int (*devx_subscribe_devx_event_fd) 38172f75660SOphir Munk (struct mlx5dv_devx_event_channel *event_channel, 38272f75660SOphir Munk int fd, 38372f75660SOphir Munk struct mlx5dv_devx_obj *obj, 38472f75660SOphir Munk uint16_t event_num); 38572f75660SOphir Munk ssize_t (*devx_get_event) 38672f75660SOphir Munk (struct mlx5dv_devx_event_channel *event_channel, 38772f75660SOphir Munk struct mlx5dv_devx_async_event_hdr *event_data, 38872f75660SOphir Munk size_t event_resp_len); 389bebee850SSuanming Mou void (*dr_reclaim_domain_memory)(void *domain, uint32_t enable); 390e39226bdSJiawei Wang void (*dr_allow_duplicate_rules)(void *domain, uint32_t allow); 39179a7e409SViacheslav Ovsiienko struct mlx5dv_pp *(*dv_alloc_pp)(struct ibv_context *context, 39279a7e409SViacheslav Ovsiienko size_t pp_context_sz, 39379a7e409SViacheslav Ovsiienko const void *pp_context, 39479a7e409SViacheslav Ovsiienko uint32_t flags); 39579a7e409SViacheslav Ovsiienko void (*dv_free_pp)(struct mlx5dv_pp *pp); 396a3def854SJiawei Wang void *(*dr_create_flow_action_sampler) 397a3def854SJiawei Wang (struct mlx5dv_dr_flow_sampler_attr *attr); 3984d23dd35SJiawei Wang void *(*dr_create_flow_action_dest_array) 3994d23dd35SJiawei Wang (void *domain, 4004d23dd35SJiawei Wang size_t num_dest, 4014d23dd35SJiawei Wang struct mlx5dv_dr_action_dest_attr *dests[]); 402a2999c7bSDekel Peled void *(*dv_create_flow_action_aso) 403a2999c7bSDekel Peled (struct mlx5dv_dr_domain *domain, void *aso_obj, 404a2999c7bSDekel Peled uint32_t offset, uint32_t flags, uint8_t return_reg_c); 40580f998daSMichael Savisko void *(*dr_create_flow_action_send_to_kernel)(void *tbl, 40680f998daSMichael Savisko uint16_t priority); 407*be8476ddSHamdan Igbaria struct mlx5dv_steering_anchor *(*create_steering_anchor) 408*be8476ddSHamdan Igbaria (struct ibv_context *context, 409*be8476ddSHamdan Igbaria struct mlx5dv_steering_anchor_attr *attr); 410*be8476ddSHamdan Igbaria int (*destroy_steering_anchor)(struct mlx5dv_steering_anchor *sa); 41172f75660SOphir Munk }; 41272f75660SOphir Munk 41372f75660SOphir Munk extern const struct mlx5_glue *mlx5_glue; 41472f75660SOphir Munk 41572f75660SOphir Munk #endif /* MLX5_GLUE_H_ */ 416