1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell OcteonTx2 RVU Admin Function driver
4 * Copyright (C) 2018 Marvell International Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
14 /* RVU Block revision IDs */
15 #define RVU_BLK_RVUM_REVID 0x01
17 #define RVU_MULTI_BLK_VER 0x7ULL
19 /* RVU Block Address Enumeration */
20 enum rvu_block_addr_e {
21 BLKADDR_RVUM = 0x0ULL,
23 BLKADDR_MSIX = 0x2ULL,
25 BLKADDR_NIX0 = 0x4ULL,
26 BLKADDR_NIX1 = 0x5ULL,
29 BLKADDR_SSOW = 0x8ULL,
31 BLKADDR_CPT0 = 0xaULL,
32 BLKADDR_CPT1 = 0xbULL,
33 BLKADDR_NDC_NIX0_RX = 0xcULL,
34 BLKADDR_NDC_NIX0_TX = 0xdULL,
35 BLKADDR_NDC_NPA0 = 0xeULL,
36 BLKADDR_NDC_NIX1_RX = 0x10ULL,
37 BLKADDR_NDC_NIX1_TX = 0x11ULL,
41 /* RVU Block Type Enumeration */
42 enum rvu_block_type_e {
57 /* RVU Admin function Interrupt Vector Enumeration */
58 enum rvu_af_int_vec_e {
59 RVU_AF_INT_VEC_POISON = 0x0,
60 RVU_AF_INT_VEC_PFFLR = 0x1,
61 RVU_AF_INT_VEC_PFME = 0x2,
62 RVU_AF_INT_VEC_GEN = 0x3,
63 RVU_AF_INT_VEC_MBOX = 0x4,
64 RVU_AF_INT_VEC_CNT = 0x5,
67 /* NPA Admin function Interrupt Vector Enumeration */
68 enum npa_af_int_vec_e {
69 NPA_AF_INT_VEC_RVU = 0x0,
70 NPA_AF_INT_VEC_GEN = 0x1,
71 NPA_AF_INT_VEC_AQ_DONE = 0x2,
72 NPA_AF_INT_VEC_AF_ERR = 0x3,
73 NPA_AF_INT_VEC_POISON = 0x4,
74 NPA_AF_INT_VEC_CNT = 0x5,
78 * RVU PF Interrupt Vector Enumeration
80 enum rvu_pf_int_vec_e {
81 RVU_PF_INT_VEC_VFFLR0 = 0x0,
82 RVU_PF_INT_VEC_VFFLR1 = 0x1,
83 RVU_PF_INT_VEC_VFME0 = 0x2,
84 RVU_PF_INT_VEC_VFME1 = 0x3,
85 RVU_PF_INT_VEC_VFPF_MBOX0 = 0x4,
86 RVU_PF_INT_VEC_VFPF_MBOX1 = 0x5,
87 RVU_PF_INT_VEC_AFPF_MBOX = 0x6,
88 RVU_PF_INT_VEC_CNT = 0x7,
91 /* NPA admin queue completion enumeration */
93 NPA_AQ_COMP_NOTDONE = 0x0,
94 NPA_AQ_COMP_GOOD = 0x1,
95 NPA_AQ_COMP_SWERR = 0x2,
96 NPA_AQ_COMP_CTX_POISON = 0x3,
97 NPA_AQ_COMP_CTX_FAULT = 0x4,
98 NPA_AQ_COMP_LOCKERR = 0x5,
101 /* NPA admin queue context types */
103 NPA_AQ_CTYPE_AURA = 0x0,
104 NPA_AQ_CTYPE_POOL = 0x1,
107 /* NPA admin queue instruction opcodes */
109 NPA_AQ_INSTOP_NOP = 0x0,
110 NPA_AQ_INSTOP_INIT = 0x1,
111 NPA_AQ_INSTOP_WRITE = 0x2,
112 NPA_AQ_INSTOP_READ = 0x3,
113 NPA_AQ_INSTOP_LOCK = 0x4,
114 NPA_AQ_INSTOP_UNLOCK = 0x5,
117 /* ALLOC/FREE input queues Enumeration from coprocessors */
119 NPA_INPQ_NIX0_RX = 0x0,
120 NPA_INPQ_NIX0_TX = 0x1,
121 NPA_INPQ_NIX1_RX = 0x2,
122 NPA_INPQ_NIX1_TX = 0x3,
126 NPA_INPQ_AURA_OP = 0xe,
127 NPA_INPQ_INTERNAL_RSV = 0xf,
130 /* NPA admin queue instruction structure */
131 struct npa_aq_inst_s {
132 #if defined(__BIG_ENDIAN_BITFIELD)
133 u64 doneint : 1; /* W0 */
134 u64 reserved_44_62 : 19;
136 u64 reserved_17_23 : 7;
144 u64 reserved_17_23 : 7;
146 u64 reserved_44_62 : 19;
149 u64 res_addr; /* W1 */
152 /* NPA admin queue result structure */
153 struct npa_aq_res_s {
154 #if defined(__BIG_ENDIAN_BITFIELD)
155 u64 reserved_17_63 : 47; /* W0 */
165 u64 reserved_17_63 : 47;
167 u64 reserved_64_127; /* W1 */
171 u64 pool_addr; /* W0 */
172 #if defined(__BIG_ENDIAN_BITFIELD) /* W1 */
174 u64 reserved_118_119 : 2;
177 u64 reserved_98_103 : 6;
179 u64 aura_drop_ena : 1;
180 u64 pool_drop_ena : 1;
183 u64 pool_way_mask : 16;
184 u64 pool_caching : 1;
190 u64 pool_caching : 1;
191 u64 pool_way_mask : 16;
194 u64 pool_drop_ena : 1;
195 u64 aura_drop_ena : 1;
197 u64 reserved_98_103 : 6;
200 u64 reserved_118_119 : 2;
203 #if defined(__BIG_ENDIAN_BITFIELD) /* W2 */
204 u64 reserved_189_191 : 3;
206 u64 reserved_177_179 : 3;
208 u64 reserved_164_167 : 4;
212 u64 reserved_164_167 : 4;
214 u64 reserved_177_179 : 3;
216 u64 reserved_189_191 : 3;
218 #if defined(__BIG_ENDIAN_BITFIELD) /* W3 */
219 u64 reserved_252_255 : 4;
220 u64 fc_hyst_bits : 4;
222 u64 fc_up_crossing : 1;
224 u64 reserved_240_243 : 4;
226 u64 reserved_228_231 : 4;
230 u64 reserved_228_231 : 4;
232 u64 reserved_240_243 : 4;
234 u64 fc_up_crossing : 1;
236 u64 fc_hyst_bits : 4;
237 u64 reserved_252_255 : 4;
239 u64 fc_addr; /* W4 */
240 #if defined(__BIG_ENDIAN_BITFIELD) /* W5 */
241 u64 reserved_379_383 : 5;
242 u64 err_qint_idx : 7;
243 u64 reserved_371 : 1;
244 u64 thresh_qint_idx : 7;
245 u64 reserved_363 : 1;
247 u64 thresh_int_ena : 1;
251 u64 update_time : 16;
255 u64 update_time : 16;
259 u64 thresh_int_ena : 1;
261 u64 reserved_363 : 1;
262 u64 thresh_qint_idx : 7;
263 u64 reserved_371 : 1;
264 u64 err_qint_idx : 7;
265 u64 reserved_379_383 : 5;
267 #if defined(__BIG_ENDIAN_BITFIELD) /* W6 */
268 u64 reserved_420_447 : 28;
272 u64 reserved_420_447 : 28;
274 u64 reserved_448_511; /* W7 */
278 u64 stack_base; /* W0 */
279 #if defined(__BIG_ENDIAN_BITFIELD) /* W1 */
280 u64 reserved_115_127 : 13;
282 u64 reserved_100_103 : 4;
284 u64 stack_way_mask : 16;
285 u64 reserved_70_71 : 3;
286 u64 stack_caching : 1;
287 u64 reserved_66_67 : 2;
293 u64 reserved_66_67 : 2;
294 u64 stack_caching : 1;
295 u64 reserved_70_71 : 3;
296 u64 stack_way_mask : 16;
298 u64 reserved_100_103 : 4;
300 u64 reserved_115_127 : 13;
302 #if defined(__BIG_ENDIAN_BITFIELD) /* W2 */
303 u64 stack_pages : 32;
304 u64 stack_max_pages : 32;
306 u64 stack_max_pages : 32;
307 u64 stack_pages : 32;
309 #if defined(__BIG_ENDIAN_BITFIELD) /* W3 */
310 u64 reserved_240_255 : 16;
314 u64 reserved_240_255 : 16;
316 #if defined(__BIG_ENDIAN_BITFIELD) /* W4 */
317 u64 reserved_316_319 : 4;
318 u64 update_time : 16;
319 u64 reserved_297_299 : 3;
320 u64 fc_up_crossing : 1;
321 u64 fc_hyst_bits : 4;
326 u64 reserved_270_271 : 2;
328 u64 reserved_260_263 : 4;
329 u64 stack_offset : 4;
331 u64 stack_offset : 4;
332 u64 reserved_260_263 : 4;
334 u64 reserved_270_271 : 2;
339 u64 fc_hyst_bits : 4;
340 u64 fc_up_crossing : 1;
341 u64 reserved_297_299 : 3;
342 u64 update_time : 16;
343 u64 reserved_316_319 : 4;
345 u64 fc_addr; /* W5 */
346 u64 ptr_start; /* W6 */
347 u64 ptr_end; /* W7 */
348 #if defined(__BIG_ENDIAN_BITFIELD) /* W8 */
349 u64 reserved_571_575 : 5;
350 u64 err_qint_idx : 7;
351 u64 reserved_563 : 1;
352 u64 thresh_qint_idx : 7;
353 u64 reserved_555 : 1;
355 u64 thresh_int_ena : 1;
359 u64 reserved_512_535 : 24;
361 u64 reserved_512_535 : 24;
365 u64 thresh_int_ena : 1;
367 u64 reserved_555 : 1;
368 u64 thresh_qint_idx : 7;
369 u64 reserved_563 : 1;
370 u64 err_qint_idx : 7;
371 u64 reserved_571_575 : 5;
373 #if defined(__BIG_ENDIAN_BITFIELD) /* W9 */
374 u64 reserved_612_639 : 28;
378 u64 reserved_612_639 : 28;
380 u64 reserved_640_703; /* W10 */
381 u64 reserved_704_767; /* W11 */
382 u64 reserved_768_831; /* W12 */
383 u64 reserved_832_895; /* W13 */
384 u64 reserved_896_959; /* W14 */
385 u64 reserved_960_1023; /* W15 */
388 /* NIX admin queue completion status */
390 NIX_AQ_COMP_NOTDONE = 0x0,
391 NIX_AQ_COMP_GOOD = 0x1,
392 NIX_AQ_COMP_SWERR = 0x2,
393 NIX_AQ_COMP_CTX_POISON = 0x3,
394 NIX_AQ_COMP_CTX_FAULT = 0x4,
395 NIX_AQ_COMP_LOCKERR = 0x5,
396 NIX_AQ_COMP_SQB_ALLOC_FAIL = 0x6,
399 /* NIX admin queue context types */
401 NIX_AQ_CTYPE_RQ = 0x0,
402 NIX_AQ_CTYPE_SQ = 0x1,
403 NIX_AQ_CTYPE_CQ = 0x2,
404 NIX_AQ_CTYPE_MCE = 0x3,
405 NIX_AQ_CTYPE_RSS = 0x4,
406 NIX_AQ_CTYPE_DYNO = 0x5,
409 /* NIX admin queue instruction opcodes */
411 NIX_AQ_INSTOP_NOP = 0x0,
412 NIX_AQ_INSTOP_INIT = 0x1,
413 NIX_AQ_INSTOP_WRITE = 0x2,
414 NIX_AQ_INSTOP_READ = 0x3,
415 NIX_AQ_INSTOP_LOCK = 0x4,
416 NIX_AQ_INSTOP_UNLOCK = 0x5,
419 /* NIX admin queue instruction structure */
420 struct nix_aq_inst_s {
421 #if defined(__BIG_ENDIAN_BITFIELD)
422 u64 doneint : 1; /* W0 */
423 u64 reserved_44_62 : 19;
425 u64 reserved_15_23 : 9;
433 u64 reserved_15_23 : 9;
435 u64 reserved_44_62 : 19;
438 u64 res_addr; /* W1 */
441 /* NIX admin queue result structure */
442 struct nix_aq_res_s {
443 #if defined(__BIG_ENDIAN_BITFIELD)
444 u64 reserved_17_63 : 47; /* W0 */
454 u64 reserved_17_63 : 47;
456 u64 reserved_64_127; /* W1 */
459 /* NIX Completion queue context structure */
460 struct nix_cq_ctx_s {
462 #if defined(__BIG_ENDIAN_BITFIELD) /* W1 */
485 #if defined(__BIG_ENDIAN_BITFIELD) /* W2 */
486 u64 update_time : 16;
494 u64 update_time : 16;
496 #if defined(__BIG_ENDIAN_BITFIELD) /* W3 */
497 u64 cq_err_int_ena : 8;
500 u64 rsvd_233_235 : 3;
503 u64 rsvd_210_211 : 2;
513 u64 rsvd_210_211 : 2;
516 u64 rsvd_233_235 : 3;
519 u64 cq_err_int_ena : 8;
523 /* NIX Receive queue context structure */
524 struct nix_rq_ctx_s {
525 #if defined(__BIG_ENDIAN_BITFIELD) /* W0 */
542 #if defined(__BIG_ENDIAN_BITFIELD) /* W1 */
543 u64 rsvd_127_122 : 6;
544 u64 lpb_drop_ena : 1;
545 u64 spb_drop_ena : 1;
546 u64 xqe_drop_ena : 1;
560 u64 xqe_drop_ena : 1;
561 u64 spb_drop_ena : 1;
562 u64 lpb_drop_ena : 1;
563 u64 rsvd_127_122 : 6;
565 #if defined(__BIG_ENDIAN_BITFIELD) /* W2 */
566 u64 xqe_hdr_split : 1;
567 u64 xqe_imm_copy : 1;
568 u64 rsvd_189_184 : 6;
569 u64 xqe_imm_size : 6;
575 u64 rsvd_150_148 : 3;
578 u64 rsvd_139_128 : 12;
580 u64 rsvd_139_128 : 12;
583 u64 rsvd_150_148 : 3;
589 u64 xqe_imm_size : 6;
590 u64 rsvd_189_184 : 6;
591 u64 xqe_imm_copy : 1;
592 u64 xqe_hdr_split : 1;
594 #if defined(__BIG_ENDIAN_BITFIELD) /* W3 */
595 u64 spb_pool_pass : 8;
596 u64 spb_pool_drop : 8;
597 u64 spb_aura_pass : 8;
598 u64 spb_aura_drop : 8;
599 u64 wqe_pool_pass : 8;
600 u64 wqe_pool_drop : 8;
606 u64 wqe_pool_drop : 8;
607 u64 wqe_pool_pass : 8;
608 u64 spb_aura_drop : 8;
609 u64 spb_aura_pass : 8;
610 u64 spb_pool_drop : 8;
611 u64 spb_pool_pass : 8;
613 #if defined(__BIG_ENDIAN_BITFIELD) /* W4 */
614 u64 rsvd_319_315 : 5;
618 u64 rsvd_291_288 : 4;
619 u64 lpb_pool_pass : 8;
620 u64 lpb_pool_drop : 8;
621 u64 lpb_aura_pass : 8;
622 u64 lpb_aura_drop : 8;
624 u64 lpb_aura_drop : 8;
625 u64 lpb_aura_pass : 8;
626 u64 lpb_pool_drop : 8;
627 u64 lpb_pool_pass : 8;
628 u64 rsvd_291_288 : 4;
632 u64 rsvd_319_315 : 5;
634 #if defined(__BIG_ENDIAN_BITFIELD) /* W5 */
635 u64 rsvd_383_366 : 18;
645 u64 rsvd_383_366 : 18;
647 #if defined(__BIG_ENDIAN_BITFIELD) /* W6 */
648 u64 rsvd_447_432 : 16;
652 u64 rsvd_447_432 : 16;
654 #if defined(__BIG_ENDIAN_BITFIELD) /* W7 */
655 u64 rsvd_511_496 : 16;
659 u64 rsvd_511_496 : 16;
661 #if defined(__BIG_ENDIAN_BITFIELD) /* W8 */
662 u64 rsvd_575_560 : 16;
666 u64 rsvd_575_560 : 16;
668 #if defined(__BIG_ENDIAN_BITFIELD) /* W9 */
669 u64 rsvd_639_624 : 16;
673 u64 rsvd_639_624 : 16;
675 #if defined(__BIG_ENDIAN_BITFIELD) /* W10 */
676 u64 rsvd_703_688 : 16;
680 u64 rsvd_703_688 : 16;
682 u64 rsvd_767_704; /* W11 */
683 u64 rsvd_831_768; /* W12 */
684 u64 rsvd_895_832; /* W13 */
685 u64 rsvd_959_896; /* W14 */
686 u64 rsvd_1023_960; /* W15 */
691 NIX_MAXSQESZ_W16 = 0x0,
692 NIX_MAXSQESZ_W8 = 0x1,
695 /* NIX SQB caching type */
702 /* NIX Send queue context structure */
703 struct nix_sq_ctx_s {
704 #if defined(__BIG_ENDIAN_BITFIELD) /* W0 */
705 u64 sqe_way_mask : 16;
717 u64 sqe_way_mask : 16;
719 #if defined(__BIG_ENDIAN_BITFIELD) /* W1 */
721 u64 default_chan : 12;
722 u64 smq_rr_quantum : 24;
732 u64 smq_rr_quantum : 24;
733 u64 default_chan : 12;
736 #if defined(__BIG_ENDIAN_BITFIELD) /* W2 */
742 u64 smq_rr_count : 25;
744 u64 smq_rr_count : 25;
751 #if defined(__BIG_ENDIAN_BITFIELD) /* W3 */
752 u64 rsvd_255_253 : 3;
753 u64 smq_next_sq_vld : 1;
755 u64 smenq_next_sqb_vld : 1;
757 u64 smenq_offset : 6;
759 u64 smq_lso_segnum : 8;
760 u64 smq_next_sq : 20;
764 u64 max_sqe_size : 2;
766 u64 max_sqe_size : 2;
770 u64 smq_next_sq : 20;
771 u64 smq_lso_segnum : 8;
773 u64 smenq_offset : 6;
775 u64 smenq_next_sqb_vld : 1;
777 u64 smq_next_sq_vld : 1;
778 u64 rsvd_255_253 : 3;
780 u64 next_sqb : 64;/* W4 */
781 u64 tail_sqb : 64;/* W5 */
782 u64 smenq_sqb : 64;/* W6 */
783 u64 smenq_next_sqb : 64;/* W7 */
784 u64 head_sqb : 64;/* W8 */
785 #if defined(__BIG_ENDIAN_BITFIELD) /* W9 */
786 u64 rsvd_639_630 : 10;
788 u64 vfi_lso_vlan1_ins_ena : 1;
789 u64 vfi_lso_vlan0_ins_ena : 1;
790 u64 vfi_lso_mps : 14;
792 u64 vfi_lso_sizem1 : 3;
793 u64 vfi_lso_total : 18;
794 u64 rsvd_583_576 : 8;
796 u64 rsvd_583_576 : 8;
797 u64 vfi_lso_total : 18;
798 u64 vfi_lso_sizem1 : 3;
800 u64 vfi_lso_mps : 14;
801 u64 vfi_lso_vlan0_ins_ena : 1;
802 u64 vfi_lso_vlan1_ins_ena : 1;
804 u64 rsvd_639_630 : 10;
806 #if defined(__BIG_ENDIAN_BITFIELD) /* W10 */
807 u64 rsvd_703_658 : 46;
808 u64 scm_lso_rem : 18;
810 u64 scm_lso_rem : 18;
811 u64 rsvd_703_658 : 46;
813 #if defined(__BIG_ENDIAN_BITFIELD) /* W11 */
814 u64 rsvd_767_752 : 16;
818 u64 rsvd_767_752 : 16;
820 #if defined(__BIG_ENDIAN_BITFIELD) /* W12 */
821 u64 rsvd_831_816 : 16;
825 u64 rsvd_831_816 : 16;
827 u64 rsvd_895_832 : 64;/* W13 */
828 #if defined(__BIG_ENDIAN_BITFIELD) /* W14 */
829 u64 rsvd_959_944 : 16;
830 u64 dropped_octs : 48;
832 u64 dropped_octs : 48;
833 u64 rsvd_959_944 : 16;
835 #if defined(__BIG_ENDIAN_BITFIELD) /* W15 */
836 u64 rsvd_1023_1008 : 16;
837 u64 dropped_pkts : 48;
839 u64 dropped_pkts : 48;
840 u64 rsvd_1023_1008 : 16;
844 /* NIX Receive side scaling entry structure*/
846 #if defined(__BIG_ENDIAN_BITFIELD)
847 uint32_t reserved_20_31 : 12;
851 uint32_t reserved_20_31 : 12;
856 /* NIX receive multicast/mirror entry structure */
857 struct nix_rx_mce_s {
858 #if defined(__BIG_ENDIAN_BITFIELD) /* W0 */
860 uint64_t pf_func : 16;
861 uint64_t rsvd_31_24 : 8;
871 uint64_t rsvd_31_24 : 8;
872 uint64_t pf_func : 16;
879 NIX_LSOALG_ADD_SEGNUM,
880 NIX_LSOALG_ADD_PAYLEN,
881 NIX_LSOALG_ADD_OFFSET,
882 NIX_LSOALG_TCP_FLAGS,
892 struct nix_lso_format {
893 #if defined(__BIG_ENDIAN_BITFIELD)
912 struct nix_rx_flowkey_alg {
913 #if defined(__BIG_ENDIAN_BITFIELD)
914 u64 reserved_35_63 :29;
919 u64 reserved_24_24 :1;
933 u64 reserved_24_24 :1;
938 u64 reserved_35_63 :29;
948 enum nix_tx_vtag_op {
954 /* NIX RX VTAG actions */
955 #define VTAG_STRIP BIT_ULL(4)
956 #define VTAG_CAPTURE BIT_ULL(5)
958 #endif /* RVU_STRUCT_H */