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,
77 /* NIX Admin function Interrupt Vector Enumeration */
78 enum nix_af_int_vec_e {
79 NIX_AF_INT_VEC_RVU = 0x0,
80 NIX_AF_INT_VEC_GEN = 0x1,
81 NIX_AF_INT_VEC_AQ_DONE = 0x2,
82 NIX_AF_INT_VEC_AF_ERR = 0x3,
83 NIX_AF_INT_VEC_POISON = 0x4,
84 NIX_AF_INT_VEC_CNT = 0x5,
88 * RVU PF Interrupt Vector Enumeration
90 enum rvu_pf_int_vec_e {
91 RVU_PF_INT_VEC_VFFLR0 = 0x0,
92 RVU_PF_INT_VEC_VFFLR1 = 0x1,
93 RVU_PF_INT_VEC_VFME0 = 0x2,
94 RVU_PF_INT_VEC_VFME1 = 0x3,
95 RVU_PF_INT_VEC_VFPF_MBOX0 = 0x4,
96 RVU_PF_INT_VEC_VFPF_MBOX1 = 0x5,
97 RVU_PF_INT_VEC_AFPF_MBOX = 0x6,
98 RVU_PF_INT_VEC_CNT = 0x7,
101 /* NPA admin queue completion enumeration */
103 NPA_AQ_COMP_NOTDONE = 0x0,
104 NPA_AQ_COMP_GOOD = 0x1,
105 NPA_AQ_COMP_SWERR = 0x2,
106 NPA_AQ_COMP_CTX_POISON = 0x3,
107 NPA_AQ_COMP_CTX_FAULT = 0x4,
108 NPA_AQ_COMP_LOCKERR = 0x5,
111 /* NPA admin queue context types */
113 NPA_AQ_CTYPE_AURA = 0x0,
114 NPA_AQ_CTYPE_POOL = 0x1,
117 /* NPA admin queue instruction opcodes */
119 NPA_AQ_INSTOP_NOP = 0x0,
120 NPA_AQ_INSTOP_INIT = 0x1,
121 NPA_AQ_INSTOP_WRITE = 0x2,
122 NPA_AQ_INSTOP_READ = 0x3,
123 NPA_AQ_INSTOP_LOCK = 0x4,
124 NPA_AQ_INSTOP_UNLOCK = 0x5,
127 /* ALLOC/FREE input queues Enumeration from coprocessors */
129 NPA_INPQ_NIX0_RX = 0x0,
130 NPA_INPQ_NIX0_TX = 0x1,
131 NPA_INPQ_NIX1_RX = 0x2,
132 NPA_INPQ_NIX1_TX = 0x3,
136 NPA_INPQ_AURA_OP = 0xe,
137 NPA_INPQ_INTERNAL_RSV = 0xf,
140 /* NPA admin queue instruction structure */
141 struct npa_aq_inst_s {
145 u64 reserved_17_23 : 7;
147 u64 reserved_44_62 : 19;
149 u64 res_addr; /* W1 */
152 /* NPA admin queue result structure */
153 struct npa_aq_res_s {
158 u64 reserved_17_63 : 47;
159 u64 reserved_64_127; /* W1 */
163 u64 pool_addr; /* W0 */
164 u64 ena : 1; /* W1 */
166 u64 pool_caching : 1;
167 u64 pool_way_mask : 16;
170 u64 pool_drop_ena : 1;
171 u64 aura_drop_ena : 1;
173 u64 reserved_98_103 : 6;
176 u64 reserved_118_119 : 2;
178 u64 count : 36; /* W2 */
179 u64 reserved_164_167 : 4;
181 u64 reserved_177_179 : 3;
183 u64 reserved_189_191 : 3;
184 u64 limit : 36; /* W3 */
185 u64 reserved_228_231 : 4;
187 u64 reserved_241_243 : 3;
190 u64 fc_up_crossing : 1;
192 u64 fc_hyst_bits : 4;
193 u64 reserved_252_255 : 4;
194 u64 fc_addr; /* W4 */
195 u64 pool_drop : 8; /* W5 */
196 u64 update_time : 16;
200 u64 thresh_int_ena : 1;
202 u64 reserved_363 : 1;
203 u64 thresh_qint_idx : 7;
204 u64 reserved_371 : 1;
205 u64 err_qint_idx : 7;
206 u64 reserved_379_383 : 5;
207 u64 thresh : 36; /* W6*/
208 u64 rsvd_423_420 : 4;
210 u64 reserved_435_447 : 13;
211 u64 reserved_448_511; /* W7 */
215 u64 stack_base; /* W0 */
218 u64 reserved_66_67 : 2;
219 u64 stack_caching : 1;
220 u64 reserved_70_71 : 3;
221 u64 stack_way_mask : 16;
223 u64 reserved_100_103 : 4;
225 u64 reserved_115_127 : 13;
226 u64 stack_max_pages : 32;
227 u64 stack_pages : 32;
229 u64 reserved_240_255 : 16;
230 u64 stack_offset : 4;
231 u64 reserved_260_263 : 4;
233 u64 reserved_270_271 : 2;
238 u64 fc_hyst_bits : 4;
239 u64 fc_up_crossing : 1;
241 u64 reserved_298_299 : 2;
242 u64 update_time : 16;
243 u64 reserved_316_319 : 4;
244 u64 fc_addr; /* W5 */
245 u64 ptr_start; /* W6 */
246 u64 ptr_end; /* W7 */
247 u64 reserved_512_535 : 24;
251 u64 thresh_int_ena : 1;
253 u64 reserved_555 : 1;
254 u64 thresh_qint_idx : 7;
255 u64 reserved_563 : 1;
256 u64 err_qint_idx : 7;
257 u64 reserved_571_575 : 5;
259 u64 rsvd_615_612 : 4;
261 u64 reserved_627_639 : 13;
262 u64 reserved_640_703; /* W10 */
263 u64 reserved_704_767; /* W11 */
264 u64 reserved_768_831; /* W12 */
265 u64 reserved_832_895; /* W13 */
266 u64 reserved_896_959; /* W14 */
267 u64 reserved_960_1023; /* W15 */
270 /* NIX admin queue completion status */
272 NIX_AQ_COMP_NOTDONE = 0x0,
273 NIX_AQ_COMP_GOOD = 0x1,
274 NIX_AQ_COMP_SWERR = 0x2,
275 NIX_AQ_COMP_CTX_POISON = 0x3,
276 NIX_AQ_COMP_CTX_FAULT = 0x4,
277 NIX_AQ_COMP_LOCKERR = 0x5,
278 NIX_AQ_COMP_SQB_ALLOC_FAIL = 0x6,
281 /* NIX admin queue context types */
283 NIX_AQ_CTYPE_RQ = 0x0,
284 NIX_AQ_CTYPE_SQ = 0x1,
285 NIX_AQ_CTYPE_CQ = 0x2,
286 NIX_AQ_CTYPE_MCE = 0x3,
287 NIX_AQ_CTYPE_RSS = 0x4,
288 NIX_AQ_CTYPE_DYNO = 0x5,
289 NIX_AQ_CTYPE_BANDPROF = 0x6,
292 /* NIX admin queue instruction opcodes */
294 NIX_AQ_INSTOP_NOP = 0x0,
295 NIX_AQ_INSTOP_INIT = 0x1,
296 NIX_AQ_INSTOP_WRITE = 0x2,
297 NIX_AQ_INSTOP_READ = 0x3,
298 NIX_AQ_INSTOP_LOCK = 0x4,
299 NIX_AQ_INSTOP_UNLOCK = 0x5,
302 /* NIX admin queue instruction structure */
303 struct nix_aq_inst_s {
307 u64 reserved_17_23 : 7;
309 u64 reserved_44_62 : 19;
311 u64 res_addr; /* W1 */
314 /* NIX admin queue result structure */
315 struct nix_aq_res_s {
320 u64 reserved_17_63 : 47;
321 u64 reserved_64_127; /* W1 */
324 /* NIX Completion queue context structure */
325 struct nix_cq_ctx_s {
340 u64 update_time : 16;
345 u64 rsvd_210_211 : 2;
348 u64 rsvd_233_235 : 3;
351 u64 cq_err_int_ena : 8;
354 /* CN10K NIX Receive queue context structure */
355 struct nix_cn10k_rq_ctx_s {
363 u64 csum_il4_dis : 1;
364 u64 csum_ol4_dis : 1;
376 u64 xqe_drop_ena : 1;
377 u64 spb_drop_ena : 1;
378 u64 lpb_drop_ena : 1;
380 u64 ipsecd_drop_ena : 1;
382 u64 rsvd_127_125 : 3;
383 u64 band_prof_id : 10; /* W2 */
388 u64 rsvd_150_148 : 3;
394 u64 xqe_imm_size : 6;
395 u64 rsvd_189_184 : 6;
396 u64 xqe_imm_copy : 1;
397 u64 xqe_hdr_split : 1;
398 u64 xqe_drop : 8; /* W3 */
400 u64 wqe_pool_drop : 8;
401 u64 wqe_pool_pass : 8;
402 u64 spb_aura_drop : 8;
403 u64 spb_aura_pass : 8;
404 u64 spb_pool_drop : 8;
405 u64 spb_pool_pass : 8;
406 u64 lpb_aura_drop : 8; /* W4 */
407 u64 lpb_aura_pass : 8;
408 u64 lpb_pool_drop : 8;
409 u64 lpb_pool_pass : 8;
410 u64 rsvd_291_288 : 4;
414 u64 rsvd_319_315 : 5;
415 u64 ltag : 24; /* W5 */
422 u64 max_vsize_exp : 4;
424 u64 rsvd_383_382 : 2;
425 u64 octs : 48; /* W6 */
426 u64 rsvd_447_432 : 16;
427 u64 pkts : 48; /* W7 */
428 u64 rsvd_511_496 : 16;
429 u64 drop_octs : 48; /* W8 */
430 u64 rsvd_575_560 : 16;
431 u64 drop_pkts : 48; /* W9 */
432 u64 rsvd_639_624 : 16;
433 u64 re_pkts : 48; /* W10 */
434 u64 rsvd_703_688 : 16;
435 u64 rsvd_767_704; /* W11 */
436 u64 rsvd_831_768; /* W12 */
437 u64 rsvd_895_832; /* W13 */
438 u64 rsvd_959_896; /* W14 */
439 u64 rsvd_1023_960; /* W15 */
442 /* CN10K NIX Send queue context structure */
443 struct nix_cn10k_sq_ctx_s {
449 u64 sqe_way_mask : 16;
450 u64 smq : 10; /* W1 */
454 u64 smq_rr_weight : 14;
455 u64 default_chan : 12;
457 u64 rsvd_120_119 : 2;
458 u64 smq_rr_count_lb : 7;
459 u64 smq_rr_count_ub : 25; /* W2 */
465 u64 max_sqe_size : 2; /* W3 */
469 u64 smq_next_sq : 20;
470 u64 smq_lso_segnum : 8;
472 u64 smenq_offset : 6;
474 u64 smenq_next_sqb_vld : 1;
476 u64 smq_next_sq_vld : 1;
477 u64 rsvd_255_253 : 3;
478 u64 next_sqb : 64; /* W4 */
479 u64 tail_sqb : 64; /* W5 */
480 u64 smenq_sqb : 64; /* W6 */
481 u64 smenq_next_sqb : 64; /* W7 */
482 u64 head_sqb : 64; /* W8 */
483 u64 rsvd_583_576 : 8; /* W9 */
484 u64 vfi_lso_total : 18;
485 u64 vfi_lso_sizem1 : 3;
487 u64 vfi_lso_mps : 14;
488 u64 vfi_lso_vlan0_ins_ena : 1;
489 u64 vfi_lso_vlan1_ins_ena : 1;
491 u64 rsvd_639_630 : 10;
492 u64 scm_lso_rem : 18; /* W10 */
493 u64 rsvd_703_658 : 46;
494 u64 octs : 48; /* W11 */
495 u64 rsvd_767_752 : 16;
496 u64 pkts : 48; /* W12 */
497 u64 rsvd_831_816 : 16;
498 u64 rsvd_895_832 : 64; /* W13 */
499 u64 dropped_octs : 48;
500 u64 rsvd_959_944 : 16;
501 u64 dropped_pkts : 48;
502 u64 rsvd_1023_1008 : 16;
505 /* NIX Receive queue context structure */
506 struct nix_rq_ctx_s {
520 u64 xqe_drop_ena : 1;
521 u64 spb_drop_ena : 1;
522 u64 lpb_drop_ena : 1;
523 u64 rsvd_127_122 : 6;
524 u64 rsvd_139_128 : 12; /* W2 */
527 u64 rsvd_150_148 : 3;
533 u64 xqe_imm_size : 6;
534 u64 rsvd_189_184 : 6;
535 u64 xqe_imm_copy : 1;
536 u64 xqe_hdr_split : 1;
537 u64 xqe_drop : 8; /* W3*/
539 u64 wqe_pool_drop : 8;
540 u64 wqe_pool_pass : 8;
541 u64 spb_aura_drop : 8;
542 u64 spb_aura_pass : 8;
543 u64 spb_pool_drop : 8;
544 u64 spb_pool_pass : 8;
545 u64 lpb_aura_drop : 8; /* W4 */
546 u64 lpb_aura_pass : 8;
547 u64 lpb_pool_drop : 8;
548 u64 lpb_pool_pass : 8;
549 u64 rsvd_291_288 : 4;
553 u64 rsvd_319_315 : 5;
554 u64 ltag : 24; /* W5 */
558 u64 rsvd_383_366 : 18;
559 u64 octs : 48; /* W6 */
560 u64 rsvd_447_432 : 16;
561 u64 pkts : 48; /* W7 */
562 u64 rsvd_511_496 : 16;
563 u64 drop_octs : 48; /* W8 */
564 u64 rsvd_575_560 : 16;
565 u64 drop_pkts : 48; /* W9 */
566 u64 rsvd_639_624 : 16;
567 u64 re_pkts : 48; /* W10 */
568 u64 rsvd_703_688 : 16;
569 u64 rsvd_767_704; /* W11 */
570 u64 rsvd_831_768; /* W12 */
571 u64 rsvd_895_832; /* W13 */
572 u64 rsvd_959_896; /* W14 */
573 u64 rsvd_1023_960; /* W15 */
578 NIX_MAXSQESZ_W16 = 0x0,
579 NIX_MAXSQESZ_W8 = 0x1,
582 /* NIX SQB caching type */
589 /* NIX Send queue context structure */
590 struct nix_sq_ctx_s {
596 u64 sqe_way_mask : 16;
601 u64 smq_rr_quantum : 24;
602 u64 default_chan : 12;
604 u64 smq_rr_count : 25;
610 u64 max_sqe_size : 2;
614 u64 smq_next_sq : 20;
615 u64 smq_lso_segnum : 8;
617 u64 smenq_offset : 6;
619 u64 smenq_next_sqb_vld : 1;
621 u64 smq_next_sq_vld : 1;
622 u64 rsvd_255_253 : 3;
623 u64 next_sqb : 64;/* W4 */
624 u64 tail_sqb : 64;/* W5 */
625 u64 smenq_sqb : 64;/* W6 */
626 u64 smenq_next_sqb : 64;/* W7 */
627 u64 head_sqb : 64;/* W8 */
628 u64 rsvd_583_576 : 8;
629 u64 vfi_lso_total : 18;
630 u64 vfi_lso_sizem1 : 3;
632 u64 vfi_lso_mps : 14;
633 u64 vfi_lso_vlan0_ins_ena : 1;
634 u64 vfi_lso_vlan1_ins_ena : 1;
636 u64 rsvd_639_630 : 10;
637 u64 scm_lso_rem : 18;
638 u64 rsvd_703_658 : 46;
640 u64 rsvd_767_752 : 16;
642 u64 rsvd_831_816 : 16;
643 u64 rsvd_895_832 : 64;/* W13 */
644 u64 dropped_octs : 48;
645 u64 rsvd_959_944 : 16;
646 u64 dropped_pkts : 48;
647 u64 rsvd_1023_1008 : 16;
650 /* NIX Receive side scaling entry structure*/
653 uint32_t reserved_20_31 : 12;
657 /* NIX receive multicast/mirror entry structure */
658 struct nix_rx_mce_s {
663 uint64_t rsvd_31_24 : 8;
664 uint64_t pf_func : 16;
668 enum nix_band_prof_layers {
669 BAND_PROF_LEAF_LAYER = 0,
670 BAND_PROF_INVAL_LAYER = 1,
671 BAND_PROF_MID_LAYER = 2,
672 BAND_PROF_TOP_LAYER = 3,
673 BAND_PROF_NUM_LAYERS = 4,
676 enum NIX_RX_BAND_PROF_ACTIONRESULT_E {
677 NIX_RX_BAND_PROF_ACTIONRESULT_PASS = 0x0,
678 NIX_RX_BAND_PROF_ACTIONRESULT_DROP = 0x1,
679 NIX_RX_BAND_PROF_ACTIONRESULT_RED = 0x2,
682 enum nix_band_prof_pc_mode {
683 NIX_RX_PC_MODE_VLAN = 0,
684 NIX_RX_PC_MODE_DSCP = 1,
685 NIX_RX_PC_MODE_GEN = 2,
686 NIX_RX_PC_MODE_RSVD = 3,
689 /* NIX ingress policer bandwidth profile structure */
690 struct nix_bandprof_s {
691 uint64_t pc_mode : 2; /* W0 */
693 uint64_t tnl_ena : 1;
694 uint64_t reserved_5_7 : 3;
695 uint64_t peir_exponent : 5;
696 uint64_t reserved_13_15 : 3;
697 uint64_t pebs_exponent : 5;
698 uint64_t reserved_21_23 : 3;
699 uint64_t cir_exponent : 5;
700 uint64_t reserved_29_31 : 3;
701 uint64_t cbs_exponent : 5;
702 uint64_t reserved_37_39 : 3;
703 uint64_t peir_mantissa : 8;
704 uint64_t pebs_mantissa : 8;
705 uint64_t cir_mantissa : 8;
706 uint64_t cbs_mantissa : 8; /* W1 */
708 uint64_t l_sellect : 3;
710 uint64_t adjust_exponent : 5;
711 uint64_t reserved_85_86 : 2;
712 uint64_t adjust_mantissa : 9;
713 uint64_t gc_action : 2;
714 uint64_t yc_action : 2;
715 uint64_t rc_action : 2;
716 uint64_t meter_algo : 2;
717 uint64_t band_prof_id : 7;
718 uint64_t reserved_111_118 : 8;
720 uint64_t reserved_120_127 : 8;
721 uint64_t ts : 48; /* W2 */
722 uint64_t reserved_176_191 : 16;
723 uint64_t pe_accum : 32; /* W3 */
724 uint64_t c_accum : 32;
725 uint64_t green_pkt_pass : 48; /* W4 */
726 uint64_t reserved_304_319 : 16;
727 uint64_t yellow_pkt_pass : 48; /* W5 */
728 uint64_t reserved_368_383 : 16;
729 uint64_t red_pkt_pass : 48; /* W6 */
730 uint64_t reserved_432_447 : 16;
731 uint64_t green_octs_pass : 48; /* W7 */
732 uint64_t reserved_496_511 : 16;
733 uint64_t yellow_octs_pass : 48; /* W8 */
734 uint64_t reserved_560_575 : 16;
735 uint64_t red_octs_pass : 48; /* W9 */
736 uint64_t reserved_624_639 : 16;
737 uint64_t green_pkt_drop : 48; /* W10 */
738 uint64_t reserved_688_703 : 16;
739 uint64_t yellow_pkt_drop : 48; /* W11 */
740 uint64_t reserved_752_767 : 16;
741 uint64_t red_pkt_drop : 48; /* W12 */
742 uint64_t reserved_816_831 : 16;
743 uint64_t green_octs_drop : 48; /* W13 */
744 uint64_t reserved_880_895 : 16;
745 uint64_t yellow_octs_drop : 48; /* W14 */
746 uint64_t reserved_944_959 : 16;
747 uint64_t red_octs_drop : 48; /* W15 */
748 uint64_t reserved_1008_1023 : 16;
753 NIX_LSOALG_ADD_SEGNUM,
754 NIX_LSOALG_ADD_PAYLEN,
755 NIX_LSOALG_ADD_OFFSET,
756 NIX_LSOALG_TCP_FLAGS,
766 struct nix_lso_format {
776 struct nix_rx_flowkey_alg {
783 u64 reserved_24_24 :1;
788 u64 reserved_35_63 :29;
797 enum nix_tx_vtag_op {
803 /* NIX RX VTAG actions */
804 #define VTAG_STRIP BIT_ULL(4)
805 #define VTAG_CAPTURE BIT_ULL(5)
807 #endif /* RVU_STRUCT_H */