1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018 6WIND S.A.
3 * Copyright 2018 Mellanox Technologies, Ltd
12 /* Verbs headers do not support -pedantic. */
14 #pragma GCC diagnostic ignored "-Wpedantic"
16 #include <infiniband/mlx4dv.h>
17 #include <infiniband/verbs.h>
19 #pragma GCC diagnostic error "-Wpedantic"
22 #ifndef MLX4_GLUE_VERSION
23 #define MLX4_GLUE_VERSION ""
26 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
29 int (*fork_init)(void);
30 int (*get_async_event)(struct ibv_context *context,
31 struct ibv_async_event *event);
32 void (*ack_async_event)(struct ibv_async_event *event);
33 struct ibv_pd *(*alloc_pd)(struct ibv_context *context);
34 int (*dealloc_pd)(struct ibv_pd *pd);
35 struct ibv_device **(*get_device_list)(int *num_devices);
36 void (*free_device_list)(struct ibv_device **list);
37 struct ibv_context *(*open_device)(struct ibv_device *device);
38 int (*close_device)(struct ibv_context *context);
39 const char *(*get_device_name)(struct ibv_device *device);
40 int (*query_device)(struct ibv_context *context,
41 struct ibv_device_attr *device_attr);
42 int (*query_device_ex)(struct ibv_context *context,
43 const struct ibv_query_device_ex_input *input,
44 struct ibv_device_attr_ex *attr);
45 int (*query_port)(struct ibv_context *context, uint8_t port_num,
46 struct ibv_port_attr *port_attr);
47 const char *(*port_state_str)(enum ibv_port_state port_state);
48 struct ibv_comp_channel *(*create_comp_channel)
49 (struct ibv_context *context);
50 int (*destroy_comp_channel)(struct ibv_comp_channel *channel);
51 struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe,
53 struct ibv_comp_channel *channel,
55 int (*destroy_cq)(struct ibv_cq *cq);
56 int (*get_cq_event)(struct ibv_comp_channel *channel,
57 struct ibv_cq **cq, void **cq_context);
58 void (*ack_cq_events)(struct ibv_cq *cq, unsigned int nevents);
59 struct ibv_flow *(*create_flow)(struct ibv_qp *qp,
60 struct ibv_flow_attr *flow);
61 int (*destroy_flow)(struct ibv_flow *flow_id);
62 struct ibv_qp *(*create_qp)(struct ibv_pd *pd,
63 struct ibv_qp_init_attr *qp_init_attr);
64 struct ibv_qp *(*create_qp_ex)
65 (struct ibv_context *context,
66 struct ibv_qp_init_attr_ex *qp_init_attr_ex);
67 int (*destroy_qp)(struct ibv_qp *qp);
68 int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
70 struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr,
71 size_t length, int access);
72 int (*dereg_mr)(struct ibv_mr *mr);
73 struct ibv_rwq_ind_table *(*create_rwq_ind_table)
74 (struct ibv_context *context,
75 struct ibv_rwq_ind_table_init_attr *init_attr);
76 int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
77 struct ibv_wq *(*create_wq)(struct ibv_context *context,
78 struct ibv_wq_init_attr *wq_init_attr);
79 int (*destroy_wq)(struct ibv_wq *wq);
80 int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
81 int (*dv_init_obj)(struct mlx4dv_obj *obj, uint64_t obj_type);
82 int (*dv_set_context_attr)(struct ibv_context *context,
83 enum mlx4dv_set_ctx_attr_type attr_type,
87 const struct mlx4_glue *mlx4_glue;
89 #endif /* MLX4_GLUE_H_ */