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