net/softnic: fix useless address check
[dpdk.git] / drivers / net / dpaa2 / mc / fsl_dpni_cmd.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2016-2021 NXP
5  *
6  */
7 #ifndef _FSL_DPNI_CMD_H
8 #define _FSL_DPNI_CMD_H
9
10 /* DPNI Version */
11 #define DPNI_VER_MAJOR                          7
12 #define DPNI_VER_MINOR                          17
13
14 #define DPNI_CMD_BASE_VERSION                   1
15 #define DPNI_CMD_VERSION_2                      2
16 #define DPNI_CMD_VERSION_3                      3
17 #define DPNI_CMD_VERSION_4                      4
18 #define DPNI_CMD_VERSION_5                      5
19 #define DPNI_CMD_ID_OFFSET                      4
20
21 #define DPNI_CMD(id)    (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
22 #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_2)
23 #define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_3)
24 #define DPNI_CMD_V4(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_4)
25 #define DPNI_CMD_V5(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_5)
26
27 /* Command IDs */
28 #define DPNI_CMDID_OPEN                         DPNI_CMD(0x801)
29 #define DPNI_CMDID_CLOSE                        DPNI_CMD(0x800)
30 #define DPNI_CMDID_CREATE                       DPNI_CMD_V5(0x901)
31 #define DPNI_CMDID_DESTROY                      DPNI_CMD(0x981)
32 #define DPNI_CMDID_GET_API_VERSION              DPNI_CMD(0xa01)
33
34 #define DPNI_CMDID_ENABLE                       DPNI_CMD(0x002)
35 #define DPNI_CMDID_DISABLE                      DPNI_CMD(0x003)
36 #define DPNI_CMDID_GET_ATTR                     DPNI_CMD_V3(0x004)
37 #define DPNI_CMDID_RESET                        DPNI_CMD(0x005)
38 #define DPNI_CMDID_IS_ENABLED                   DPNI_CMD(0x006)
39
40 #define DPNI_CMDID_SET_IRQ_ENABLE               DPNI_CMD(0x012)
41 #define DPNI_CMDID_GET_IRQ_ENABLE               DPNI_CMD(0x013)
42 #define DPNI_CMDID_SET_IRQ_MASK                 DPNI_CMD(0x014)
43 #define DPNI_CMDID_GET_IRQ_MASK                 DPNI_CMD(0x015)
44 #define DPNI_CMDID_GET_IRQ_STATUS               DPNI_CMD(0x016)
45 #define DPNI_CMDID_CLEAR_IRQ_STATUS             DPNI_CMD(0x017)
46
47 #define DPNI_CMDID_SET_POOLS                    DPNI_CMD_V3(0x200)
48 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR          DPNI_CMD(0x20B)
49
50 #define DPNI_CMDID_GET_QDID                     DPNI_CMD(0x210)
51 #define DPNI_CMDID_GET_SP_INFO                  DPNI_CMD(0x211)
52 #define DPNI_CMDID_GET_TX_DATA_OFFSET           DPNI_CMD(0x212)
53 #define DPNI_CMDID_GET_LINK_STATE               DPNI_CMD_V2(0x215)
54 #define DPNI_CMDID_SET_MAX_FRAME_LENGTH         DPNI_CMD(0x216)
55 #define DPNI_CMDID_GET_MAX_FRAME_LENGTH         DPNI_CMD(0x217)
56 #define DPNI_CMDID_SET_LINK_CFG                 DPNI_CMD_V2(0x21A)
57 #define DPNI_CMDID_SET_TX_SHAPING               DPNI_CMD_V2(0x21B)
58
59 #define DPNI_CMDID_SET_MCAST_PROMISC            DPNI_CMD(0x220)
60 #define DPNI_CMDID_GET_MCAST_PROMISC            DPNI_CMD(0x221)
61 #define DPNI_CMDID_SET_UNICAST_PROMISC          DPNI_CMD(0x222)
62 #define DPNI_CMDID_GET_UNICAST_PROMISC          DPNI_CMD(0x223)
63 #define DPNI_CMDID_SET_PRIM_MAC                 DPNI_CMD(0x224)
64 #define DPNI_CMDID_GET_PRIM_MAC                 DPNI_CMD(0x225)
65 #define DPNI_CMDID_ADD_MAC_ADDR                 DPNI_CMD_V2(0x226)
66 #define DPNI_CMDID_REMOVE_MAC_ADDR              DPNI_CMD(0x227)
67 #define DPNI_CMDID_CLR_MAC_FILTERS              DPNI_CMD(0x228)
68
69 #define DPNI_CMDID_ENABLE_VLAN_FILTER           DPNI_CMD(0x230)
70 #define DPNI_CMDID_ADD_VLAN_ID                  DPNI_CMD_V2(0x231)
71 #define DPNI_CMDID_REMOVE_VLAN_ID               DPNI_CMD(0x232)
72 #define DPNI_CMDID_CLR_VLAN_FILTERS             DPNI_CMD(0x233)
73
74 #define DPNI_CMDID_SET_RX_TC_DIST               DPNI_CMD_V4(0x235)
75
76 #define DPNI_CMDID_SET_RX_TC_POLICING           DPNI_CMD(0x23E)
77
78 #define DPNI_CMDID_SET_QOS_TBL                  DPNI_CMD_V2(0x240)
79 #define DPNI_CMDID_ADD_QOS_ENT                  DPNI_CMD_V2(0x241)
80 #define DPNI_CMDID_REMOVE_QOS_ENT               DPNI_CMD(0x242)
81 #define DPNI_CMDID_CLR_QOS_TBL                  DPNI_CMD(0x243)
82 #define DPNI_CMDID_ADD_FS_ENT                   DPNI_CMD_V2(0x244)
83 #define DPNI_CMDID_REMOVE_FS_ENT                DPNI_CMD(0x245)
84 #define DPNI_CMDID_CLR_FS_ENT                   DPNI_CMD(0x246)
85
86 #define DPNI_CMDID_SET_TX_PRIORITIES            DPNI_CMD_V2(0x250)
87 #define DPNI_CMDID_GET_RX_TC_POLICING           DPNI_CMD(0x251)
88
89 #define DPNI_CMDID_GET_STATISTICS               DPNI_CMD_V3(0x25D)
90 #define DPNI_CMDID_RESET_STATISTICS             DPNI_CMD(0x25E)
91 #define DPNI_CMDID_GET_QUEUE                    DPNI_CMD_V2(0x25F)
92 #define DPNI_CMDID_SET_QUEUE                    DPNI_CMD_V2(0x260)
93 #define DPNI_CMDID_GET_TAILDROP                 DPNI_CMD_V2(0x261)
94 #define DPNI_CMDID_SET_TAILDROP                 DPNI_CMD_V2(0x262)
95
96 #define DPNI_CMDID_GET_PORT_MAC_ADDR            DPNI_CMD(0x263)
97
98 #define DPNI_CMDID_GET_BUFFER_LAYOUT            DPNI_CMD_V2(0x264)
99 #define DPNI_CMDID_SET_BUFFER_LAYOUT            DPNI_CMD_V2(0x265)
100
101 #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION  DPNI_CMD_V2(0x267)
102 #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION  DPNI_CMD_V2(0x268)
103 #define DPNI_CMDID_SET_EARLY_DROP               DPNI_CMD_V2(0x269)
104 #define DPNI_CMDID_GET_EARLY_DROP               DPNI_CMD_V2(0x26A)
105 #define DPNI_CMDID_GET_OFFLOAD                  DPNI_CMD(0x26B)
106 #define DPNI_CMDID_SET_OFFLOAD                  DPNI_CMD(0x26C)
107 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE     DPNI_CMD(0x266)
108 #define DPNI_CMDID_GET_TX_CONFIRMATION_MODE     DPNI_CMD(0x26D)
109 #define DPNI_CMDID_LOAD_SW_SEQUENCE             DPNI_CMD(0x270)
110 #define DPNI_CMDID_ENABLE_SW_SEQUENCE           DPNI_CMD(0x271)
111 #define DPNI_CMDID_GET_SW_SEQUENCE_LAYOUT       DPNI_CMD(0x272)
112 #define DPNI_CMDID_SET_OPR                      DPNI_CMD(0x26e)
113 #define DPNI_CMDID_GET_OPR                      DPNI_CMD(0x26f)
114 #define DPNI_CMDID_SET_RX_FS_DIST               DPNI_CMD(0x273)
115 #define DPNI_CMDID_SET_RX_HASH_DIST             DPNI_CMD(0x274)
116 #define DPNI_CMDID_ADD_CUSTOM_TPID              DPNI_CMD(0x275)
117 #define DPNI_CMDID_REMOVE_CUSTOM_TPID           DPNI_CMD(0x276)
118 #define DPNI_CMDID_GET_CUSTOM_TPID              DPNI_CMD(0x277)
119
120 /* Macros for accessing command fields smaller than 1byte */
121 #define DPNI_MASK(field)        \
122         GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
123                 DPNI_##field##_SHIFT)
124 #define dpni_set_field(var, field, val) \
125         ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
126 #define dpni_get_field(var, field)      \
127         (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
128
129 #pragma pack(push, 1)
130 struct dpni_cmd_open {
131         uint32_t dpni_id;
132 };
133
134 struct dpni_cmd_create {
135         uint32_t options;
136         uint8_t num_queues;
137         uint8_t num_tcs;
138         uint8_t mac_filter_entries;
139         uint8_t pad1;
140         uint8_t vlan_filter_entries;
141         uint8_t pad2;
142         uint8_t qos_entries;
143         uint8_t pad3;
144         uint16_t fs_entries;
145         uint8_t num_rx_tcs;
146         uint8_t pad4;
147         uint8_t  num_cgs;
148         uint16_t num_opr;
149         uint8_t dist_key_size;
150 };
151
152 struct dpni_cmd_destroy {
153         uint32_t dpsw_id;
154 };
155
156 #define DPNI_BACKUP_POOL(val, order)    (((val) & 0x1) << (order))
157
158 struct dpni_cmd_pool {
159         uint16_t dpbp_id;
160         uint8_t priority_mask;
161         uint8_t pad;
162 };
163
164 struct dpni_cmd_set_pools {
165         uint8_t num_dpbp;
166         uint8_t backup_pool_mask;
167         uint8_t pad;
168         uint8_t pool_options;
169         struct dpni_cmd_pool pool[8];
170         uint16_t buffer_size[8];
171 };
172
173 /* The enable indication is always the least significant bit */
174 #define DPNI_ENABLE_SHIFT               0
175 #define DPNI_ENABLE_SIZE                1
176
177 struct dpni_rsp_is_enabled {
178         uint8_t enabled;
179 };
180
181 struct dpni_cmd_set_irq_enable {
182         uint8_t enable;
183         uint8_t pad[3];
184         uint8_t irq_index;
185 };
186
187 struct dpni_cmd_get_irq_enable {
188         uint32_t pad;
189         uint8_t irq_index;
190 };
191
192 struct dpni_rsp_get_irq_enable {
193         uint8_t enabled;
194 };
195
196 struct dpni_cmd_set_irq_mask {
197         uint32_t mask;
198         uint8_t irq_index;
199 };
200
201 struct dpni_cmd_get_irq_mask {
202         uint32_t pad;
203         uint8_t irq_index;
204 };
205
206 struct dpni_rsp_get_irq_mask {
207         uint32_t mask;
208 };
209
210 struct dpni_cmd_get_irq_status {
211         uint32_t status;
212         uint8_t irq_index;
213 };
214
215 struct dpni_rsp_get_irq_status {
216         uint32_t status;
217 };
218
219 struct dpni_cmd_clear_irq_status {
220         uint32_t status;
221         uint8_t irq_index;
222 };
223
224 struct dpni_rsp_get_attr {
225         /* response word 0 */
226         uint32_t options;
227         uint8_t num_queues;
228         uint8_t num_rx_tcs;
229         uint8_t mac_filter_entries;
230         uint8_t num_tx_tcs;
231         /* response word 1 */
232         uint8_t vlan_filter_entries;
233         uint8_t pad1;
234         uint8_t qos_entries;
235         uint8_t pad2;
236         uint16_t fs_entries;
237         uint16_t pad3;
238         /* response word 2 */
239         uint8_t qos_key_size;
240         uint8_t fs_key_size;
241         uint16_t wriop_version;
242         uint8_t num_cgs;
243 };
244
245 #define DPNI_ERROR_ACTION_SHIFT         0
246 #define DPNI_ERROR_ACTION_SIZE          4
247 #define DPNI_FRAME_ANN_SHIFT            4
248 #define DPNI_FRAME_ANN_SIZE             1
249
250 struct dpni_cmd_set_errors_behavior {
251         uint32_t errors;
252         /* from least significant bit: error_action:4, set_frame_annotation:1 */
253         uint8_t flags;
254 };
255
256 /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
257  * buffer layouts, but they all share the same parameters.
258  * If one of the functions changes, below structure needs to be split.
259  */
260
261 #define DPNI_PASS_TS_SHIFT              0
262 #define DPNI_PASS_TS_SIZE               1
263 #define DPNI_PASS_PR_SHIFT              1
264 #define DPNI_PASS_PR_SIZE               1
265 #define DPNI_PASS_FS_SHIFT              2
266 #define DPNI_PASS_FS_SIZE               1
267 #define DPNI_PASS_SWO_SHIFT             3
268 #define DPNI_PASS_SWO_SIZE              1
269
270 struct dpni_cmd_get_buffer_layout {
271         uint8_t qtype;
272 };
273
274 struct dpni_rsp_get_buffer_layout {
275         /* response word 0 */
276         uint8_t pad0[6];
277         /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
278         uint8_t flags;
279         uint8_t pad1;
280         /* response word 1 */
281         uint16_t private_data_size;
282         uint16_t data_align;
283         uint16_t head_room;
284         uint16_t tail_room;
285 };
286
287 struct dpni_cmd_set_buffer_layout {
288         /* cmd word 0 */
289         uint8_t qtype;
290         uint8_t pad0[3];
291         uint16_t options;
292         /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
293         uint8_t flags;
294         uint8_t pad1;
295         /* cmd word 1 */
296         uint16_t private_data_size;
297         uint16_t data_align;
298         uint16_t head_room;
299         uint16_t tail_room;
300 };
301
302 struct dpni_cmd_set_offload {
303         uint8_t pad[3];
304         uint8_t dpni_offload;
305         uint32_t config;
306 };
307
308 struct dpni_cmd_get_offload {
309         uint8_t pad[3];
310         uint8_t dpni_offload;
311 };
312
313 struct dpni_rsp_get_offload {
314         uint32_t pad;
315         uint32_t config;
316 };
317
318 struct dpni_cmd_get_qdid {
319         uint8_t qtype;
320 };
321
322 struct dpni_rsp_get_qdid {
323         uint16_t qdid;
324 };
325
326 struct dpni_rsp_get_sp_info {
327         uint16_t spids[2];
328 };
329
330 struct dpni_rsp_get_tx_data_offset {
331         uint16_t data_offset;
332 };
333
334 struct dpni_cmd_get_statistics {
335         uint8_t page_number;
336         uint16_t param;
337 };
338
339 struct dpni_rsp_get_statistics {
340         uint64_t counter[7];
341 };
342
343 struct dpni_cmd_set_link_cfg {
344         uint64_t pad0;
345         uint32_t rate;
346         uint32_t pad1;
347         uint64_t options;
348         uint64_t advertising;
349 };
350
351 #define DPNI_LINK_STATE_SHIFT           0
352 #define DPNI_LINK_STATE_SIZE            1
353 #define DPNI_STATE_VALID_SHIFT          1
354 #define DPNI_STATE_VALID_SIZE           1
355
356 struct dpni_rsp_get_link_state {
357         uint32_t pad0;
358         /* from LSB: up:1 */
359         uint8_t flags;
360         uint8_t pad1[3];
361         uint32_t rate;
362         uint32_t pad2;
363         uint64_t options;
364         uint64_t supported;
365         uint64_t advertising;
366 };
367
368 #define DPNI_COUPLED_SHIFT      0
369 #define DPNI_COUPLED_SIZE       1
370
371 struct dpni_cmd_set_tx_shaping {
372         uint16_t tx_cr_max_burst_size;
373         uint16_t tx_er_max_burst_size;
374         uint32_t pad;
375         uint32_t tx_cr_rate_limit;
376         uint32_t tx_er_rate_limit;
377         /* from LSB: coupled:1 */
378         uint8_t coupled;
379 };
380
381 struct dpni_cmd_set_max_frame_length {
382         uint16_t max_frame_length;
383 };
384
385 struct dpni_rsp_get_max_frame_length {
386         uint16_t max_frame_length;
387 };
388
389 struct dpni_cmd_set_multicast_promisc {
390         uint8_t enable;
391 };
392
393 struct dpni_rsp_get_multicast_promisc {
394         uint8_t enabled;
395 };
396
397 struct dpni_cmd_set_unicast_promisc {
398         uint8_t enable;
399 };
400
401 struct dpni_rsp_get_unicast_promisc {
402         uint8_t enabled;
403 };
404
405 struct dpni_cmd_set_primary_mac_addr {
406         uint16_t pad;
407         uint8_t mac_addr[6];
408 };
409
410 struct dpni_rsp_get_primary_mac_addr {
411         uint16_t pad;
412         uint8_t mac_addr[6];
413 };
414
415 struct dpni_rsp_get_port_mac_addr {
416         uint16_t pad;
417         uint8_t mac_addr[6];
418 };
419
420 struct dpni_cmd_add_mac_addr {
421         uint8_t flags;
422         uint8_t pad;
423         uint8_t mac_addr[6];
424         uint8_t tc_id;
425         uint8_t fq_id;
426 };
427
428 struct dpni_cmd_remove_mac_addr {
429         uint16_t pad;
430         uint8_t mac_addr[6];
431 };
432
433 #define DPNI_UNICAST_FILTERS_SHIFT      0
434 #define DPNI_UNICAST_FILTERS_SIZE       1
435 #define DPNI_MULTICAST_FILTERS_SHIFT    1
436 #define DPNI_MULTICAST_FILTERS_SIZE     1
437
438 struct dpni_cmd_clear_mac_filters {
439         /* from LSB: unicast:1, multicast:1 */
440         uint8_t flags;
441 };
442
443 struct dpni_cmd_enable_vlan_filter {
444         /* only the LSB */
445         uint8_t en;
446 };
447
448 #define DPNI_VLAN_SET_QUEUE_ACTION 1
449
450 struct dpni_cmd_vlan_id {
451         uint8_t flags;
452         uint8_t tc_id;
453         uint8_t flow_id;
454         uint8_t pad;
455         uint16_t vlan_id;
456 };
457
458 #define DPNI_SEPARATE_GRP_SHIFT 0
459 #define DPNI_SEPARATE_GRP_SIZE  1
460 #define DPNI_MODE_1_SHIFT               0
461 #define DPNI_MODE_1_SIZE                4
462 #define DPNI_MODE_2_SHIFT               4
463 #define DPNI_MODE_2_SIZE                4
464
465 struct dpni_cmd_set_tx_priorities {
466         uint16_t flags;
467         uint8_t prio_group_A;
468         uint8_t prio_group_B;
469         uint32_t pad0;
470         uint8_t modes[4];
471         uint32_t pad1;
472         uint64_t pad2;
473         uint16_t delta_bandwidth[8];
474 };
475
476 #define DPNI_DIST_MODE_SHIFT            0
477 #define DPNI_DIST_MODE_SIZE             4
478 #define DPNI_MISS_ACTION_SHIFT          4
479 #define DPNI_MISS_ACTION_SIZE           4
480 #define DPNI_KEEP_HASH_KEY_SHIFT        7
481 #define DPNI_KEEP_HASH_KEY_SIZE         1
482 #define DPNI_KEEP_ENTRIES_SHIFT         6
483 #define DPNI_KEEP_ENTRIES_SIZE          1
484
485 struct dpni_cmd_set_rx_tc_dist {
486         uint16_t dist_size;
487         uint8_t tc_id;
488         /* from LSB: dist_mode:4, miss_action:4 */
489         uint8_t flags;
490         uint8_t pad0;
491         /* only the LSB */
492         uint8_t keep_hash_key;
493         uint16_t default_flow_id;
494         uint64_t pad1[5];
495         uint64_t key_cfg_iova;
496 };
497
498 struct dpni_cmd_get_queue {
499         uint8_t qtype;
500         uint8_t tc;
501         uint8_t index;
502 };
503
504 #define DPNI_DEST_TYPE_SHIFT            0
505 #define DPNI_DEST_TYPE_SIZE             4
506 #define DPNI_CGID_VALID_SHIFT           5
507 #define DPNI_CGID_VALID_SIZE            1
508 #define DPNI_STASH_CTRL_SHIFT           6
509 #define DPNI_STASH_CTRL_SIZE            1
510 #define DPNI_HOLD_ACTIVE_SHIFT          7
511 #define DPNI_HOLD_ACTIVE_SIZE           1
512
513 struct dpni_rsp_get_queue {
514         /* response word 0 */
515         uint64_t pad0;
516         /* response word 1 */
517         uint32_t dest_id;
518         uint16_t pad1;
519         uint8_t dest_prio;
520         /* From LSB:
521          * dest_type:4, pad:1, cgid_valid:1, flc_stash_ctrl:1, hold_active:1
522          */
523         uint8_t flags;
524         /* response word 2 */
525         uint64_t flc;
526         /* response word 3 */
527         uint64_t user_context;
528         /* response word 4 */
529         uint32_t fqid;
530         uint16_t qdbin;
531         uint16_t pad2;
532         /* response word 5*/
533         uint8_t cgid;
534 };
535
536 struct dpni_cmd_set_queue {
537         /* cmd word 0 */
538         uint8_t qtype;
539         uint8_t tc;
540         uint8_t index;
541         uint8_t options;
542         uint32_t pad0;
543         /* cmd word 1 */
544         uint32_t dest_id;
545         uint16_t pad1;
546         uint8_t dest_prio;
547         uint8_t flags;
548         /* cmd word 2 */
549         uint64_t flc;
550         /* cmd word 3 */
551         uint64_t user_context;
552         /* cmd word 4 */
553         uint8_t cgid;
554 };
555
556 #define DPNI_DISCARD_ON_MISS_SHIFT      0
557 #define DPNI_DISCARD_ON_MISS_SIZE       1
558 #define DPNI_KEEP_QOS_ENTRIES_SHIFT             1
559 #define DPNI_KEEP_QOS_ENTRIES_SIZE              1
560
561 struct dpni_cmd_set_qos_table {
562         uint32_t pad;
563         uint8_t default_tc;
564         /* only the LSB */
565         uint8_t discard_on_miss;
566         uint16_t pad1[21];
567         uint64_t key_cfg_iova;
568 };
569
570 #define DPNI_QOS_OPT_SET_TC_ONLY 0x0
571 #define DPNI_QOS_OPT_SET_FLOW_ID 0x1
572
573 struct dpni_cmd_add_qos_entry {
574         uint8_t flags;
575         uint8_t flow_id;
576         uint8_t tc_id;
577         uint8_t key_size;
578         uint16_t index;
579         uint16_t pad2;
580         uint64_t key_iova;
581         uint64_t mask_iova;
582 };
583
584 struct dpni_cmd_remove_qos_entry {
585         uint8_t pad1[3];
586         uint8_t key_size;
587         uint32_t pad2;
588         uint64_t key_iova;
589         uint64_t mask_iova;
590 };
591
592 struct dpni_cmd_add_fs_entry {
593         uint16_t options;
594         uint8_t tc_id;
595         uint8_t key_size;
596         uint16_t index;
597         uint16_t flow_id;
598         uint64_t key_iova;
599         uint64_t mask_iova;
600         uint64_t flc;
601         uint16_t redir_token;
602 };
603
604 struct dpni_cmd_remove_fs_entry {
605         uint16_t pad1;
606         uint8_t tc_id;
607         uint8_t key_size;
608         uint32_t pad2;
609         uint64_t key_iova;
610         uint64_t mask_iova;
611 };
612
613 struct dpni_cmd_clear_fs_entries {
614         uint16_t pad;
615         uint8_t tc_id;
616 };
617
618 #define DPNI_MODE_SHIFT         0
619 #define DPNI_MODE_SIZE          4
620 #define DPNI_COLOR_SHIFT        4
621 #define DPNI_COLOR_SIZE         4
622 #define DPNI_UNITS_SHIFT        0
623 #define DPNI_UNITS_SIZE         4
624
625 struct dpni_cmd_set_rx_tc_policing {
626         /* from LSB: mode:4 color:4 */
627         uint8_t mode_color;
628         /* from LSB: units: 4 */
629         uint8_t units;
630         uint8_t tc_id;
631         uint8_t pad;
632         uint32_t options;
633         uint32_t cir;
634         uint32_t cbs;
635         uint32_t eir;
636         uint32_t ebs;
637 };
638
639 struct dpni_cmd_get_rx_tc_policing {
640         uint16_t pad;
641         uint8_t tc_id;
642 };
643
644 struct dpni_rsp_get_rx_tc_policing {
645         /* from LSB: mode:4 color:4 */
646         uint8_t mode_color;
647         /* from LSB: units: 4 */
648         uint8_t units;
649         uint16_t pad;
650         uint32_t options;
651         uint32_t cir;
652         uint32_t cbs;
653         uint32_t eir;
654         uint32_t ebs;
655 };
656
657 #define DPNI_DROP_ENABLE_SHIFT  0
658 #define DPNI_DROP_ENABLE_SIZE   1
659 #define DPNI_DROP_UNITS_SHIFT   2
660 #define DPNI_DROP_UNITS_SIZE    2
661
662 struct dpni_early_drop {
663         /* from LSB: enable:1 units:2 */
664         uint8_t flags;
665         uint8_t pad0[3];
666         uint32_t pad1;
667         uint8_t green_drop_probability;
668         uint8_t pad2[7];
669         uint64_t green_max_threshold;
670         uint64_t green_min_threshold;
671         uint64_t pad3;
672         uint8_t yellow_drop_probability;
673         uint8_t pad4[7];
674         uint64_t yellow_max_threshold;
675         uint64_t yellow_min_threshold;
676         uint64_t pad5;
677         uint8_t red_drop_probability;
678         uint8_t pad6[7];
679         uint64_t red_max_threshold;
680         uint64_t red_min_threshold;
681 };
682
683 struct dpni_cmd_early_drop {
684         uint8_t qtype;
685         uint8_t tc;
686         uint8_t pad[6];
687         uint64_t early_drop_iova;
688 };
689
690 struct dpni_rsp_get_api_version {
691         uint16_t major;
692         uint16_t minor;
693 };
694
695 struct dpni_cmd_get_taildrop {
696         uint8_t congestion_point;
697         uint8_t qtype;
698         uint8_t tc;
699         uint8_t index;
700 };
701
702 struct dpni_rsp_get_taildrop {
703         /* cmd word 0 */
704         uint64_t pad0;
705         /* cmd word 1 */
706         /* from LSB: enable:1 oal_lo:7 */
707         uint8_t enable_oal_lo;
708         /* from LSB: oal_hi:5 */
709         uint8_t oal_hi;
710         uint8_t units;
711         uint8_t pad2;
712         uint32_t threshold;
713 };
714
715 #define DPNI_OAL_LO_SHIFT       1
716 #define DPNI_OAL_LO_SIZE        7
717 #define DPNI_OAL_HI_SHIFT       0
718 #define DPNI_OAL_HI_SIZE        5
719
720 struct dpni_cmd_set_taildrop {
721         /* cmd word 0 */
722         uint8_t congestion_point;
723         uint8_t qtype;
724         uint8_t tc;
725         uint8_t index;
726         uint32_t pad0;
727         /* cmd word 1 */
728         /* from LSB: enable:1 oal_lo:7 */
729         uint8_t enable_oal_lo;
730         /* from LSB: oal_hi:5 */
731         uint8_t oal_hi;
732         uint8_t units;
733         uint8_t pad2;
734         uint32_t threshold;
735 };
736
737 struct dpni_tx_confirmation_mode {
738         uint32_t pad;
739         uint8_t confirmation_mode;
740 };
741
742 #define DPNI_DEST_TYPE_SHIFT            0
743 #define DPNI_DEST_TYPE_SIZE             4
744 #define DPNI_CONG_UNITS_SHIFT           4
745 #define DPNI_CONG_UNITS_SIZE            2
746
747 struct dpni_cmd_set_congestion_notification {
748         uint8_t qtype;
749         uint8_t tc;
750         uint8_t pad;
751         uint8_t congestion_point;
752         uint8_t cgid;
753         uint8_t pad2[3];
754         uint32_t dest_id;
755         uint16_t notification_mode;
756         uint8_t dest_priority;
757         /* from LSB: dest_type: 4 units:2 */
758         uint8_t type_units;
759         uint64_t message_iova;
760         uint64_t message_ctx;
761         uint32_t threshold_entry;
762         uint32_t threshold_exit;
763 };
764
765 struct dpni_cmd_get_congestion_notification {
766         uint8_t qtype;
767         uint8_t tc;
768         uint8_t pad;
769         uint8_t congestion_point;
770         uint8_t cgid;
771 };
772
773 struct dpni_rsp_get_congestion_notification {
774         uint64_t pad;
775         uint32_t dest_id;
776         uint16_t notification_mode;
777         uint8_t dest_priority;
778         /* from LSB: dest_type: 4 units:2 */
779         uint8_t type_units;
780         uint64_t message_iova;
781         uint64_t message_ctx;
782         uint32_t threshold_entry;
783         uint32_t threshold_exit;
784 };
785
786 struct dpni_cmd_set_opr {
787         uint8_t opr_id;
788         uint8_t tc_id;
789         uint8_t index;
790         uint8_t options;
791         uint8_t pad1[7];
792         uint8_t oloe;
793         uint8_t oeane;
794         uint8_t olws;
795         uint8_t oa;
796         uint8_t oprrws;
797 };
798
799 struct dpni_cmd_get_opr {
800         uint8_t flags;
801         uint8_t tc_id;
802         uint8_t index;
803         uint8_t opr_id;
804 };
805
806 #define DPNI_RIP_SHIFT  0
807 #define DPNI_RIP_SIZE           1
808 #define DPNI_OPR_ENABLE_SHIFT   1
809 #define DPNI_OPR_ENABLE_SIZE    1
810 #define DPNI_TSEQ_NLIS_SHIFT    0
811 #define DPNI_TSEQ_NLIS_SIZE     1
812 #define DPNI_HSEQ_NLIS_SHIFT    0
813 #define DPNI_HSEQ_NLIS_SIZE     1
814
815 struct dpni_rsp_get_opr {
816         uint64_t pad0;
817         /* from LSB: rip:1 enable:1 */
818         uint8_t flags;
819         uint16_t pad1;
820         uint8_t oloe;
821         uint8_t oeane;
822         uint8_t olws;
823         uint8_t oa;
824         uint8_t oprrws;
825         uint16_t nesn;
826         uint16_t pad8;
827         uint16_t ndsn;
828         uint16_t pad2;
829         uint16_t ea_tseq;
830         /* only the LSB */
831         uint8_t tseq_nlis;
832         uint8_t pad3;
833         uint16_t ea_hseq;
834         /* only the LSB */
835         uint8_t hseq_nlis;
836         uint8_t pad4;
837         uint16_t ea_hptr;
838         uint16_t pad5;
839         uint16_t ea_tptr;
840         uint16_t pad6;
841         uint16_t opr_vid;
842         uint16_t pad7;
843         uint16_t opr_id;
844 };
845
846 struct dpni_cmd_add_custom_tpid {
847         uint16_t        pad;
848         uint16_t        tpid;
849 };
850
851 struct dpni_cmd_remove_custom_tpid {
852         uint16_t        pad;
853         uint16_t        tpid;
854 };
855
856 struct dpni_rsp_get_custom_tpid {
857         uint16_t        tpid1;
858         uint16_t        tpid2;
859 };
860
861 #define DPNI_RX_FS_DIST_ENABLE_SHIFT    0
862 #define DPNI_RX_FS_DIST_ENABLE_SIZE             1
863 struct dpni_cmd_set_rx_fs_dist {
864         uint16_t        dist_size;
865         uint8_t         enable;
866         uint8_t         tc;
867         uint16_t        miss_flow_id;
868         uint16_t        pad1;
869         uint64_t        key_cfg_iova;
870 };
871
872 #define DPNI_RX_HASH_DIST_ENABLE_SHIFT  0
873 #define DPNI_RX_HASH_DIST_ENABLE_SIZE           1
874 struct dpni_cmd_set_rx_hash_dist {
875         uint16_t        dist_size;
876         uint8_t         enable;
877         uint8_t         tc_id;
878         uint32_t        pad;
879         uint64_t        key_cfg_iova;
880 };
881
882 struct dpni_load_sw_sequence {
883         uint8_t dest;
884         uint8_t pad0[7];
885         uint16_t ss_offset;
886         uint16_t pad1;
887         uint16_t ss_size;
888         uint16_t pad2;
889         uint64_t ss_iova;
890 };
891
892 struct dpni_enable_sw_sequence {
893         uint8_t dest;
894         uint8_t pad0[7];
895         uint16_t ss_offset;
896         uint16_t hxs;
897         uint8_t set_start;
898         uint8_t pad1[3];
899         uint8_t param_offset;
900         uint8_t pad2[3];
901         uint8_t param_size;
902         uint8_t pad3[3];
903         uint64_t param_iova;
904 };
905
906 struct dpni_get_sw_sequence_layout {
907         uint8_t src;
908         uint8_t pad0[7];
909         uint64_t layout_iova;
910 };
911
912 struct dpni_sw_sequence_layout_entry {
913         uint16_t ss_offset;
914         uint16_t ss_size;
915         uint8_t param_offset;
916         uint8_t param_size;
917         uint16_t pad;
918 };
919
920 #define DPNI_PTP_ENABLE_SHIFT                   0
921 #define DPNI_PTP_ENABLE_SIZE                    1
922 #define DPNI_PTP_CH_UPDATE_SHIFT                1
923 #define DPNI_PTP_CH_UPDATE_SIZE                 1
924 struct dpni_cmd_single_step_cfg {
925         uint16_t        flags;
926         uint16_t        offset;
927         uint32_t        peer_delay;
928 };
929
930 struct dpni_rsp_single_step_cfg {
931         uint16_t        flags;
932         uint16_t        offset;
933         uint32_t        peer_delay;
934 };
935
936 #define DPNI_PORT_LOOPBACK_EN_SHIFT     0
937 #define DPNI_PORT_LOOPBACK_EN_SIZE      1
938
939 struct dpni_cmd_set_port_cfg {
940         uint32_t        flags;
941         uint32_t        bit_params;
942 };
943
944 struct dpni_rsp_get_port_cfg {
945         uint32_t        flags;
946         uint32_t        bit_params;
947 };
948
949 #pragma pack(pop)
950 #endif /* _FSL_DPNI_CMD_H */