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
43
44
45
46#define DPDMUX_OPT_AUTO_MAX_FRAME_LEN 0x0000000000000040ULL
47
48#define DPDMUX_IRQ_INDEX_IF 0x0000
49#define DPDMUX_IRQ_INDEX 0x0001
50
51
52
53
54#define DPDMUX_IRQ_EVENT_LINK_CHANGED 0x0001
55
56
57
58
59
60
61enum dpdmux_manip {
62 DPDMUX_MANIP_NONE = 0x0,
63 DPDMUX_MANIP_ADD_REMOVE_S_VLAN = 0x1
64};
65
66
67
68
69
70
71
72
73
74enum dpdmux_method {
75 DPDMUX_METHOD_NONE = 0x0,
76 DPDMUX_METHOD_C_VLAN_MAC = 0x1,
77 DPDMUX_METHOD_MAC = 0x2,
78 DPDMUX_METHOD_C_VLAN = 0x3,
79 DPDMUX_METHOD_S_VLAN = 0x4,
80 DPDMUX_METHOD_CUSTOM = 0x5,
81};
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103struct dpdmux_cfg {
104 enum dpdmux_method method;
105 enum dpdmux_manip manip;
106 uint16_t num_ifs;
107 uint16_t default_if;
108 struct {
109 uint64_t options;
110 uint16_t max_dmat_entries;
111 uint16_t max_mc_groups;
112 uint16_t max_vlan_ids;
113 uint16_t mem_size;
114 } adv;
115};
116
117int dpdmux_create(struct fsl_mc_io *mc_io,
118 uint16_t dprc_token,
119 uint32_t cmd_flags,
120 const struct dpdmux_cfg *cfg,
121 uint32_t *obj_id);
122
123int dpdmux_destroy(struct fsl_mc_io *mc_io,
124 uint16_t dprc_token,
125 uint32_t cmd_flags,
126 uint32_t object_id);
127
128int dpdmux_enable(struct fsl_mc_io *mc_io,
129 uint32_t cmd_flags,
130 uint16_t token);
131
132int dpdmux_disable(struct fsl_mc_io *mc_io,
133 uint32_t cmd_flags,
134 uint16_t token);
135
136int dpdmux_is_enabled(struct fsl_mc_io *mc_io,
137 uint32_t cmd_flags,
138 uint16_t token,
139 int *en);
140
141int dpdmux_reset(struct fsl_mc_io *mc_io,
142 uint32_t cmd_flags,
143 uint16_t token);
144
145
146
147
148#define DPDMUX_SKIP_DEFAULT_INTERFACE 0x01
149
150
151
152#define DPDMUX_SKIP_UNICAST_RULES 0x02
153
154
155
156#define DPDMUX_SKIP_MULTICAST_RULES 0x04
157
158int dpdmux_set_resetable(struct fsl_mc_io *mc_io,
159 uint32_t cmd_flags,
160 uint16_t token,
161 uint8_t skip_reset_flags);
162
163int dpdmux_get_resetable(struct fsl_mc_io *mc_io,
164 uint32_t cmd_flags,
165 uint16_t token,
166 uint8_t *skip_reset_flags);
167
168
169
170
171
172
173
174
175
176
177
178
179struct dpdmux_attr {
180 int id;
181 uint64_t options;
182 enum dpdmux_method method;
183 enum dpdmux_manip manip;
184 uint16_t num_ifs;
185 uint16_t mem_size;
186 uint16_t default_if;
187};
188
189int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
190 uint32_t cmd_flags,
191 uint16_t token,
192 struct dpdmux_attr *attr);
193
194int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io,
195 uint32_t cmd_flags,
196 uint16_t token,
197 uint16_t max_frame_length);
198
199int dpdmux_get_max_frame_length(struct fsl_mc_io *mc_io,
200 uint32_t cmd_flags,
201 uint16_t token,
202 uint16_t if_id,
203 uint16_t *max_frame_length);
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220enum dpdmux_counter_type {
221 DPDMUX_CNT_ING_FRAME = 0x0,
222 DPDMUX_CNT_ING_BYTE = 0x1,
223 DPDMUX_CNT_ING_FLTR_FRAME = 0x2,
224 DPDMUX_CNT_ING_FRAME_DISCARD = 0x3,
225 DPDMUX_CNT_ING_MCAST_FRAME = 0x4,
226 DPDMUX_CNT_ING_MCAST_BYTE = 0x5,
227 DPDMUX_CNT_ING_BCAST_FRAME = 0x6,
228 DPDMUX_CNT_ING_BCAST_BYTES = 0x7,
229 DPDMUX_CNT_EGR_FRAME = 0x8,
230 DPDMUX_CNT_EGR_BYTE = 0x9,
231 DPDMUX_CNT_EGR_FRAME_DISCARD = 0xa,
232 DPDMUX_CNT_ING_NO_BUFFER_DISCARD = 0xb,
233};
234
235
236
237
238
239
240
241
242
243
244
245enum dpdmux_accepted_frames_type {
246 DPDMUX_ADMIT_ALL = 0,
247 DPDMUX_ADMIT_ONLY_VLAN_TAGGED = 1,
248 DPDMUX_ADMIT_ONLY_UNTAGGED = 2
249};
250
251
252
253
254
255
256
257enum dpdmux_action {
258 DPDMUX_ACTION_DROP = 0,
259 DPDMUX_ACTION_REDIRECT_TO_CTRL = 1
260};
261
262
263
264
265
266
267struct dpdmux_accepted_frames {
268 enum dpdmux_accepted_frames_type type;
269 enum dpdmux_action unaccept_act;
270};
271
272int dpdmux_if_set_accepted_frames(struct fsl_mc_io *mc_io,
273 uint32_t cmd_flags,
274 uint16_t token,
275 uint16_t if_id,
276 const struct dpdmux_accepted_frames *cfg);
277
278
279
280
281
282
283
284struct dpdmux_if_attr {
285 uint32_t rate;
286 int enabled;
287 int is_default;
288 enum dpdmux_accepted_frames_type accept_frame_type;
289};
290
291int dpdmux_if_get_attributes(struct fsl_mc_io *mc_io,
292 uint32_t cmd_flags,
293 uint16_t token,
294 uint16_t if_id,
295 struct dpdmux_if_attr *attr);
296
297int dpdmux_if_enable(struct fsl_mc_io *mc_io,
298 uint32_t cmd_flags,
299 uint16_t token,
300 uint16_t if_id);
301
302int dpdmux_if_disable(struct fsl_mc_io *mc_io,
303 uint32_t cmd_flags,
304 uint16_t token,
305 uint16_t if_id);
306
307
308
309
310
311
312struct dpdmux_l2_rule {
313 uint8_t mac_addr[6];
314 uint16_t vlan_id;
315};
316
317int dpdmux_if_remove_l2_rule(struct fsl_mc_io *mc_io,
318 uint32_t cmd_flags,
319 uint16_t token,
320 uint16_t if_id,
321 const struct dpdmux_l2_rule *rule);
322
323int dpdmux_if_add_l2_rule(struct fsl_mc_io *mc_io,
324 uint32_t cmd_flags,
325 uint16_t token,
326 uint16_t if_id,
327 const struct dpdmux_l2_rule *rule);
328
329int dpdmux_if_get_counter(struct fsl_mc_io *mc_io,
330 uint32_t cmd_flags,
331 uint16_t token,
332 uint16_t if_id,
333 enum dpdmux_counter_type counter_type,
334 uint64_t *counter);
335
336int dpdmux_ul_reset_counters(struct fsl_mc_io *mc_io,
337 uint32_t cmd_flags,
338 uint16_t token);
339
340
341
342
343#define DPDMUX_LINK_OPT_AUTONEG 0x0000000000000001ULL
344
345
346
347#define DPDMUX_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
348
349
350
351#define DPDMUX_LINK_OPT_PAUSE 0x0000000000000004ULL
352
353
354
355#define DPDMUX_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
356
357
358
359
360
361
362struct dpdmux_link_cfg {
363 uint32_t rate;
364 uint64_t options;
365 uint64_t advertising;
366};
367
368int dpdmux_if_set_link_cfg(struct fsl_mc_io *mc_io,
369 uint32_t cmd_flags,
370 uint16_t token,
371 uint16_t if_id,
372 struct dpdmux_link_cfg *cfg);
373
374
375
376
377
378
379
380
381
382struct dpdmux_link_state {
383 uint32_t rate;
384 uint64_t options;
385 int up;
386 int state_valid;
387 uint64_t supported;
388 uint64_t advertising;
389};
390
391int dpdmux_if_get_link_state(struct fsl_mc_io *mc_io,
392 uint32_t cmd_flags,
393 uint16_t token,
394 uint16_t if_id,
395 struct dpdmux_link_state *state);
396
397int dpdmux_if_set_default(struct fsl_mc_io *mc_io,
398 uint32_t cmd_flags,
399 uint16_t token,
400 uint16_t if_id);
401
402int dpdmux_if_get_default(struct fsl_mc_io *mc_io,
403 uint32_t cmd_flags,
404 uint16_t token,
405 uint16_t *if_id);
406
407int dpdmux_set_custom_key(struct fsl_mc_io *mc_io,
408 uint32_t cmd_flags,
409 uint16_t token,
410 uint64_t key_cfg_iova);
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428struct dpdmux_rule_cfg {
429 uint64_t key_iova;
430 uint64_t mask_iova;
431 uint8_t key_size;
432 uint16_t entry_index;
433};
434
435
436
437
438
439
440
441
442
443
444struct dpdmux_cls_action {
445 uint16_t dest_if;
446};
447
448int dpdmux_add_custom_cls_entry(struct fsl_mc_io *mc_io,
449 uint32_t cmd_flags,
450 uint16_t token,
451 struct dpdmux_rule_cfg *rule,
452 struct dpdmux_cls_action *action);
453
454int dpdmux_remove_custom_cls_entry(struct fsl_mc_io *mc_io,
455 uint32_t cmd_flags,
456 uint16_t token,
457 struct dpdmux_rule_cfg *rule);
458
459int dpdmux_get_api_version(struct fsl_mc_io *mc_io,
460 uint32_t cmd_flags,
461 uint16_t *major_ver,
462 uint16_t *minor_ver);
463
464
465
466
467
468
469#define DPDMUX_ERROR_DISC 0x80000000
470
471
472
473#define DPDMUX_ERROR_MS 0x40000000
474
475
476
477#define DPDMUX_ERROR_PTP 0x08000000
478
479
480
481#define DPDMUX_ERROR_MC 0x04000000
482
483
484
485#define DPDMUX_ERROR_BC 0x02000000
486
487
488
489#define DPDMUX_ERROR_KSE 0x00040000
490
491
492
493#define DPDMUX_ERROR_EOFHE 0x00020000
494
495
496
497#define DPDMUX_ERROR_MNLE 0x00010000
498
499
500
501#define DPDMUX_ERROR_TIDE 0x00008000
502
503
504
505#define DPDMUX_ERROR_PIEE 0x00004000
506
507
508
509#define DPDMUX_ERROR_FLE 0x00002000
510
511
512
513#define DPDMUX_ERROR_FPE 0x00001000
514
515
516
517#define DPDMUX_ERROR_PTE 0x00000080
518
519
520
521#define DPDMUX_ERROR_ISP 0x00000040
522
523
524
525#define DPDMUX_ERROR_PHE 0x00000020
526
527
528
529
530
531#define DPDMUX_ERROR_BLE 0x00000010
532
533
534
535#define DPDMUX__ERROR_L3CV 0x00000008
536
537
538
539#define DPDMUX__ERROR_L3CE 0x00000004
540
541
542
543#define DPDMUX__ERROR_L4CV 0x00000002
544
545
546
547#define DPDMUX__ERROR_L4CE 0x00000001
548
549enum dpdmux_error_action {
550 DPDMUX_ERROR_ACTION_DISCARD = 0,
551 DPDMUX_ERROR_ACTION_CONTINUE = 1
552};
553
554
555
556
557
558
559struct dpdmux_error_cfg {
560 uint32_t errors;
561 enum dpdmux_error_action error_action;
562};
563
564int dpdmux_if_set_errors_behavior(struct fsl_mc_io *mc_io, uint32_t cmd_flags,
565 uint16_t token, uint16_t if_id, struct dpdmux_error_cfg *cfg);
566
567#endif
568