1
2
3
4
5
6
7#ifndef _RTE_FSLMC_H_
8#define _RTE_FSLMC_H_
9
10
11
12
13
14
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <limits.h>
23#include <errno.h>
24#include <sys/queue.h>
25#include <stdint.h>
26#include <inttypes.h>
27#include <linux/vfio.h>
28
29#include <rte_debug.h>
30#include <rte_interrupts.h>
31#include <rte_dev.h>
32#include <rte_bus.h>
33#include <rte_tailq.h>
34#include <rte_devargs.h>
35#include <rte_mbuf.h>
36#include <rte_mbuf_dyn.h>
37
38#include <fslmc_vfio.h>
39
40#define FSLMC_OBJECT_MAX_LEN 32
41
42#define DPAA2_INVALID_MBUF_SEQN 0
43
44typedef uint32_t dpaa2_seqn_t;
45extern int dpaa2_seqn_dynfield_offset;
46
47
48
49
50
51
52
53
54
55
56__rte_experimental
57static inline dpaa2_seqn_t *
58dpaa2_seqn(struct rte_mbuf *mbuf)
59{
60 return RTE_MBUF_DYNFIELD(mbuf, dpaa2_seqn_dynfield_offset,
61 dpaa2_seqn_t *);
62}
63
64
65#define RTE_DPAA2_DRV_INTR_LSC 0x0008
66
67
68#define RTE_DPAA2_DRV_IOVA_AS_VA 0X0040
69
70struct rte_dpaa2_driver;
71
72
73TAILQ_HEAD(rte_fslmc_device_list, rte_dpaa2_device);
74TAILQ_HEAD(rte_fslmc_driver_list, rte_dpaa2_driver);
75
76#define RTE_DEV_TO_FSLMC_CONST(ptr) \
77 container_of(ptr, const struct rte_dpaa2_device, device)
78
79extern struct rte_fslmc_bus rte_fslmc_bus;
80
81enum rte_dpaa2_dev_type {
82
83 DPAA2_ETH,
84 DPAA2_CRYPTO,
85 DPAA2_CON,
86
87 DPAA2_BPOOL,
88 DPAA2_IO,
89 DPAA2_CI,
90 DPAA2_MPORTAL,
91 DPAA2_QDMA,
92 DPAA2_MUX,
93 DPAA2_DPRTC,
94
95 DPAA2_UNKNOWN,
96 DPAA2_DEVTYPE_MAX,
97};
98
99TAILQ_HEAD(rte_dpaa2_object_list, rte_dpaa2_object);
100
101typedef int (*rte_dpaa2_obj_create_t)(int vdev_fd,
102 struct vfio_device_info *obj_info,
103 int object_id);
104
105
106
107
108struct rte_dpaa2_object {
109 TAILQ_ENTRY(rte_dpaa2_object) next;
110 const char *name;
111 enum rte_dpaa2_dev_type dev_type;
112 rte_dpaa2_obj_create_t create;
113};
114
115
116
117
118struct rte_dpaa2_device {
119 TAILQ_ENTRY(rte_dpaa2_device) next;
120 struct rte_device device;
121 union {
122 struct rte_eth_dev *eth_dev;
123 struct rte_cryptodev *cryptodev;
124 struct rte_rawdev *rawdev;
125 };
126 enum rte_dpaa2_dev_type dev_type;
127 uint16_t object_id;
128 struct rte_intr_handle intr_handle;
129 struct rte_dpaa2_driver *driver;
130 char name[FSLMC_OBJECT_MAX_LEN];
131};
132
133typedef int (*rte_dpaa2_probe_t)(struct rte_dpaa2_driver *dpaa2_drv,
134 struct rte_dpaa2_device *dpaa2_dev);
135typedef int (*rte_dpaa2_remove_t)(struct rte_dpaa2_device *dpaa2_dev);
136
137
138
139
140struct rte_dpaa2_driver {
141 TAILQ_ENTRY(rte_dpaa2_driver) next;
142 struct rte_driver driver;
143 struct rte_fslmc_bus *fslmc_bus;
144 uint32_t drv_flags;
145 enum rte_dpaa2_dev_type drv_type;
146 rte_dpaa2_probe_t probe;
147 rte_dpaa2_remove_t remove;
148};
149
150
151
152
153struct rte_fslmc_bus {
154 struct rte_bus bus;
155 struct rte_fslmc_device_list device_list;
156
157 struct rte_fslmc_driver_list driver_list;
158
159 int device_count[DPAA2_DEVTYPE_MAX];
160
161};
162
163
164
165
166
167
168
169
170__rte_internal
171void rte_fslmc_driver_register(struct rte_dpaa2_driver *driver);
172
173
174
175
176
177
178
179
180__rte_internal
181void rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver);
182
183
184#define RTE_PMD_REGISTER_DPAA2(nm, dpaa2_drv) \
185RTE_INIT(dpaa2initfn_ ##nm) \
186{\
187 (dpaa2_drv).driver.name = RTE_STR(nm);\
188 rte_fslmc_driver_register(&dpaa2_drv); \
189} \
190RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
191
192
193
194
195
196
197
198
199__rte_internal
200void rte_fslmc_object_register(struct rte_dpaa2_object *object);
201
202
203
204
205
206
207
208
209
210
211__rte_internal
212uint32_t rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type);
213
214
215#define RTE_PMD_REGISTER_DPAA2_OBJECT(nm, dpaa2_obj) \
216RTE_INIT(dpaa2objinitfn_ ##nm) \
217{\
218 (dpaa2_obj).name = RTE_STR(nm);\
219 rte_fslmc_object_register(&dpaa2_obj); \
220} \
221RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
222
223#ifdef __cplusplus
224}
225#endif
226
227#endif
228