dfaccd91cfac278c3854c05bf19d1eb5f4114d5e
[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-2019 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                          9
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_V3(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_V3(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_V3(0x25D)
81 #define DPNI_CMDID_RESET_STATISTICS             DPNI_CMD(0x25E)
82 #define DPNI_CMDID_GET_QUEUE                    DPNI_CMD_V2(0x25F)
83 #define DPNI_CMDID_SET_QUEUE                    DPNI_CMD_V2(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_V2(0x267)
93 #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION  DPNI_CMD_V2(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_LOAD_SW_SEQUENCE             DPNI_CMD(0x270)
101 #define DPNI_CMDID_ENABLE_SW_SEQUENCE           DPNI_CMD(0x271)
102 #define DPNI_CMDID_GET_SW_SEQUENCE_LAYOUT       DPNI_CMD(0x272)
103 #define DPNI_CMDID_SET_OPR                      DPNI_CMD(0x26e)
104 #define DPNI_CMDID_GET_OPR                      DPNI_CMD(0x26f)
105 #define DPNI_CMDID_SET_RX_FS_DIST               DPNI_CMD(0x273)
106 #define DPNI_CMDID_SET_RX_HASH_DIST             DPNI_CMD(0x274)
107 #define DPNI_CMDID_ADD_CUSTOM_TPID              DPNI_CMD(0x275)
108 #define DPNI_CMDID_REMOVE_CUSTOM_TPID           DPNI_CMD(0x276)
109 #define DPNI_CMDID_GET_CUSTOM_TPID              DPNI_CMD(0x277)
110
111 /* Macros for accessing command fields smaller than 1byte */
112 #define DPNI_MASK(field)        \
113         GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
114                 DPNI_##field##_SHIFT)
115 #define dpni_set_field(var, field, val) \
116         ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
117 #define dpni_get_field(var, field)      \
118         (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
119
120 #pragma pack(push, 1)
121 struct dpni_cmd_open {
122         uint32_t dpni_id;
123 };
124
125 struct dpni_cmd_create {
126         uint32_t options;
127         uint8_t num_queues;
128         uint8_t num_tcs;
129         uint8_t mac_filter_entries;
130         uint8_t pad1;
131         uint8_t vlan_filter_entries;
132         uint8_t pad2;
133         uint8_t qos_entries;
134         uint8_t pad3;
135         uint16_t fs_entries;
136         uint8_t num_rx_tcs;
137         uint8_t pad4;
138         uint8_t num_cgs;
139 };
140
141 struct dpni_cmd_destroy {
142         uint32_t dpsw_id;
143 };
144
145 #define DPNI_BACKUP_POOL(val, order)    (((val) & 0x1) << (order))
146
147 struct dpni_cmd_pool {
148         uint16_t dpbp_id;
149         uint8_t priority_mask;
150         uint8_t pad;
151 };
152
153 struct dpni_cmd_set_pools {
154         uint8_t num_dpbp;
155         uint8_t backup_pool_mask;
156         uint16_t pad;
157         struct dpni_cmd_pool pool[8];
158         uint16_t buffer_size[8];
159 };
160
161 /* The enable indication is always the least significant bit */
162 #define DPNI_ENABLE_SHIFT               0
163 #define DPNI_ENABLE_SIZE                1
164
165 struct dpni_rsp_is_enabled {
166         uint8_t enabled;
167 };
168
169 struct dpni_cmd_set_irq_enable {
170         uint8_t enable;
171         uint8_t pad[3];
172         uint8_t irq_index;
173 };
174
175 struct dpni_cmd_get_irq_enable {
176         uint32_t pad;
177         uint8_t irq_index;
178 };
179
180 struct dpni_rsp_get_irq_enable {
181         uint8_t enabled;
182 };
183
184 struct dpni_cmd_set_irq_mask {
185         uint32_t mask;
186         uint8_t irq_index;
187 };
188
189 struct dpni_cmd_get_irq_mask {
190         uint32_t pad;
191         uint8_t irq_index;
192 };
193
194 struct dpni_rsp_get_irq_mask {
195         uint32_t mask;
196 };
197
198 struct dpni_cmd_get_irq_status {
199         uint32_t status;
200         uint8_t irq_index;
201 };
202
203 struct dpni_rsp_get_irq_status {
204         uint32_t status;
205 };
206
207 struct dpni_cmd_clear_irq_status {
208         uint32_t status;
209         uint8_t irq_index;
210 };
211
212 struct dpni_rsp_get_attr {
213         /* response word 0 */
214         uint32_t options;
215         uint8_t num_queues;
216         uint8_t num_rx_tcs;
217         uint8_t mac_filter_entries;
218         uint8_t num_tx_tcs;
219         /* response word 1 */
220         uint8_t vlan_filter_entries;
221         uint8_t pad1;
222         uint8_t qos_entries;
223         uint8_t pad2;
224         uint16_t fs_entries;
225         uint16_t pad3;
226         /* response word 2 */
227         uint8_t qos_key_size;
228         uint8_t fs_key_size;
229         uint16_t wriop_version;
230         uint8_t num_cgs;
231 };
232
233 #define DPNI_ERROR_ACTION_SHIFT         0
234 #define DPNI_ERROR_ACTION_SIZE          4
235 #define DPNI_FRAME_ANN_SHIFT            4
236 #define DPNI_FRAME_ANN_SIZE             1
237
238 struct dpni_cmd_set_errors_behavior {
239         uint32_t errors;
240         /* from least significant bit: error_action:4, set_frame_annotation:1 */
241         uint8_t flags;
242 };
243
244 /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
245  * buffer layouts, but they all share the same parameters.
246  * If one of the functions changes, below structure needs to be split.
247  */
248
249 #define DPNI_PASS_TS_SHIFT              0
250 #define DPNI_PASS_TS_SIZE               1
251 #define DPNI_PASS_PR_SHIFT              1
252 #define DPNI_PASS_PR_SIZE               1
253 #define DPNI_PASS_FS_SHIFT              2
254 #define DPNI_PASS_FS_SIZE               1
255 #define DPNI_PASS_SWO_SHIFT             3
256 #define DPNI_PASS_SWO_SIZE              1
257
258 struct dpni_cmd_get_buffer_layout {
259         uint8_t qtype;
260 };
261
262 struct dpni_rsp_get_buffer_layout {
263         /* response word 0 */
264         uint8_t pad0[6];
265         /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
266         uint8_t flags;
267         uint8_t pad1;
268         /* response word 1 */
269         uint16_t private_data_size;
270         uint16_t data_align;
271         uint16_t head_room;
272         uint16_t tail_room;
273 };
274
275 struct dpni_cmd_set_buffer_layout {
276         /* cmd word 0 */
277         uint8_t qtype;
278         uint8_t pad0[3];
279         uint16_t options;
280         /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
281         uint8_t flags;
282         uint8_t pad1;
283         /* cmd word 1 */
284         uint16_t private_data_size;
285         uint16_t data_align;
286         uint16_t head_room;
287         uint16_t tail_room;
288 };
289
290 struct dpni_cmd_set_offload {
291         uint8_t pad[3];
292         uint8_t dpni_offload;
293         uint32_t config;
294 };
295
296 struct dpni_cmd_get_offload {
297         uint8_t pad[3];
298         uint8_t dpni_offload;
299 };
300
301 struct dpni_rsp_get_offload {
302         uint32_t pad;
303         uint32_t config;
304 };
305
306 struct dpni_cmd_get_qdid {
307         uint8_t qtype;
308 };
309
310 struct dpni_rsp_get_qdid {
311         uint16_t qdid;
312 };
313
314 struct dpni_rsp_get_sp_info {
315         uint16_t spids[2];
316 };
317
318 struct dpni_rsp_get_tx_data_offset {
319         uint16_t data_offset;
320 };
321
322 struct dpni_cmd_get_statistics {
323         uint8_t page_number;
324         uint16_t param;
325 };
326
327 struct dpni_rsp_get_statistics {
328         uint64_t counter[7];
329 };
330
331 struct dpni_cmd_set_link_cfg {
332         uint64_t pad0;
333         uint32_t rate;
334         uint32_t pad1;
335         uint64_t options;
336         uint64_t advertising;
337 };
338
339 #define DPNI_LINK_STATE_SHIFT           0
340 #define DPNI_LINK_STATE_SIZE            1
341 #define DPNI_STATE_VALID_SHIFT          1
342 #define DPNI_STATE_VALID_SIZE           1
343
344 struct dpni_rsp_get_link_state {
345         uint32_t pad0;
346         /* from LSB: up:1 */
347         uint8_t flags;
348         uint8_t pad1[3];
349         uint32_t rate;
350         uint32_t pad2;
351         uint64_t options;
352         uint64_t supported;
353         uint64_t advertising;
354 };
355
356 struct dpni_cmd_set_max_frame_length {
357         uint16_t max_frame_length;
358 };
359
360 struct dpni_rsp_get_max_frame_length {
361         uint16_t max_frame_length;
362 };
363
364 struct dpni_cmd_set_multicast_promisc {
365         uint8_t enable;
366 };
367
368 struct dpni_rsp_get_multicast_promisc {
369         uint8_t enabled;
370 };
371
372 struct dpni_cmd_set_unicast_promisc {
373         uint8_t enable;
374 };
375
376 struct dpni_rsp_get_unicast_promisc {
377         uint8_t enabled;
378 };
379
380 struct dpni_cmd_set_primary_mac_addr {
381         uint16_t pad;
382         uint8_t mac_addr[6];
383 };
384
385 struct dpni_rsp_get_primary_mac_addr {
386         uint16_t pad;
387         uint8_t mac_addr[6];
388 };
389
390 struct dpni_rsp_get_port_mac_addr {
391         uint16_t pad;
392         uint8_t mac_addr[6];
393 };
394
395 struct dpni_cmd_add_mac_addr {
396         uint16_t pad;
397         uint8_t mac_addr[6];
398 };
399
400 struct dpni_cmd_remove_mac_addr {
401         uint16_t pad;
402         uint8_t mac_addr[6];
403 };
404
405 #define DPNI_UNICAST_FILTERS_SHIFT      0
406 #define DPNI_UNICAST_FILTERS_SIZE       1
407 #define DPNI_MULTICAST_FILTERS_SHIFT    1
408 #define DPNI_MULTICAST_FILTERS_SIZE     1
409
410 struct dpni_cmd_clear_mac_filters {
411         /* from LSB: unicast:1, multicast:1 */
412         uint8_t flags;
413 };
414
415 struct dpni_cmd_enable_vlan_filter {
416         /* only the LSB */
417         uint8_t en;
418 };
419
420 struct dpni_cmd_vlan_id {
421         uint32_t pad;
422         uint16_t vlan_id;
423 };
424
425 #define DPNI_SEPARATE_GRP_SHIFT 0
426 #define DPNI_SEPARATE_GRP_SIZE  1
427 #define DPNI_MODE_1_SHIFT               0
428 #define DPNI_MODE_1_SIZE                4
429 #define DPNI_MODE_2_SHIFT               4
430 #define DPNI_MODE_2_SIZE                4
431
432 struct dpni_cmd_set_tx_priorities {
433         uint16_t flags;
434         uint8_t prio_group_A;
435         uint8_t prio_group_B;
436         uint32_t pad0;
437         uint8_t modes[4];
438         uint32_t pad1;
439         uint64_t pad2;
440         uint16_t delta_bandwidth[8];
441 };
442
443 #define DPNI_DIST_MODE_SHIFT            0
444 #define DPNI_DIST_MODE_SIZE             4
445 #define DPNI_MISS_ACTION_SHIFT          4
446 #define DPNI_MISS_ACTION_SIZE           4
447 #define DPNI_KEEP_HASH_KEY_SHIFT        7
448 #define DPNI_KEEP_HASH_KEY_SIZE         1
449 #define DPNI_KEEP_ENTRIES_SHIFT         6
450 #define DPNI_KEEP_ENTRIES_SIZE          1
451
452 struct dpni_cmd_set_rx_tc_dist {
453         uint16_t dist_size;
454         uint8_t tc_id;
455         /* from LSB: dist_mode:4, miss_action:4 */
456         uint8_t flags;
457         uint8_t pad0;
458         /* only the LSB */
459         uint8_t keep_hash_key;
460         uint16_t default_flow_id;
461         uint64_t pad1[5];
462         uint64_t key_cfg_iova;
463 };
464
465 struct dpni_cmd_get_queue {
466         uint8_t qtype;
467         uint8_t tc;
468         uint8_t index;
469 };
470
471 #define DPNI_DEST_TYPE_SHIFT            0
472 #define DPNI_DEST_TYPE_SIZE             4
473 #define DPNI_CGID_VALID_SHIFT           5
474 #define DPNI_CGID_VALID_SIZE            1
475 #define DPNI_STASH_CTRL_SHIFT           6
476 #define DPNI_STASH_CTRL_SIZE            1
477 #define DPNI_HOLD_ACTIVE_SHIFT          7
478 #define DPNI_HOLD_ACTIVE_SIZE           1
479
480 struct dpni_rsp_get_queue {
481         /* response word 0 */
482         uint64_t pad0;
483         /* response word 1 */
484         uint32_t dest_id;
485         uint16_t pad1;
486         uint8_t dest_prio;
487         /* From LSB:
488          * dest_type:4, pad:1, cgid_valid:1, flc_stash_ctrl:1, hold_active:1
489          */
490         uint8_t flags;
491         /* response word 2 */
492         uint64_t flc;
493         /* response word 3 */
494         uint64_t user_context;
495         /* response word 4 */
496         uint32_t fqid;
497         uint16_t qdbin;
498         uint16_t pad2;
499         /* response word 5*/
500         uint8_t cgid;
501 };
502
503 struct dpni_cmd_set_queue {
504         /* cmd word 0 */
505         uint8_t qtype;
506         uint8_t tc;
507         uint8_t index;
508         uint8_t options;
509         uint32_t pad0;
510         /* cmd word 1 */
511         uint32_t dest_id;
512         uint16_t pad1;
513         uint8_t dest_prio;
514         uint8_t flags;
515         /* cmd word 2 */
516         uint64_t flc;
517         /* cmd word 3 */
518         uint64_t user_context;
519         /* cmd word 4 */
520         uint8_t cgid;
521 };
522
523 #define DPNI_DISCARD_ON_MISS_SHIFT      0
524 #define DPNI_DISCARD_ON_MISS_SIZE       1
525 #define DPNI_KEEP_QOS_ENTRIES_SHIFT             1
526 #define DPNI_KEEP_QOS_ENTRIES_SIZE              1
527
528 struct dpni_cmd_set_qos_table {
529         uint32_t pad;
530         uint8_t default_tc;
531         /* only the LSB */
532         uint8_t discard_on_miss;
533         uint16_t pad1[21];
534         uint64_t key_cfg_iova;
535 };
536
537 struct dpni_cmd_add_qos_entry {
538         uint16_t pad;
539         uint8_t tc_id;
540         uint8_t key_size;
541         uint16_t index;
542         uint16_t pad2;
543         uint64_t key_iova;
544         uint64_t mask_iova;
545 };
546
547 struct dpni_cmd_remove_qos_entry {
548         uint8_t pad1[3];
549         uint8_t key_size;
550         uint32_t pad2;
551         uint64_t key_iova;
552         uint64_t mask_iova;
553 };
554
555 struct dpni_cmd_add_fs_entry {
556         uint16_t options;
557         uint8_t tc_id;
558         uint8_t key_size;
559         uint16_t index;
560         uint16_t flow_id;
561         uint64_t key_iova;
562         uint64_t mask_iova;
563         uint64_t flc;
564 };
565
566 struct dpni_cmd_remove_fs_entry {
567         uint16_t pad1;
568         uint8_t tc_id;
569         uint8_t key_size;
570         uint32_t pad2;
571         uint64_t key_iova;
572         uint64_t mask_iova;
573 };
574
575 struct dpni_cmd_clear_fs_entries {
576         uint16_t pad;
577         uint8_t tc_id;
578 };
579
580 #define DPNI_DROP_ENABLE_SHIFT  0
581 #define DPNI_DROP_ENABLE_SIZE   1
582 #define DPNI_DROP_UNITS_SHIFT   2
583 #define DPNI_DROP_UNITS_SIZE    2
584
585 struct dpni_early_drop {
586         /* from LSB: enable:1 units:2 */
587         uint8_t flags;
588         uint8_t pad0[3];
589         uint32_t pad1;
590         uint8_t green_drop_probability;
591         uint8_t pad2[7];
592         uint64_t green_max_threshold;
593         uint64_t green_min_threshold;
594         uint64_t pad3;
595         uint8_t yellow_drop_probability;
596         uint8_t pad4[7];
597         uint64_t yellow_max_threshold;
598         uint64_t yellow_min_threshold;
599         uint64_t pad5;
600         uint8_t red_drop_probability;
601         uint8_t pad6[7];
602         uint64_t red_max_threshold;
603         uint64_t red_min_threshold;
604 };
605
606 struct dpni_cmd_early_drop {
607         uint8_t qtype;
608         uint8_t tc;
609         uint8_t pad[6];
610         uint64_t early_drop_iova;
611 };
612
613 struct dpni_rsp_get_api_version {
614         uint16_t major;
615         uint16_t minor;
616 };
617
618 struct dpni_cmd_get_taildrop {
619         uint8_t congestion_point;
620         uint8_t qtype;
621         uint8_t tc;
622         uint8_t index;
623 };
624
625 struct dpni_rsp_get_taildrop {
626         /* cmd word 0 */
627         uint64_t pad0;
628         /* cmd word 1 */
629         /* from LSB: enable:1 oal_lo:7 */
630         uint8_t enable_oal_lo;
631         /* from LSB: oal_hi:5 */
632         uint8_t oal_hi;
633         uint8_t units;
634         uint8_t pad2;
635         uint32_t threshold;
636 };
637
638 #define DPNI_OAL_LO_SHIFT       1
639 #define DPNI_OAL_LO_SIZE        7
640 #define DPNI_OAL_HI_SHIFT       0
641 #define DPNI_OAL_HI_SIZE        5
642
643 struct dpni_cmd_set_taildrop {
644         /* cmd word 0 */
645         uint8_t congestion_point;
646         uint8_t qtype;
647         uint8_t tc;
648         uint8_t index;
649         uint32_t pad0;
650         /* cmd word 1 */
651         /* from LSB: enable:1 oal_lo:7 */
652         uint8_t enable_oal_lo;
653         /* from LSB: oal_hi:5 */
654         uint8_t oal_hi;
655         uint8_t units;
656         uint8_t pad2;
657         uint32_t threshold;
658 };
659
660 struct dpni_tx_confirmation_mode {
661         uint32_t pad;
662         uint8_t confirmation_mode;
663 };
664
665 #define DPNI_DEST_TYPE_SHIFT            0
666 #define DPNI_DEST_TYPE_SIZE             4
667 #define DPNI_CONG_UNITS_SHIFT           4
668 #define DPNI_CONG_UNITS_SIZE            2
669
670 struct dpni_cmd_set_congestion_notification {
671         uint8_t qtype;
672         uint8_t tc;
673         uint8_t pad;
674         uint8_t congestion_point;
675         uint8_t cgid;
676         uint8_t pad2[3];
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_get_congestion_notification {
689         uint8_t qtype;
690         uint8_t tc;
691         uint8_t pad;
692         uint8_t congestion_point;
693         uint8_t cgid;
694 };
695
696 struct dpni_rsp_get_congestion_notification {
697         uint64_t pad;
698         uint32_t dest_id;
699         uint16_t notification_mode;
700         uint8_t dest_priority;
701         /* from LSB: dest_type: 4 units:2 */
702         uint8_t type_units;
703         uint64_t message_iova;
704         uint64_t message_ctx;
705         uint32_t threshold_entry;
706         uint32_t threshold_exit;
707 };
708
709 struct dpni_cmd_set_opr {
710         uint8_t pad0;
711         uint8_t tc_id;
712         uint8_t index;
713         uint8_t options;
714         uint8_t pad1[7];
715         uint8_t oloe;
716         uint8_t oeane;
717         uint8_t olws;
718         uint8_t oa;
719         uint8_t oprrws;
720 };
721
722 struct dpni_cmd_get_opr {
723         uint8_t pad;
724         uint8_t tc_id;
725         uint8_t index;
726 };
727
728 #define DPNI_RIP_SHIFT  0
729 #define DPNI_RIP_SIZE           1
730 #define DPNI_OPR_ENABLE_SHIFT   1
731 #define DPNI_OPR_ENABLE_SIZE    1
732 #define DPNI_TSEQ_NLIS_SHIFT    0
733 #define DPNI_TSEQ_NLIS_SIZE     1
734 #define DPNI_HSEQ_NLIS_SHIFT    0
735 #define DPNI_HSEQ_NLIS_SIZE     1
736
737 struct dpni_rsp_get_opr {
738         uint64_t pad0;
739         /* from LSB: rip:1 enable:1 */
740         uint8_t flags;
741         uint16_t pad1;
742         uint8_t oloe;
743         uint8_t oeane;
744         uint8_t olws;
745         uint8_t oa;
746         uint8_t oprrws;
747         uint16_t nesn;
748         uint16_t pad8;
749         uint16_t ndsn;
750         uint16_t pad2;
751         uint16_t ea_tseq;
752         /* only the LSB */
753         uint8_t tseq_nlis;
754         uint8_t pad3;
755         uint16_t ea_hseq;
756         /* only the LSB */
757         uint8_t hseq_nlis;
758         uint8_t pad4;
759         uint16_t ea_hptr;
760         uint16_t pad5;
761         uint16_t ea_tptr;
762         uint16_t pad6;
763         uint16_t opr_vid;
764         uint16_t pad7;
765         uint16_t opr_id;
766 };
767
768 struct dpni_cmd_add_custom_tpid {
769         uint16_t        pad;
770         uint16_t        tpid;
771 };
772
773 struct dpni_cmd_remove_custom_tpid {
774         uint16_t        pad;
775         uint16_t        tpid;
776 };
777
778 struct dpni_rsp_get_custom_tpid {
779         uint16_t        tpid1;
780         uint16_t        tpid2;
781 };
782
783 #define DPNI_RX_FS_DIST_ENABLE_SHIFT    0
784 #define DPNI_RX_FS_DIST_ENABLE_SIZE             1
785 struct dpni_cmd_set_rx_fs_dist {
786         uint16_t        dist_size;
787         uint8_t         enable;
788         uint8_t         tc;
789         uint16_t        miss_flow_id;
790         uint16_t        pad1;
791         uint64_t        key_cfg_iova;
792 };
793
794 #define DPNI_RX_HASH_DIST_ENABLE_SHIFT  0
795 #define DPNI_RX_HASH_DIST_ENABLE_SIZE           1
796 struct dpni_cmd_set_rx_hash_dist {
797         uint16_t        dist_size;
798         uint8_t         enable;
799         uint8_t         tc_id;
800         uint32_t        pad;
801         uint64_t        key_cfg_iova;
802 };
803
804 struct dpni_load_sw_sequence {
805         uint8_t dest;
806         uint8_t pad0[7];
807         uint16_t ss_offset;
808         uint16_t pad1;
809         uint16_t ss_size;
810         uint16_t pad2;
811         uint64_t ss_iova;
812 };
813
814 struct dpni_enable_sw_sequence {
815         uint8_t dest;
816         uint8_t pad0[7];
817         uint16_t ss_offset;
818         uint16_t hxs;
819         uint8_t set_start;
820         uint8_t pad1[3];
821         uint8_t param_offset;
822         uint8_t pad2[3];
823         uint8_t param_size;
824         uint8_t pad3[3];
825         uint64_t param_iova;
826 };
827
828 struct dpni_get_sw_sequence_layout {
829         uint8_t src;
830         uint8_t pad0[7];
831         uint64_t layout_iova;
832 };
833
834 struct dpni_sw_sequence_layout_entry {
835         uint16_t ss_offset;
836         uint16_t ss_size;
837         uint8_t param_offset;
838         uint8_t param_size;
839         uint16_t pad;
840 };
841
842 #pragma pack(pop)
843 #endif /* _FSL_DPNI_CMD_H */