1
2
3
4
5
6
7#ifndef __FSL_DPDMUX_H
8#define __FSL_DPDMUX_H
9
10#include <fsl_net.h>
11
12struct fsl_mc_io;
13
14
15
16
17
18
19int dpdmux_open(struct fsl_mc_io *mc_io,
20 uint32_t cmd_flags,
21 int dpdmux_id,
22 uint16_t *token);
23
24int dpdmux_close(struct fsl_mc_io *mc_io,
25 uint32_t cmd_flags,
26 uint16_t token);
27
28
29
30
31
32
33
34
35#define DPDMUX_OPT_BRIDGE_EN 0x0000000000000002ULL
36
37
38
39
40#define DPDMUX_OPT_CLS_MASK_SUPPORT 0x0000000000000020ULL
41
42#define DPDMUX_IRQ_INDEX_IF 0x0000
43#define DPDMUX_IRQ_INDEX 0x0001
44
45
46
47
48#define DPDMUX_IRQ_EVENT_LINK_CHANGED 0x0001
49
50
51
52
53
54
55enum dpdmux_manip {
56 DPDMUX_MANIP_NONE = 0x0,
57 DPDMUX_MANIP_ADD_REMOVE_S_VLAN = 0x1
58};
59
60
61
62
63
64
65
66
67
68enum dpdmux_method {
69 DPDMUX_METHOD_NONE = 0x0,
70 DPDMUX_METHOD_C_VLAN_MAC = 0x1,
71 DPDMUX_METHOD_MAC = 0x2,
72 DPDMUX_METHOD_C_VLAN = 0x3,
73 DPDMUX_METHOD_S_VLAN = 0x4,
74 DPDMUX_METHOD_CUSTOM = 0x5,
75};
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93struct dpdmux_cfg {
94 enum dpdmux_method method;
95 enum dpdmux_manip manip;
96 uint16_t num_ifs;
97 struct {
98 uint64_t options;
99 uint16_t max_dmat_entries;
100 uint16_t max_mc_groups;
101 uint16_t max_vlan_ids;
102 } adv;
103};
104
105int dpdmux_create(struct fsl_mc_io *mc_io,
106 uint16_t dprc_token,
107 uint32_t cmd_flags,
108 const struct dpdmux_cfg *cfg,
109 uint32_t *obj_id);
110
111int dpdmux_destroy(struct fsl_mc_io *mc_io,
112 uint16_t dprc_token,
113 uint32_t cmd_flags,
114 uint32_t object_id);
115
116int dpdmux_enable(struct fsl_mc_io *mc_io,
117 uint32_t cmd_flags,
118 uint16_t token);
119
120int dpdmux_disable(struct fsl_mc_io *mc_io,
121 uint32_t cmd_flags,
122 uint16_t token);
123
124int dpdmux_is_enabled(struct fsl_mc_io *mc_io,
125 uint32_t cmd_flags,
126 uint16_t token,
127 int *en);
128
129int dpdmux_reset(struct fsl_mc_io *mc_io,
130 uint32_t cmd_flags,
131 uint16_t token);
132
133
134
135
136
137
138
139
140
141
142struct dpdmux_attr {
143 int id;
144 uint64_t options;
145 enum dpdmux_method method;
146 enum dpdmux_manip manip;
147 uint16_t num_ifs;
148 uint16_t mem_size;
149};
150
151int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
152 uint32_t cmd_flags,
153 uint16_t token,
154 struct dpdmux_attr *attr);
155
156int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io,
157 uint32_t cmd_flags,
158 uint16_t token,
159 uint16_t max_frame_length);
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175enum dpdmux_counter_type {
176 DPDMUX_CNT_ING_FRAME = 0x0,
177 DPDMUX_CNT_ING_BYTE = 0x1,
178 DPDMUX_CNT_ING_FLTR_FRAME = 0x2,
179 DPDMUX_CNT_ING_FRAME_DISCARD = 0x3,
180 DPDMUX_CNT_ING_MCAST_FRAME = 0x4,
181 DPDMUX_CNT_ING_MCAST_BYTE = 0x5,
182 DPDMUX_CNT_ING_BCAST_FRAME = 0x6,
183 DPDMUX_CNT_ING_BCAST_BYTES = 0x7,
184 DPDMUX_CNT_EGR_FRAME = 0x8,
185 DPDMUX_CNT_EGR_BYTE = 0x9,
186 DPDMUX_CNT_EGR_FRAME_DISCARD = 0xa
187};
188
189
190
191
192
193
194
195
196
197
198
199enum dpdmux_accepted_frames_type {
200 DPDMUX_ADMIT_ALL = 0,
201 DPDMUX_ADMIT_ONLY_VLAN_TAGGED = 1,
202 DPDMUX_ADMIT_ONLY_UNTAGGED = 2
203};
204
205
206
207
208
209
210
211enum dpdmux_action {
212 DPDMUX_ACTION_DROP = 0,
213 DPDMUX_ACTION_REDIRECT_TO_CTRL = 1
214};
215
216
217
218
219
220
221struct dpdmux_accepted_frames {
222 enum dpdmux_accepted_frames_type type;
223 enum dpdmux_action unaccept_act;
224};
225
226int dpdmux_if_set_accepted_frames(struct fsl_mc_io *mc_io,
227 uint32_t cmd_flags,
228 uint16_t token,
229 uint16_t if_id,
230 const struct dpdmux_accepted_frames *cfg);
231
232
233
234
235
236
237
238struct dpdmux_if_attr {
239 uint32_t rate;
240 int enabled;
241 int is_default;
242 enum dpdmux_accepted_frames_type accept_frame_type;
243};
244
245int dpdmux_if_get_attributes(struct fsl_mc_io *mc_io,
246 uint32_t cmd_flags,
247 uint16_t token,
248 uint16_t if_id,
249 struct dpdmux_if_attr *attr);
250
251int dpdmux_if_enable(struct fsl_mc_io *mc_io,
252 uint32_t cmd_flags,
253 uint16_t token,
254 uint16_t if_id);
255
256int dpdmux_if_disable(struct fsl_mc_io *mc_io,
257 uint32_t cmd_flags,
258 uint16_t token,
259 uint16_t if_id);
260
261
262
263
264
265
266struct dpdmux_l2_rule {
267 uint8_t mac_addr[6];
268 uint16_t vlan_id;
269};
270
271int dpdmux_if_remove_l2_rule(struct fsl_mc_io *mc_io,
272 uint32_t cmd_flags,
273 uint16_t token,
274 uint16_t if_id,
275 const struct dpdmux_l2_rule *rule);
276
277int dpdmux_if_add_l2_rule(struct fsl_mc_io *mc_io,
278 uint32_t cmd_flags,
279 uint16_t token,
280 uint16_t if_id,
281 const struct dpdmux_l2_rule *rule);
282
283int dpdmux_if_get_counter(struct fsl_mc_io *mc_io,
284 uint32_t cmd_flags,
285 uint16_t token,
286 uint16_t if_id,
287 enum dpdmux_counter_type counter_type,
288 uint64_t *counter);
289
290int dpdmux_ul_reset_counters(struct fsl_mc_io *mc_io,
291 uint32_t cmd_flags,
292 uint16_t token);
293
294
295
296
297#define DPDMUX_LINK_OPT_AUTONEG 0x0000000000000001ULL
298
299
300
301#define DPDMUX_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
302
303
304
305#define DPDMUX_LINK_OPT_PAUSE 0x0000000000000004ULL
306
307
308
309#define DPDMUX_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
310
311
312
313
314
315
316struct dpdmux_link_cfg {
317 uint32_t rate;
318 uint64_t options;
319 uint64_t advertising;
320};
321
322int dpdmux_if_set_link_cfg(struct fsl_mc_io *mc_io,
323 uint32_t cmd_flags,
324 uint16_t token,
325 uint16_t if_id,
326 struct dpdmux_link_cfg *cfg);
327
328
329
330
331
332
333
334
335
336struct dpdmux_link_state {
337 uint32_t rate;
338 uint64_t options;
339 int up;
340 int state_valid;
341 uint64_t supported;
342 uint64_t advertising;
343};
344
345int dpdmux_if_get_link_state(struct fsl_mc_io *mc_io,
346 uint32_t cmd_flags,
347 uint16_t token,
348 uint16_t if_id,
349 struct dpdmux_link_state *state);
350
351int dpdmux_if_set_default(struct fsl_mc_io *mc_io,
352 uint32_t cmd_flags,
353 uint16_t token,
354 uint16_t if_id);
355
356int dpdmux_if_get_default(struct fsl_mc_io *mc_io,
357 uint32_t cmd_flags,
358 uint16_t token,
359 uint16_t *if_id);
360
361int dpdmux_set_custom_key(struct fsl_mc_io *mc_io,
362 uint32_t cmd_flags,
363 uint16_t token,
364 uint64_t key_cfg_iova);
365
366
367
368
369
370
371
372
373
374
375struct dpdmux_rule_cfg {
376 uint64_t key_iova;
377 uint64_t mask_iova;
378 uint8_t key_size;
379};
380
381
382
383
384
385
386
387
388
389
390struct dpdmux_cls_action {
391 uint16_t dest_if;
392};
393
394int dpdmux_add_custom_cls_entry(struct fsl_mc_io *mc_io,
395 uint32_t cmd_flags,
396 uint16_t token,
397 struct dpdmux_rule_cfg *rule,
398 struct dpdmux_cls_action *action);
399
400int dpdmux_remove_custom_cls_entry(struct fsl_mc_io *mc_io,
401 uint32_t cmd_flags,
402 uint16_t token,
403 struct dpdmux_rule_cfg *rule);
404
405int dpdmux_get_api_version(struct fsl_mc_io *mc_io,
406 uint32_t cmd_flags,
407 uint16_t *major_ver,
408 uint16_t *minor_ver);
409
410#endif
411