net/mlx4: move rdma-core calls to separate file
[dpdk.git] / drivers / net / mlx4 / mlx4_glue.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 6WIND S.A.
3  * Copyright 2018 Mellanox
4  */
5
6 #ifndef MLX4_GLUE_H_
7 #define MLX4_GLUE_H_
8
9 /* Verbs headers do not support -pedantic. */
10 #ifdef PEDANTIC
11 #pragma GCC diagnostic ignored "-Wpedantic"
12 #endif
13 #include <infiniband/mlx4dv.h>
14 #include <infiniband/verbs.h>
15 #ifdef PEDANTIC
16 #pragma GCC diagnostic error "-Wpedantic"
17 #endif
18
19 struct mlx4_glue {
20         int (*fork_init)(void);
21         int (*get_async_event)(struct ibv_context *context,
22                                struct ibv_async_event *event);
23         void (*ack_async_event)(struct ibv_async_event *event);
24         struct ibv_pd *(*alloc_pd)(struct ibv_context *context);
25         int (*dealloc_pd)(struct ibv_pd *pd);
26         struct ibv_device **(*get_device_list)(int *num_devices);
27         void (*free_device_list)(struct ibv_device **list);
28         struct ibv_context *(*open_device)(struct ibv_device *device);
29         int (*close_device)(struct ibv_context *context);
30         const char *(*get_device_name)(struct ibv_device *device);
31         int (*query_device)(struct ibv_context *context,
32                             struct ibv_device_attr *device_attr);
33         int (*query_device_ex)(struct ibv_context *context,
34                                const struct ibv_query_device_ex_input *input,
35                                struct ibv_device_attr_ex *attr);
36         int (*query_port)(struct ibv_context *context, uint8_t port_num,
37                           struct ibv_port_attr *port_attr);
38         const char *(*port_state_str)(enum ibv_port_state port_state);
39         struct ibv_comp_channel *(*create_comp_channel)
40                 (struct ibv_context *context);
41         int (*destroy_comp_channel)(struct ibv_comp_channel *channel);
42         struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe,
43                                     void *cq_context,
44                                     struct ibv_comp_channel *channel,
45                                     int comp_vector);
46         int (*destroy_cq)(struct ibv_cq *cq);
47         int (*get_cq_event)(struct ibv_comp_channel *channel,
48                             struct ibv_cq **cq, void **cq_context);
49         void (*ack_cq_events)(struct ibv_cq *cq, unsigned int nevents);
50         struct ibv_flow *(*create_flow)(struct ibv_qp *qp,
51                                         struct ibv_flow_attr *flow);
52         int (*destroy_flow)(struct ibv_flow *flow_id);
53         struct ibv_qp *(*create_qp)(struct ibv_pd *pd,
54                                     struct ibv_qp_init_attr *qp_init_attr);
55         struct ibv_qp *(*create_qp_ex)
56                 (struct ibv_context *context,
57                  struct ibv_qp_init_attr_ex *qp_init_attr_ex);
58         int (*destroy_qp)(struct ibv_qp *qp);
59         int (*modify_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
60                          int attr_mask);
61         struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr,
62                                  size_t length, int access);
63         int (*dereg_mr)(struct ibv_mr *mr);
64         struct ibv_rwq_ind_table *(*create_rwq_ind_table)
65                 (struct ibv_context *context,
66                  struct ibv_rwq_ind_table_init_attr *init_attr);
67         int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
68         struct ibv_wq *(*create_wq)(struct ibv_context *context,
69                                     struct ibv_wq_init_attr *wq_init_attr);
70         int (*destroy_wq)(struct ibv_wq *wq);
71         int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
72         int (*dv_init_obj)(struct mlx4dv_obj *obj, uint64_t obj_type);
73         int (*dv_set_context_attr)(struct ibv_context *context,
74                                    enum mlx4dv_set_ctx_attr_type attr_type,
75                                    void *attr);
76 };
77
78 const struct mlx4_glue *mlx4_glue;
79
80 #endif /* MLX4_GLUE_H_ */