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