1
2
3
4
5
6#ifndef _FSL_DPNI_H
7#define _FSL_DPNI_H
8
9
10#define DPNI_VER_MAJOR 7
11#define DPNI_VER_MINOR 3
12
13
14#define DPNI_CMDID_OPEN 0x8011
15#define DPNI_CMDID_CLOSE 0x8001
16#define DPNI_CMDID_CREATE 0x9011
17#define DPNI_CMDID_DESTROY 0x9811
18#define DPNI_CMDID_GET_API_VERSION 0xa011
19
20#define DPNI_CMDID_ENABLE 0x0021
21#define DPNI_CMDID_DISABLE 0x0031
22#define DPNI_CMDID_GET_ATTR 0x0041
23#define DPNI_CMDID_RESET 0x0051
24
25#define DPNI_CMDID_SET_POOLS 0x2002
26#define DPNI_CMDID_SET_BUFFER_LAYOUT 0x2651
27#define DPNI_CMDID_GET_BUFFER_LAYOUT 0x2641
28#define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B1
29
30#define DPNI_CMDID_GET_QDID 0x2101
31#define DPNI_CMDID_GET_TX_DATA_OFFSET 0x2121
32#define DPNI_CMDID_GET_LINK_STATE 0x2151
33#define DPNI_CMDID_SET_LINK_CFG 0x21A1
34
35#define DPNI_CMDID_SET_PRIM_MAC 0x2241
36#define DPNI_CMDID_GET_PRIM_MAC 0x2251
37#define DPNI_CMDID_ADD_MAC_ADDR 0x2261
38#define DPNI_CMDID_REMOVE_MAC_ADDR 0x2271
39
40#define DPNI_CMDID_GET_STATISTICS 0x25D1
41#define DPNI_CMDID_RESET_STATISTICS 0x25E1
42#define DPNI_CMDID_GET_QUEUE 0x25F1
43#define DPNI_CMDID_SET_QUEUE 0x2601
44#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE 0x2661
45
46
47#define DPNI_CMD_OPEN(cmd, dpni_id) \
48 MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
49
50
51#define DPNI_PREP_CFG(param, cfg) \
52do { \
53 MC_PREP_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \
54 MC_PREP_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \
55 MC_PREP_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \
56 MC_PREP_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \
57 MC_PREP_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \
58 MC_PREP_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \
59 MC_PREP_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \
60} while (0)
61
62
63#define DPNI_EXT_CFG(param, cfg) \
64do { \
65 MC_EXT_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \
66 MC_EXT_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \
67 MC_EXT_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \
68 MC_EXT_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \
69 MC_EXT_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \
70 MC_EXT_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \
71 MC_EXT_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \
72} while (0)
73
74
75#define DPNI_CMD_CREATE(cmd, cfg) \
76do { \
77 MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->adv.options); \
78 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->adv.num_queues); \
79 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->adv.num_tcs); \
80 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->adv.mac_entries); \
81 MC_CMD_OP(cmd, 1, 0, 8, uint8_t, cfg->adv.vlan_entries); \
82 MC_CMD_OP(cmd, 1, 16, 8, uint8_t, cfg->adv.qos_entries); \
83 MC_CMD_OP(cmd, 1, 32, 16, uint8_t, cfg->adv.fs_entries); \
84} while (0)
85
86
87#define DPNI_CMD_SET_POOLS(cmd, cfg) \
88do { \
89 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
90 MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \
91 MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \
92 MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \
93 MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \
94 MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \
95 MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \
96 MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \
97 MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \
98 MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
99 MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
100 MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
101 MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
102 MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
103 MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
104 MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
105 MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
106 MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
107 MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
108 MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
109 MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
110 MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
111 MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
112 MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
113 MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
114} while (0)
115
116
117#define DPNI_RSP_GET_ATTR(cmd, attr) \
118do { \
119 MC_RSP_OP(cmd, 0, 0, 32, int, attr->options);\
120 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_num_queues); \
121 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_num_tcs); \
122 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->max_mac_entries); \
123 MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->max_vlan_entries); \
124 MC_RSP_OP(cmd, 1, 16, 8, uint8_t, attr->max_qos_entries); \
125 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, attr->max_fs_entries); \
126 MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_qos_key_size); \
127 MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_fs_key_size); \
128 MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->wriop_version); \
129} while (0)
130
131
132#define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
133do { \
134 MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \
135 MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \
136 MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \
137} while (0)
138
139
140#define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, layout, queue) \
141do { \
142 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, queue); \
143 MC_CMD_OP(cmd, 1, 0, 16, uint16_t, layout->private_data_size); \
144 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_align); \
145 MC_CMD_OP(cmd, 0, 32, 16, uint16_t, layout->options); \
146 MC_CMD_OP(cmd, 0, 48, 1, int, layout->pass_timestamp); \
147 MC_CMD_OP(cmd, 0, 49, 1, int, layout->pass_parser_result); \
148 MC_CMD_OP(cmd, 0, 50, 1, int, layout->pass_frame_status); \
149 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_head_room); \
150 MC_CMD_OP(cmd, 1, 48, 16, uint16_t, layout->data_tail_room); \
151} while (0)
152
153
154#define DPNI_RSP_GET_QDID(cmd, qdid) \
155 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
156
157
158#define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \
159 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset)
160
161
162#define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
163do { \
164 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
165 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
166} while (0)
167
168
169#define DPNI_RSP_GET_LINK_STATE(cmd, state) \
170do { \
171 MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
172 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
173 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
174} while (0)
175
176
177
178
179#define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
180do { \
181 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
182 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
183 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
184 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
185 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
186 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
187} while (0)
188
189
190#define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
191do { \
192 MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
193 MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
194 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
195 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
196 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
197 MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
198} while (0)
199
200
201#define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
202do { \
203 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
204 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
205 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
206 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
207 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
208 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
209} while (0)
210
211
212#define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
213do { \
214 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
215 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
216 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
217 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
218 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
219 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
220} while (0)
221
222#define DPNI_CMD_GET_QUEUE(cmd, type, tc, index) \
223do { \
224 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \
225 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
226 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
227} while (0)
228
229#define DPNI_RSP_GET_QUEUE(cmd, queue) \
230do { \
231 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
232 MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
233 MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \
234 MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
235 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \
236 MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
237 MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue)->fqid); \
238 MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue)->qdbin); \
239} while (0)
240
241#define DPNI_CMD_SET_QUEUE(cmd, type, tc, index, queue) \
242do { \
243 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \
244 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
245 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
246 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, (queue)->options); \
247 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
248 MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
249 MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \
250 MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
251 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
252 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \
253 MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
254} while (0)
255
256
257#define DPNI_CMD_GET_STATISTICS(cmd, page) \
258 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
259
260
261#define DPNI_RSP_GET_STATISTICS(cmd, stat) \
262do { \
263 MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->counter0); \
264 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->counter1); \
265 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->counter2); \
266 MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->counter3); \
267 MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->counter4); \
268 MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->counter5); \
269 MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->counter6); \
270} while (0)
271
272enum net_prot {
273 NET_PROT_NONE = 0,
274 NET_PROT_PAYLOAD,
275 NET_PROT_ETH,
276 NET_PROT_VLAN,
277 NET_PROT_IPV4,
278 NET_PROT_IPV6,
279 NET_PROT_IP,
280 NET_PROT_TCP,
281 NET_PROT_UDP,
282 NET_PROT_UDP_LITE,
283 NET_PROT_IPHC,
284 NET_PROT_SCTP,
285 NET_PROT_SCTP_CHUNK_DATA,
286 NET_PROT_PPPOE,
287 NET_PROT_PPP,
288 NET_PROT_PPPMUX,
289 NET_PROT_PPPMUX_SUBFRM,
290 NET_PROT_L2TPV2,
291 NET_PROT_L2TPV3_CTRL,
292 NET_PROT_L2TPV3_SESS,
293 NET_PROT_LLC,
294 NET_PROT_LLC_SNAP,
295 NET_PROT_NLPID,
296 NET_PROT_SNAP,
297 NET_PROT_MPLS,
298 NET_PROT_IPSEC_AH,
299 NET_PROT_IPSEC_ESP,
300 NET_PROT_UDP_ENC_ESP,
301 NET_PROT_MACSEC,
302 NET_PROT_GRE,
303 NET_PROT_MINENCAP,
304 NET_PROT_DCCP,
305 NET_PROT_ICMP,
306 NET_PROT_IGMP,
307 NET_PROT_ARP,
308 NET_PROT_CAPWAP_DATA,
309 NET_PROT_CAPWAP_CTRL,
310 NET_PROT_RFC2684,
311 NET_PROT_ICMPV6,
312 NET_PROT_FCOE,
313 NET_PROT_FIP,
314 NET_PROT_ISCSI,
315 NET_PROT_GTP,
316 NET_PROT_USER_DEFINED_L2,
317 NET_PROT_USER_DEFINED_L3,
318 NET_PROT_USER_DEFINED_L4,
319 NET_PROT_USER_DEFINED_L5,
320 NET_PROT_USER_DEFINED_SHIM1,
321 NET_PROT_USER_DEFINED_SHIM2,
322
323 NET_PROT_DUMMY_LAST
324};
325
326
327
328
329
330
331struct fsl_mc_io;
332
333
334
335
336#define DPNI_MAX_TC 8
337
338#define DPNI_MAX_DPBP 8
339
340
341#define DPNI_ALL_TCS (uint8_t)(-1)
342
343#define DPNI_ALL_TC_FLOWS (uint16_t)(-1)
344
345#define DPNI_NEW_FLOW_ID (uint16_t)(-1)
346
347#define DPNI_COMMON_TX_CONF (uint16_t)(-1)
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366int dpni_open(struct fsl_mc_io *mc_io,
367 uint32_t cmd_flags,
368 int dpni_id,
369 uint16_t *token);
370
371
372
373
374
375
376
377
378
379
380
381
382int dpni_close(struct fsl_mc_io *mc_io,
383 uint32_t cmd_flags,
384 uint16_t token);
385
386
387
388
389
390
391
392#define DPNI_OPT_ALLOW_DIST_KEY_PER_TC 0x00000001
393
394
395
396
397
398#define DPNI_OPT_TX_CONF_DISABLED 0x00000002
399
400
401#define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED 0x00000004
402
403
404
405
406
407#define DPNI_OPT_DIST_HASH 0x00000010
408
409
410
411
412
413
414#define DPNI_OPT_DIST_FS 0x00000020
415
416
417#define DPNI_OPT_UNICAST_FILTER 0x00000080
418
419#define DPNI_OPT_MULTICAST_FILTER 0x00000100
420
421#define DPNI_OPT_VLAN_FILTER 0x00000200
422
423#define DPNI_OPT_IPR 0x00000800
424
425#define DPNI_OPT_IPF 0x00001000
426
427#define DPNI_OPT_VLAN_MANIPULATION 0x00010000
428
429#define DPNI_OPT_QOS_MASK_SUPPORT 0x00020000
430
431#define DPNI_OPT_FS_MASK_SUPPORT 0x00040000
432
433
434
435
436
437
438
439
440enum dpni_queue_type {
441 DPNI_QUEUE_RX,
442 DPNI_QUEUE_TX,
443 DPNI_QUEUE_TX_CONFIRM,
444 DPNI_QUEUE_RX_ERR,
445};
446
447struct dpni_cfg {
448 uint8_t mac_addr[6];
449 struct {
450 uint32_t options;
451 uint16_t fs_entries;
452 uint8_t num_queues;
453 uint8_t num_tcs;
454 uint8_t mac_entries;
455 uint8_t vlan_entries;
456 uint8_t qos_entries;
457 } adv;
458};
459
460
461
462
463
464
465struct dpni_extended_cfg {
466
467
468
469
470
471
472
473
474
475
476
477 struct {
478 uint16_t max_dist;
479 uint16_t max_fs_entries;
480 } tc_cfg[DPNI_MAX_TC];
481
482
483
484
485
486
487
488
489
490
491 struct {
492 uint16_t max_reass_frm_size;
493 uint16_t min_frag_size_ipv4;
494 uint16_t min_frag_size_ipv6;
495 uint16_t max_open_frames_ipv4;
496 uint16_t max_open_frames_ipv6;
497 } ipr_cfg;
498};
499
500
501
502
503
504
505
506
507int dpni_prepare_cfg(const struct dpni_cfg *cfg,
508 uint8_t *cfg_buf);
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532int dpni_create(struct fsl_mc_io *mc_io,
533 uint16_t token,
534 uint32_t cmd_flags,
535 const struct dpni_cfg *cfg,
536 uint32_t *obj_id);
537
538
539
540
541
542
543
544
545
546
547int dpni_destroy(struct fsl_mc_io *mc_io,
548 uint16_t token,
549 uint32_t cmd_flags,
550 uint32_t obj_id);
551
552
553
554
555
556
557
558struct dpni_pools_cfg {
559 uint8_t num_dpbp;
560
561
562
563
564
565
566 struct {
567 int dpbp_id;
568 uint16_t buffer_size;
569 int backup_pool;
570 } pools[DPNI_MAX_DPBP];
571};
572
573
574
575
576
577
578
579
580
581
582
583
584
585int dpni_set_pools(struct fsl_mc_io *mc_io,
586 uint32_t cmd_flags,
587 uint16_t token,
588 const struct dpni_pools_cfg *cfg);
589
590
591
592
593
594
595
596
597
598int dpni_enable(struct fsl_mc_io *mc_io,
599 uint32_t cmd_flags,
600 uint16_t token);
601
602
603
604
605
606
607
608
609
610int dpni_disable(struct fsl_mc_io *mc_io,
611 uint32_t cmd_flags,
612 uint16_t token);
613
614
615
616
617
618
619
620
621
622
623int dpni_reset(struct fsl_mc_io *mc_io,
624 uint32_t cmd_flags,
625 uint16_t token);
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643struct dpni_attr {
644 uint32_t id;
645 uint32_t options;
646 uint8_t max_num_queues;
647 uint8_t max_num_tcs;
648 uint8_t max_mac_entries;
649 uint8_t max_vlan_entries;
650 uint8_t max_qos_entries;
651 uint16_t max_fs_entries;
652 uint8_t max_qos_key_size;
653 uint8_t max_fs_key_size;
654 uint16_t wriop_version;
655};
656
657
658
659
660
661
662
663
664
665
666int dpni_get_attributes(struct fsl_mc_io *mc_io,
667 uint32_t cmd_flags,
668 uint16_t token,
669 struct dpni_attr *attr);
670
671
672
673
674
675
676
677
678int dpni_extract_cfg(struct dpni_cfg *cfg,
679 const uint8_t *cfg_buf);
680
681
682
683
684
685
686
687
688#define DPNI_ERROR_EOFHE 0x00020000
689
690
691
692#define DPNI_ERROR_FLE 0x00002000
693
694
695
696#define DPNI_ERROR_FPE 0x00001000
697
698
699
700#define DPNI_ERROR_PHE 0x00000020
701
702
703
704#define DPNI_ERROR_L3CE 0x00000004
705
706
707
708#define DPNI_ERROR_L4CE 0x00000001
709
710
711
712
713
714
715
716enum dpni_error_action {
717 DPNI_ERROR_ACTION_DISCARD = 0,
718 DPNI_ERROR_ACTION_CONTINUE = 1,
719 DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2
720};
721
722
723
724
725
726
727
728
729struct dpni_error_cfg {
730 uint32_t errors;
731 enum dpni_error_action error_action;
732 int set_frame_annotation;
733};
734
735
736
737
738
739
740
741
742
743
744
745
746
747int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
748 uint32_t cmd_flags,
749 uint16_t token,
750 struct dpni_error_cfg *cfg);
751
752
753
754
755#define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001
756
757#define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002
758
759#define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004
760
761#define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008
762
763#define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010
764
765#define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020
766
767#define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040
768
769
770
771
772
773
774
775
776
777
778
779
780
781struct dpni_buffer_layout {
782 uint16_t options;
783 int pass_timestamp;
784 int pass_parser_result;
785 int pass_frame_status;
786 uint16_t private_data_size;
787 uint16_t data_align;
788 uint16_t data_head_room;
789 uint16_t data_tail_room;
790};
791
792
793
794
795
796
797
798
799
800
801
802int dpni_get_buffer_layout(struct fsl_mc_io *mc_io,
803 uint32_t cmd_flags,
804 uint16_t token,
805 const struct dpni_buffer_layout *layout,
806 enum dpni_queue_type type);
807
808
809
810
811
812
813
814
815
816
817
818
819
820int dpni_set_buffer_layout(struct fsl_mc_io *mc_io,
821 uint32_t cmd_flags,
822 uint16_t token,
823 const struct dpni_buffer_layout *layout,
824 enum dpni_queue_type type);
825
826
827
828
829
830
831
832
833
834
835
836
837int dpni_get_qdid(struct fsl_mc_io *mc_io,
838 uint32_t cmd_flags,
839 uint16_t token,
840 uint16_t *qdid);
841
842
843
844
845
846
847
848
849
850
851int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
852 uint32_t cmd_flags,
853 uint16_t token,
854 uint16_t *data_offset);
855
856
857#define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL
858
859#define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
860
861#define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL
862
863#define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
864
865
866
867
868
869
870struct dpni_link_cfg {
871 uint32_t rate;
872 uint64_t options;
873};
874
875
876
877
878
879
880
881
882
883
884int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
885 uint32_t cmd_flags,
886 uint16_t token,
887 const struct dpni_link_cfg *cfg);
888
889
890
891
892
893
894
895struct dpni_link_state {
896 uint32_t rate;
897 uint64_t options;
898 int up;
899};
900
901
902
903
904
905
906
907
908
909
910int dpni_get_link_state(struct fsl_mc_io *mc_io,
911 uint32_t cmd_flags,
912 uint16_t token,
913 struct dpni_link_state *state);
914
915
916
917
918
919
920
921
922
923
924int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
925 uint32_t cmd_flags,
926 uint16_t token,
927 const uint8_t mac_addr[6]);
928
929
930
931
932
933
934
935
936
937
938int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
939 uint32_t cmd_flags,
940 uint16_t token,
941 uint8_t mac_addr[6]);
942
943
944
945
946
947
948
949
950
951
952int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
953 uint32_t cmd_flags,
954 uint16_t token,
955 const uint8_t mac_addr[6]);
956
957
958
959
960
961
962
963
964
965
966int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
967 uint32_t cmd_flags,
968 uint16_t token,
969 const uint8_t mac_addr[6]);
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984enum dpni_dest {
985 DPNI_DEST_NONE = 0,
986 DPNI_DEST_DPIO = 1,
987 DPNI_DEST_DPCON = 2
988};
989
990
991
992
993
994
995
996
997
998struct dpni_dest_cfg {
999 enum dpni_dest dest_type;
1000 int dest_id;
1001 uint8_t priority;
1002};
1003
1004
1005
1006
1007
1008
1009enum dpni_flc_type {
1010 DPNI_FLC_USER_DEFINED = 0,
1011 DPNI_FLC_STASH = 1,
1012};
1013
1014
1015
1016
1017
1018
1019
1020
1021enum dpni_stash_size {
1022 DPNI_STASH_SIZE_0B = 0,
1023 DPNI_STASH_SIZE_64B = 1,
1024 DPNI_STASH_SIZE_128B = 2,
1025 DPNI_STASH_SIZE_192B = 3,
1026};
1027
1028
1029
1030
1031#define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048struct dpni_flc_cfg {
1049 enum dpni_flc_type flc_type;
1050 uint32_t options;
1051 enum dpni_stash_size frame_data_size;
1052 enum dpni_stash_size flow_context_size;
1053 uint64_t flow_context;
1054};
1055
1056
1057
1058
1059#define DPNI_QUEUE_OPT_USER_CTX 0x00000001
1060
1061#define DPNI_QUEUE_OPT_DEST 0x00000002
1062
1063
1064
1065#define DPNI_QUEUE_OPT_FLC 0x00000004
1066
1067#define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008
1068
1069#define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093struct dpni_queue_cfg {
1094 uint32_t options;
1095 uint64_t user_ctx;
1096 struct dpni_dest_cfg dest_cfg;
1097 struct dpni_flc_cfg flc_cfg;
1098 int order_preservation_en;
1099 uint32_t tail_drop_threshold;
1100};
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112struct dpni_queue_attr {
1113 uint64_t user_ctx;
1114 struct dpni_dest_cfg dest_cfg;
1115 struct dpni_flc_cfg flc_cfg;
1116 int order_preservation_en;
1117 uint32_t tail_drop_threshold;
1118 uint32_t fqid;
1119};
1120
1121
1122
1123
1124#define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001
1125
1126#define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010
1127
1128#define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140int dpni_get_api_version(struct fsl_mc_io *mc_io,
1141 u32 cmd_flags,
1142 u16 *major_ver,
1143 u16 *minor_ver);
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156enum dpni_confirmation_mode {
1157 DPNI_CONF_AFFINE,
1158 DPNI_CONF_SINGLE,
1159 DPNI_CONF_DISABLE,
1160};
1161
1162struct dpni_tx_confirmation_mode {
1163 uint32_t pad;
1164 uint8_t confirmation_mode;
1165};
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176struct dpni_queue {
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194 struct {
1195 uint32_t id;
1196 enum dpni_dest type;
1197 char hold_active;
1198 char stash_ctrl;
1199 } destination;
1200 uint8_t options;
1201 uint32_t fqid;
1202 uint16_t qdbin;
1203 uint64_t flc;
1204 uint64_t user_context;
1205};
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220int dpni_set_queue(struct fsl_mc_io *mc_io,
1221 uint32_t cmd_flags,
1222 uint16_t token,
1223 enum dpni_queue_type type,
1224 uint8_t tc,
1225 uint8_t index,
1226 const struct dpni_queue *queue);
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241int dpni_get_queue(struct fsl_mc_io *mc_io,
1242 uint32_t cmd_flags,
1243 uint16_t token,
1244 enum dpni_queue_type type,
1245 uint8_t tc,
1246 uint8_t index,
1247 struct dpni_queue *queue);
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io,
1259 uint32_t cmd_flags,
1260 uint16_t token,
1261 enum dpni_confirmation_mode mode);
1262struct dpni_statistics {
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289 uint64_t counter0;
1290 uint64_t counter1;
1291 uint64_t counter2;
1292 uint64_t counter3;
1293 uint64_t counter4;
1294 uint64_t counter5;
1295 uint64_t counter6;
1296};
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309int dpni_get_statistics(struct fsl_mc_io *mc_io,
1310 uint32_t cmd_flags,
1311 uint16_t token,
1312 uint8_t page,
1313 struct dpni_statistics *stat);
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323int dpni_reset_statistics(struct fsl_mc_io *mc_io,
1324 uint32_t cmd_flags,
1325 uint16_t token);
1326#endif
1327