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