xref: /linux/drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h (revision a4989fa91110508b64eea7ccde63d062113988ff)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*  Marvell OcteonTx2 RVU Admin Function driver
3  *
4  * Copyright (C) 2018 Marvell International Ltd.
5  *
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.
9  */
10 
11 #ifndef RVU_STRUCT_H
12 #define RVU_STRUCT_H
13 
14 /* RVU Block revision IDs */
15 #define RVU_BLK_RVUM_REVID		0x01
16 
17 #define RVU_MULTI_BLK_VER		0x7ULL
18 
19 /* RVU Block Address Enumeration */
20 enum rvu_block_addr_e {
21 	BLKADDR_RVUM		= 0x0ULL,
22 	BLKADDR_LMT		= 0x1ULL,
23 	BLKADDR_MSIX		= 0x2ULL,
24 	BLKADDR_NPA		= 0x3ULL,
25 	BLKADDR_NIX0		= 0x4ULL,
26 	BLKADDR_NIX1		= 0x5ULL,
27 	BLKADDR_NPC		= 0x6ULL,
28 	BLKADDR_SSO		= 0x7ULL,
29 	BLKADDR_SSOW		= 0x8ULL,
30 	BLKADDR_TIM		= 0x9ULL,
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,
38 	BLK_COUNT		= 0x12ULL,
39 };
40 
41 /* RVU Block Type Enumeration */
42 enum rvu_block_type_e {
43 	BLKTYPE_RVUM = 0x0,
44 	BLKTYPE_MSIX = 0x1,
45 	BLKTYPE_LMT  = 0x2,
46 	BLKTYPE_NIX  = 0x3,
47 	BLKTYPE_NPA  = 0x4,
48 	BLKTYPE_NPC  = 0x5,
49 	BLKTYPE_SSO  = 0x6,
50 	BLKTYPE_SSOW = 0x7,
51 	BLKTYPE_TIM  = 0x8,
52 	BLKTYPE_CPT  = 0x9,
53 	BLKTYPE_NDC  = 0xa,
54 	BLKTYPE_MAX  = 0xa,
55 };
56 
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,
65 };
66 
67 /**
68  * RVU PF Interrupt Vector Enumeration
69  */
70 enum rvu_pf_int_vec_e {
71 	RVU_PF_INT_VEC_VFFLR0     = 0x0,
72 	RVU_PF_INT_VEC_VFFLR1     = 0x1,
73 	RVU_PF_INT_VEC_VFME0      = 0x2,
74 	RVU_PF_INT_VEC_VFME1      = 0x3,
75 	RVU_PF_INT_VEC_VFPF_MBOX0 = 0x4,
76 	RVU_PF_INT_VEC_VFPF_MBOX1 = 0x5,
77 	RVU_PF_INT_VEC_AFPF_MBOX  = 0x6,
78 	RVU_PF_INT_VEC_CNT	  = 0x7,
79 };
80 
81 /* NPA admin queue completion enumeration */
82 enum npa_aq_comp {
83 	NPA_AQ_COMP_NOTDONE    = 0x0,
84 	NPA_AQ_COMP_GOOD       = 0x1,
85 	NPA_AQ_COMP_SWERR      = 0x2,
86 	NPA_AQ_COMP_CTX_POISON = 0x3,
87 	NPA_AQ_COMP_CTX_FAULT  = 0x4,
88 	NPA_AQ_COMP_LOCKERR    = 0x5,
89 };
90 
91 /* NPA admin queue context types */
92 enum npa_aq_ctype {
93 	NPA_AQ_CTYPE_AURA = 0x0,
94 	NPA_AQ_CTYPE_POOL = 0x1,
95 };
96 
97 /* NPA admin queue instruction opcodes */
98 enum npa_aq_instop {
99 	NPA_AQ_INSTOP_NOP    = 0x0,
100 	NPA_AQ_INSTOP_INIT   = 0x1,
101 	NPA_AQ_INSTOP_WRITE  = 0x2,
102 	NPA_AQ_INSTOP_READ   = 0x3,
103 	NPA_AQ_INSTOP_LOCK   = 0x4,
104 	NPA_AQ_INSTOP_UNLOCK = 0x5,
105 };
106 
107 /* NPA admin queue instruction structure */
108 struct npa_aq_inst_s {
109 #if defined(__BIG_ENDIAN_BITFIELD)
110 	u64 doneint               : 1;	/* W0 */
111 	u64 reserved_44_62        : 19;
112 	u64 cindex                : 20;
113 	u64 reserved_17_23        : 7;
114 	u64 lf                    : 9;
115 	u64 ctype                 : 4;
116 	u64 op                    : 4;
117 #else
118 	u64 op                    : 4;
119 	u64 ctype                 : 4;
120 	u64 lf                    : 9;
121 	u64 reserved_17_23        : 7;
122 	u64 cindex                : 20;
123 	u64 reserved_44_62        : 19;
124 	u64 doneint               : 1;
125 #endif
126 	u64 res_addr;			/* W1 */
127 };
128 
129 /* NPA admin queue result structure */
130 struct npa_aq_res_s {
131 #if defined(__BIG_ENDIAN_BITFIELD)
132 	u64 reserved_17_63        : 47; /* W0 */
133 	u64 doneint               : 1;
134 	u64 compcode              : 8;
135 	u64 ctype                 : 4;
136 	u64 op                    : 4;
137 #else
138 	u64 op                    : 4;
139 	u64 ctype                 : 4;
140 	u64 compcode              : 8;
141 	u64 doneint               : 1;
142 	u64 reserved_17_63        : 47;
143 #endif
144 	u64 reserved_64_127;		/* W1 */
145 };
146 
147 struct npa_aura_s {
148 	u64 pool_addr;			/* W0 */
149 #if defined(__BIG_ENDIAN_BITFIELD)	/* W1 */
150 	u64 avg_level             : 8;
151 	u64 reserved_118_119      : 2;
152 	u64 shift                 : 6;
153 	u64 aura_drop             : 8;
154 	u64 reserved_98_103       : 6;
155 	u64 bp_ena                : 2;
156 	u64 aura_drop_ena         : 1;
157 	u64 pool_drop_ena         : 1;
158 	u64 reserved_93           : 1;
159 	u64 avg_con               : 9;
160 	u64 pool_way_mask         : 16;
161 	u64 pool_caching          : 1;
162 	u64 reserved_65           : 2;
163 	u64 ena                   : 1;
164 #else
165 	u64 ena                   : 1;
166 	u64 reserved_65           : 2;
167 	u64 pool_caching          : 1;
168 	u64 pool_way_mask         : 16;
169 	u64 avg_con               : 9;
170 	u64 reserved_93           : 1;
171 	u64 pool_drop_ena         : 1;
172 	u64 aura_drop_ena         : 1;
173 	u64 bp_ena                : 2;
174 	u64 reserved_98_103       : 6;
175 	u64 aura_drop             : 8;
176 	u64 shift                 : 6;
177 	u64 reserved_118_119      : 2;
178 	u64 avg_level             : 8;
179 #endif
180 #if defined(__BIG_ENDIAN_BITFIELD)	/* W2 */
181 	u64 reserved_189_191      : 3;
182 	u64 nix1_bpid             : 9;
183 	u64 reserved_177_179      : 3;
184 	u64 nix0_bpid             : 9;
185 	u64 reserved_164_167      : 4;
186 	u64 count                 : 36;
187 #else
188 	u64 count                 : 36;
189 	u64 reserved_164_167      : 4;
190 	u64 nix0_bpid             : 9;
191 	u64 reserved_177_179      : 3;
192 	u64 nix1_bpid             : 9;
193 	u64 reserved_189_191      : 3;
194 #endif
195 #if defined(__BIG_ENDIAN_BITFIELD)	/* W3 */
196 	u64 reserved_252_255      : 4;
197 	u64 fc_hyst_bits          : 4;
198 	u64 fc_stype              : 2;
199 	u64 fc_up_crossing        : 1;
200 	u64 fc_ena                : 1;
201 	u64 reserved_240_243      : 4;
202 	u64 bp                    : 8;
203 	u64 reserved_228_231      : 4;
204 	u64 limit                 : 36;
205 #else
206 	u64 limit                 : 36;
207 	u64 reserved_228_231      : 4;
208 	u64 bp                    : 8;
209 	u64 reserved_240_243      : 4;
210 	u64 fc_ena                : 1;
211 	u64 fc_up_crossing        : 1;
212 	u64 fc_stype              : 2;
213 	u64 fc_hyst_bits          : 4;
214 	u64 reserved_252_255      : 4;
215 #endif
216 	u64 fc_addr;			/* W4 */
217 #if defined(__BIG_ENDIAN_BITFIELD)	/* W5 */
218 	u64 reserved_379_383      : 5;
219 	u64 err_qint_idx          : 7;
220 	u64 reserved_371          : 1;
221 	u64 thresh_qint_idx       : 7;
222 	u64 reserved_363          : 1;
223 	u64 thresh_up             : 1;
224 	u64 thresh_int_ena        : 1;
225 	u64 thresh_int            : 1;
226 	u64 err_int_ena           : 8;
227 	u64 err_int               : 8;
228 	u64 update_time           : 16;
229 	u64 pool_drop             : 8;
230 #else
231 	u64 pool_drop             : 8;
232 	u64 update_time           : 16;
233 	u64 err_int               : 8;
234 	u64 err_int_ena           : 8;
235 	u64 thresh_int            : 1;
236 	u64 thresh_int_ena        : 1;
237 	u64 thresh_up             : 1;
238 	u64 reserved_363          : 1;
239 	u64 thresh_qint_idx       : 7;
240 	u64 reserved_371          : 1;
241 	u64 err_qint_idx          : 7;
242 	u64 reserved_379_383      : 5;
243 #endif
244 #if defined(__BIG_ENDIAN_BITFIELD)	/* W6 */
245 	u64 reserved_420_447      : 28;
246 	u64 thresh                : 36;
247 #else
248 	u64 thresh                : 36;
249 	u64 reserved_420_447      : 28;
250 #endif
251 	u64 reserved_448_511;		/* W7 */
252 };
253 
254 struct npa_pool_s {
255 	u64 stack_base;			/* W0 */
256 #if defined(__BIG_ENDIAN_BITFIELD)	/* W1 */
257 	u64 reserved_115_127      : 13;
258 	u64 buf_size              : 11;
259 	u64 reserved_100_103      : 4;
260 	u64 buf_offset            : 12;
261 	u64 stack_way_mask        : 16;
262 	u64 reserved_70_71        : 3;
263 	u64 stack_caching         : 1;
264 	u64 reserved_66_67        : 2;
265 	u64 nat_align             : 1;
266 	u64 ena                   : 1;
267 #else
268 	u64 ena                   : 1;
269 	u64 nat_align             : 1;
270 	u64 reserved_66_67        : 2;
271 	u64 stack_caching         : 1;
272 	u64 reserved_70_71        : 3;
273 	u64 stack_way_mask        : 16;
274 	u64 buf_offset            : 12;
275 	u64 reserved_100_103      : 4;
276 	u64 buf_size              : 11;
277 	u64 reserved_115_127      : 13;
278 #endif
279 #if defined(__BIG_ENDIAN_BITFIELD)	/* W2 */
280 	u64 stack_pages           : 32;
281 	u64 stack_max_pages       : 32;
282 #else
283 	u64 stack_max_pages       : 32;
284 	u64 stack_pages           : 32;
285 #endif
286 #if defined(__BIG_ENDIAN_BITFIELD)	/* W3 */
287 	u64 reserved_240_255      : 16;
288 	u64 op_pc                 : 48;
289 #else
290 	u64 op_pc                 : 48;
291 	u64 reserved_240_255      : 16;
292 #endif
293 #if defined(__BIG_ENDIAN_BITFIELD)	/* W4 */
294 	u64 reserved_316_319      : 4;
295 	u64 update_time           : 16;
296 	u64 reserved_297_299      : 3;
297 	u64 fc_up_crossing        : 1;
298 	u64 fc_hyst_bits          : 4;
299 	u64 fc_stype              : 2;
300 	u64 fc_ena                : 1;
301 	u64 avg_con               : 9;
302 	u64 avg_level             : 8;
303 	u64 reserved_270_271      : 2;
304 	u64 shift                 : 6;
305 	u64 reserved_260_263      : 4;
306 	u64 stack_offset          : 4;
307 #else
308 	u64 stack_offset          : 4;
309 	u64 reserved_260_263      : 4;
310 	u64 shift                 : 6;
311 	u64 reserved_270_271      : 2;
312 	u64 avg_level             : 8;
313 	u64 avg_con               : 9;
314 	u64 fc_ena                : 1;
315 	u64 fc_stype              : 2;
316 	u64 fc_hyst_bits          : 4;
317 	u64 fc_up_crossing        : 1;
318 	u64 reserved_297_299      : 3;
319 	u64 update_time           : 16;
320 	u64 reserved_316_319      : 4;
321 #endif
322 	u64 fc_addr;			/* W5 */
323 	u64 ptr_start;			/* W6 */
324 	u64 ptr_end;			/* W7 */
325 #if defined(__BIG_ENDIAN_BITFIELD)	/* W8 */
326 	u64 reserved_571_575      : 5;
327 	u64 err_qint_idx          : 7;
328 	u64 reserved_563          : 1;
329 	u64 thresh_qint_idx       : 7;
330 	u64 reserved_555          : 1;
331 	u64 thresh_up             : 1;
332 	u64 thresh_int_ena        : 1;
333 	u64 thresh_int            : 1;
334 	u64 err_int_ena           : 8;
335 	u64 err_int               : 8;
336 	u64 reserved_512_535      : 24;
337 #else
338 	u64 reserved_512_535      : 24;
339 	u64 err_int               : 8;
340 	u64 err_int_ena           : 8;
341 	u64 thresh_int            : 1;
342 	u64 thresh_int_ena        : 1;
343 	u64 thresh_up             : 1;
344 	u64 reserved_555          : 1;
345 	u64 thresh_qint_idx       : 7;
346 	u64 reserved_563          : 1;
347 	u64 err_qint_idx          : 7;
348 	u64 reserved_571_575      : 5;
349 #endif
350 #if defined(__BIG_ENDIAN_BITFIELD)	/* W9 */
351 	u64 reserved_612_639      : 28;
352 	u64 thresh                : 36;
353 #else
354 	u64 thresh                : 36;
355 	u64 reserved_612_639      : 28;
356 #endif
357 	u64 reserved_640_703;		/* W10 */
358 	u64 reserved_704_767;		/* W11 */
359 	u64 reserved_768_831;		/* W12 */
360 	u64 reserved_832_895;		/* W13 */
361 	u64 reserved_896_959;		/* W14 */
362 	u64 reserved_960_1023;		/* W15 */
363 };
364 
365 /* NIX admin queue completion status */
366 enum nix_aq_comp {
367 	NIX_AQ_COMP_NOTDONE        = 0x0,
368 	NIX_AQ_COMP_GOOD           = 0x1,
369 	NIX_AQ_COMP_SWERR          = 0x2,
370 	NIX_AQ_COMP_CTX_POISON     = 0x3,
371 	NIX_AQ_COMP_CTX_FAULT      = 0x4,
372 	NIX_AQ_COMP_LOCKERR        = 0x5,
373 	NIX_AQ_COMP_SQB_ALLOC_FAIL = 0x6,
374 };
375 
376 /* NIX admin queue context types */
377 enum nix_aq_ctype {
378 	NIX_AQ_CTYPE_RQ   = 0x0,
379 	NIX_AQ_CTYPE_SQ   = 0x1,
380 	NIX_AQ_CTYPE_CQ   = 0x2,
381 	NIX_AQ_CTYPE_MCE  = 0x3,
382 	NIX_AQ_CTYPE_RSS  = 0x4,
383 	NIX_AQ_CTYPE_DYNO = 0x5,
384 };
385 
386 /* NIX admin queue instruction opcodes */
387 enum nix_aq_instop {
388 	NIX_AQ_INSTOP_NOP    = 0x0,
389 	NIX_AQ_INSTOP_INIT   = 0x1,
390 	NIX_AQ_INSTOP_WRITE  = 0x2,
391 	NIX_AQ_INSTOP_READ   = 0x3,
392 	NIX_AQ_INSTOP_LOCK   = 0x4,
393 	NIX_AQ_INSTOP_UNLOCK = 0x5,
394 };
395 
396 /* NIX admin queue instruction structure */
397 struct nix_aq_inst_s {
398 #if defined(__BIG_ENDIAN_BITFIELD)
399 	u64 doneint		: 1;	/* W0 */
400 	u64 reserved_44_62	: 19;
401 	u64 cindex		: 20;
402 	u64 reserved_15_23	: 9;
403 	u64 lf			: 7;
404 	u64 ctype		: 4;
405 	u64 op			: 4;
406 #else
407 	u64 op			: 4;
408 	u64 ctype		: 4;
409 	u64 lf			: 7;
410 	u64 reserved_15_23	: 9;
411 	u64 cindex		: 20;
412 	u64 reserved_44_62	: 19;
413 	u64 doneint		: 1;
414 #endif
415 	u64 res_addr;			/* W1 */
416 };
417 
418 /* NIX admin queue result structure */
419 struct nix_aq_res_s {
420 #if defined(__BIG_ENDIAN_BITFIELD)
421 	u64 reserved_17_63	: 47;	/* W0 */
422 	u64 doneint		: 1;
423 	u64 compcode		: 8;
424 	u64 ctype		: 4;
425 	u64 op			: 4;
426 #else
427 	u64 op			: 4;
428 	u64 ctype		: 4;
429 	u64 compcode		: 8;
430 	u64 doneint		: 1;
431 	u64 reserved_17_63	: 47;
432 #endif
433 	u64 reserved_64_127;		/* W1 */
434 };
435 
436 /* NIX Completion queue context structure */
437 struct nix_cq_ctx_s {
438 	u64 base;
439 #if defined(__BIG_ENDIAN_BITFIELD)	/* W1 */
440 	u64 wrptr		: 20;
441 	u64 avg_con		: 9;
442 	u64 cint_idx		: 7;
443 	u64 cq_err		: 1;
444 	u64 qint_idx		: 7;
445 	u64 rsvd_81_83		: 3;
446 	u64 bpid		: 9;
447 	u64 rsvd_69_71		: 3;
448 	u64 bp_ena		: 1;
449 	u64 rsvd_64_67		: 4;
450 #else
451 	u64 rsvd_64_67		: 4;
452 	u64 bp_ena		: 1;
453 	u64 rsvd_69_71		: 3;
454 	u64 bpid		: 9;
455 	u64 rsvd_81_83		: 3;
456 	u64 qint_idx		: 7;
457 	u64 cq_err		: 1;
458 	u64 cint_idx		: 7;
459 	u64 avg_con		: 9;
460 	u64 wrptr		: 20;
461 #endif
462 #if defined(__BIG_ENDIAN_BITFIELD)  /* W2 */
463 	u64 update_time		: 16;
464 	u64 avg_level		: 8;
465 	u64 head		: 20;
466 	u64 tail		: 20;
467 #else
468 	u64 tail		: 20;
469 	u64 head		: 20;
470 	u64 avg_level		: 8;
471 	u64 update_time		: 16;
472 #endif
473 #if defined(__BIG_ENDIAN_BITFIELD)  /* W3 */
474 	u64 cq_err_int_ena	: 8;
475 	u64 cq_err_int		: 8;
476 	u64 qsize		: 4;
477 	u64 rsvd_233_235	: 3;
478 	u64 caching		: 1;
479 	u64 substream		: 20;
480 	u64 rsvd_210_211	: 2;
481 	u64 ena			: 1;
482 	u64 drop_ena		: 1;
483 	u64 drop		: 8;
484 	u64 bp			: 8;
485 #else
486 	u64 bp			: 8;
487 	u64 drop		: 8;
488 	u64 drop_ena		: 1;
489 	u64 ena			: 1;
490 	u64 rsvd_210_211	: 2;
491 	u64 substream		: 20;
492 	u64 caching		: 1;
493 	u64 rsvd_233_235	: 3;
494 	u64 qsize		: 4;
495 	u64 cq_err_int		: 8;
496 	u64 cq_err_int_ena	: 8;
497 #endif
498 };
499 
500 /* NIX Receive queue context structure */
501 struct nix_rq_ctx_s {
502 #if defined(__BIG_ENDIAN_BITFIELD)  /* W0 */
503 	u64 wqe_aura      : 20;
504 	u64 substream     : 20;
505 	u64 cq            : 20;
506 	u64 ena_wqwd      : 1;
507 	u64 ipsech_ena    : 1;
508 	u64 sso_ena       : 1;
509 	u64 ena           : 1;
510 #else
511 	u64 ena           : 1;
512 	u64 sso_ena       : 1;
513 	u64 ipsech_ena    : 1;
514 	u64 ena_wqwd      : 1;
515 	u64 cq            : 20;
516 	u64 substream     : 20;
517 	u64 wqe_aura      : 20;
518 #endif
519 #if defined(__BIG_ENDIAN_BITFIELD)  /* W1 */
520 	u64 rsvd_127_122  : 6;
521 	u64 lpb_drop_ena  : 1;
522 	u64 spb_drop_ena  : 1;
523 	u64 xqe_drop_ena  : 1;
524 	u64 wqe_caching   : 1;
525 	u64 pb_caching    : 2;
526 	u64 sso_tt        : 2;
527 	u64 sso_grp       : 10;
528 	u64 lpb_aura      : 20;
529 	u64 spb_aura      : 20;
530 #else
531 	u64 spb_aura      : 20;
532 	u64 lpb_aura      : 20;
533 	u64 sso_grp       : 10;
534 	u64 sso_tt        : 2;
535 	u64 pb_caching    : 2;
536 	u64 wqe_caching   : 1;
537 	u64 xqe_drop_ena  : 1;
538 	u64 spb_drop_ena  : 1;
539 	u64 lpb_drop_ena  : 1;
540 	u64 rsvd_127_122  : 6;
541 #endif
542 #if defined(__BIG_ENDIAN_BITFIELD)  /* W2 */
543 	u64 xqe_hdr_split : 1;
544 	u64 xqe_imm_copy  : 1;
545 	u64 rsvd_189_184  : 6;
546 	u64 xqe_imm_size  : 6;
547 	u64 later_skip    : 6;
548 	u64 rsvd_171      : 1;
549 	u64 first_skip    : 7;
550 	u64 lpb_sizem1    : 12;
551 	u64 spb_ena       : 1;
552 	u64 rsvd_150_148  : 3;
553 	u64 wqe_skip      : 2;
554 	u64 spb_sizem1    : 6;
555 	u64 rsvd_139_128  : 12;
556 #else
557 	u64 rsvd_139_128  : 12;
558 	u64 spb_sizem1    : 6;
559 	u64 wqe_skip      : 2;
560 	u64 rsvd_150_148  : 3;
561 	u64 spb_ena       : 1;
562 	u64 lpb_sizem1    : 12;
563 	u64 first_skip    : 7;
564 	u64 rsvd_171      : 1;
565 	u64 later_skip    : 6;
566 	u64 xqe_imm_size  : 6;
567 	u64 rsvd_189_184  : 6;
568 	u64 xqe_imm_copy  : 1;
569 	u64 xqe_hdr_split : 1;
570 #endif
571 #if defined(__BIG_ENDIAN_BITFIELD)  /* W3 */
572 	u64 spb_pool_pass : 8;
573 	u64 spb_pool_drop : 8;
574 	u64 spb_aura_pass : 8;
575 	u64 spb_aura_drop : 8;
576 	u64 wqe_pool_pass : 8;
577 	u64 wqe_pool_drop : 8;
578 	u64 xqe_pass      : 8;
579 	u64 xqe_drop      : 8;
580 #else
581 	u64 xqe_drop      : 8;
582 	u64 xqe_pass      : 8;
583 	u64 wqe_pool_drop : 8;
584 	u64 wqe_pool_pass : 8;
585 	u64 spb_aura_drop : 8;
586 	u64 spb_aura_pass : 8;
587 	u64 spb_pool_drop : 8;
588 	u64 spb_pool_pass : 8;
589 #endif
590 #if defined(__BIG_ENDIAN_BITFIELD)  /* W4 */
591 	u64 rsvd_319_315  : 5;
592 	u64 qint_idx      : 7;
593 	u64 rq_int_ena    : 8;
594 	u64 rq_int        : 8;
595 	u64 rsvd_291_288  : 4;
596 	u64 lpb_pool_pass : 8;
597 	u64 lpb_pool_drop : 8;
598 	u64 lpb_aura_pass : 8;
599 	u64 lpb_aura_drop : 8;
600 #else
601 	u64 lpb_aura_drop : 8;
602 	u64 lpb_aura_pass : 8;
603 	u64 lpb_pool_drop : 8;
604 	u64 lpb_pool_pass : 8;
605 	u64 rsvd_291_288  : 4;
606 	u64 rq_int        : 8;
607 	u64 rq_int_ena    : 8;
608 	u64 qint_idx      : 7;
609 	u64 rsvd_319_315  : 5;
610 #endif
611 #if defined(__BIG_ENDIAN_BITFIELD)  /* W5 */
612 	u64 rsvd_383_366  : 18;
613 	u64 flow_tagw     : 6;
614 	u64 bad_utag      : 8;
615 	u64 good_utag     : 8;
616 	u64 ltag          : 24;
617 #else
618 	u64 ltag          : 24;
619 	u64 good_utag     : 8;
620 	u64 bad_utag      : 8;
621 	u64 flow_tagw     : 6;
622 	u64 rsvd_383_366  : 18;
623 #endif
624 #if defined(__BIG_ENDIAN_BITFIELD)  /* W6 */
625 	u64 rsvd_447_432  : 16;
626 	u64 octs          : 48;
627 #else
628 	u64 octs          : 48;
629 	u64 rsvd_447_432  : 16;
630 #endif
631 #if defined(__BIG_ENDIAN_BITFIELD)  /* W7 */
632 	u64 rsvd_511_496  : 16;
633 	u64 pkts          : 48;
634 #else
635 	u64 pkts          : 48;
636 	u64 rsvd_511_496  : 16;
637 #endif
638 #if defined(__BIG_ENDIAN_BITFIELD)  /* W8 */
639 	u64 rsvd_575_560  : 16;
640 	u64 drop_octs     : 48;
641 #else
642 	u64 drop_octs     : 48;
643 	u64 rsvd_575_560  : 16;
644 #endif
645 #if defined(__BIG_ENDIAN_BITFIELD)	/* W9 */
646 	u64 rsvd_639_624  : 16;
647 	u64 drop_pkts     : 48;
648 #else
649 	u64 drop_pkts     : 48;
650 	u64 rsvd_639_624  : 16;
651 #endif
652 #if defined(__BIG_ENDIAN_BITFIELD)	/* W10 */
653 	u64 rsvd_703_688  : 16;
654 	u64 re_pkts       : 48;
655 #else
656 	u64 re_pkts       : 48;
657 	u64 rsvd_703_688  : 16;
658 #endif
659 	u64 rsvd_767_704;		/* W11 */
660 	u64 rsvd_831_768;		/* W12 */
661 	u64 rsvd_895_832;		/* W13 */
662 	u64 rsvd_959_896;		/* W14 */
663 	u64 rsvd_1023_960;		/* W15 */
664 };
665 
666 /* NIX sqe sizes */
667 enum nix_maxsqesz {
668 	NIX_MAXSQESZ_W16 = 0x0,
669 	NIX_MAXSQESZ_W8  = 0x1,
670 };
671 
672 /* NIX SQB caching type */
673 enum nix_stype {
674 	NIX_STYPE_STF = 0x0,
675 	NIX_STYPE_STT = 0x1,
676 	NIX_STYPE_STP = 0x2,
677 };
678 
679 /* NIX Send queue context structure */
680 struct nix_sq_ctx_s {
681 #if defined(__BIG_ENDIAN_BITFIELD)  /* W0 */
682 	u64 sqe_way_mask          : 16;
683 	u64 cq                    : 20;
684 	u64 sdp_mcast             : 1;
685 	u64 substream             : 20;
686 	u64 qint_idx              : 6;
687 	u64 ena                   : 1;
688 #else
689 	u64 ena                   : 1;
690 	u64 qint_idx              : 6;
691 	u64 substream             : 20;
692 	u64 sdp_mcast             : 1;
693 	u64 cq                    : 20;
694 	u64 sqe_way_mask          : 16;
695 #endif
696 #if defined(__BIG_ENDIAN_BITFIELD)  /* W1 */
697 	u64 sqb_count             : 16;
698 	u64 default_chan          : 12;
699 	u64 smq_rr_quantum        : 24;
700 	u64 sso_ena               : 1;
701 	u64 xoff                  : 1;
702 	u64 cq_ena                : 1;
703 	u64 smq                   : 9;
704 #else
705 	u64 smq                   : 9;
706 	u64 cq_ena                : 1;
707 	u64 xoff                  : 1;
708 	u64 sso_ena               : 1;
709 	u64 smq_rr_quantum        : 24;
710 	u64 default_chan          : 12;
711 	u64 sqb_count             : 16;
712 #endif
713 #if defined(__BIG_ENDIAN_BITFIELD)  /* W2 */
714 	u64 rsvd_191              : 1;
715 	u64 sqe_stype             : 2;
716 	u64 sq_int_ena            : 8;
717 	u64 sq_int                : 8;
718 	u64 sqb_aura              : 20;
719 	u64 smq_rr_count          : 25;
720 #else
721 	u64 smq_rr_count          : 25;
722 	u64 sqb_aura              : 20;
723 	u64 sq_int                : 8;
724 	u64 sq_int_ena            : 8;
725 	u64 sqe_stype             : 2;
726 	u64 rsvd_191              : 1;
727 #endif
728 #if defined(__BIG_ENDIAN_BITFIELD)  /* W3 */
729 	u64 rsvd_255_253          : 3;
730 	u64 smq_next_sq_vld       : 1;
731 	u64 smq_pend              : 1;
732 	u64 smenq_next_sqb_vld    : 1;
733 	u64 head_offset           : 6;
734 	u64 smenq_offset          : 6;
735 	u64 tail_offset           : 6;
736 	u64 smq_lso_segnum        : 8;
737 	u64 smq_next_sq           : 20;
738 	u64 mnq_dis               : 1;
739 	u64 lmt_dis               : 1;
740 	u64 cq_limit              : 8;
741 	u64 max_sqe_size          : 2;
742 #else
743 	u64 max_sqe_size          : 2;
744 	u64 cq_limit              : 8;
745 	u64 lmt_dis               : 1;
746 	u64 mnq_dis               : 1;
747 	u64 smq_next_sq           : 20;
748 	u64 smq_lso_segnum        : 8;
749 	u64 tail_offset           : 6;
750 	u64 smenq_offset          : 6;
751 	u64 head_offset           : 6;
752 	u64 smenq_next_sqb_vld    : 1;
753 	u64 smq_pend              : 1;
754 	u64 smq_next_sq_vld       : 1;
755 	u64 rsvd_255_253          : 3;
756 #endif
757 	u64 next_sqb              : 64;/* W4 */
758 	u64 tail_sqb              : 64;/* W5 */
759 	u64 smenq_sqb             : 64;/* W6 */
760 	u64 smenq_next_sqb        : 64;/* W7 */
761 	u64 head_sqb              : 64;/* W8 */
762 #if defined(__BIG_ENDIAN_BITFIELD)  /* W9 */
763 	u64 rsvd_639_630          : 10;
764 	u64 vfi_lso_vld           : 1;
765 	u64 vfi_lso_vlan1_ins_ena : 1;
766 	u64 vfi_lso_vlan0_ins_ena : 1;
767 	u64 vfi_lso_mps           : 14;
768 	u64 vfi_lso_sb            : 8;
769 	u64 vfi_lso_sizem1        : 3;
770 	u64 vfi_lso_total         : 18;
771 	u64 rsvd_583_576          : 8;
772 #else
773 	u64 rsvd_583_576          : 8;
774 	u64 vfi_lso_total         : 18;
775 	u64 vfi_lso_sizem1        : 3;
776 	u64 vfi_lso_sb            : 8;
777 	u64 vfi_lso_mps           : 14;
778 	u64 vfi_lso_vlan0_ins_ena : 1;
779 	u64 vfi_lso_vlan1_ins_ena : 1;
780 	u64 vfi_lso_vld           : 1;
781 	u64 rsvd_639_630          : 10;
782 #endif
783 #if defined(__BIG_ENDIAN_BITFIELD) /* W10 */
784 	u64 rsvd_703_658          : 46;
785 	u64 scm_lso_rem           : 18;
786 #else
787 	u64 scm_lso_rem           : 18;
788 	u64 rsvd_703_658          : 46;
789 #endif
790 #if defined(__BIG_ENDIAN_BITFIELD) /* W11 */
791 	u64 rsvd_767_752          : 16;
792 	u64 octs                  : 48;
793 #else
794 	u64 octs                  : 48;
795 	u64 rsvd_767_752          : 16;
796 #endif
797 #if defined(__BIG_ENDIAN_BITFIELD) /* W12 */
798 	u64 rsvd_831_816          : 16;
799 	u64 pkts                  : 48;
800 #else
801 	u64 pkts                  : 48;
802 	u64 rsvd_831_816          : 16;
803 #endif
804 	u64 rsvd_895_832          : 64;/* W13 */
805 #if defined(__BIG_ENDIAN_BITFIELD) /* W14 */
806 	u64 rsvd_959_944          : 16;
807 	u64 dropped_octs          : 48;
808 #else
809 	u64 dropped_octs          : 48;
810 	u64 rsvd_959_944          : 16;
811 #endif
812 #if defined(__BIG_ENDIAN_BITFIELD) /* W15 */
813 	u64 rsvd_1023_1008        : 16;
814 	u64 dropped_pkts          : 48;
815 #else
816 	u64 dropped_pkts          : 48;
817 	u64 rsvd_1023_1008        : 16;
818 #endif
819 };
820 
821 /* NIX Receive side scaling entry structure*/
822 struct nix_rsse_s {
823 #if defined(__BIG_ENDIAN_BITFIELD)
824 	uint32_t reserved_20_31		: 12;
825 	uint32_t rq			: 20;
826 #else
827 	uint32_t rq			: 20;
828 	uint32_t reserved_20_31		: 12;
829 
830 #endif
831 };
832 
833 /* NIX receive multicast/mirror entry structure */
834 struct nix_rx_mce_s {
835 #if defined(__BIG_ENDIAN_BITFIELD)  /* W0 */
836 	uint64_t next       : 16;
837 	uint64_t pf_func    : 16;
838 	uint64_t rsvd_31_24 : 8;
839 	uint64_t index      : 20;
840 	uint64_t eol        : 1;
841 	uint64_t rsvd_2     : 1;
842 	uint64_t op         : 2;
843 #else
844 	uint64_t op         : 2;
845 	uint64_t rsvd_2     : 1;
846 	uint64_t eol        : 1;
847 	uint64_t index      : 20;
848 	uint64_t rsvd_31_24 : 8;
849 	uint64_t pf_func    : 16;
850 	uint64_t next       : 16;
851 #endif
852 };
853 
854 enum nix_lsoalg {
855 	NIX_LSOALG_NOP,
856 	NIX_LSOALG_ADD_SEGNUM,
857 	NIX_LSOALG_ADD_PAYLEN,
858 	NIX_LSOALG_ADD_OFFSET,
859 	NIX_LSOALG_TCP_FLAGS,
860 };
861 
862 enum nix_txlayer {
863 	NIX_TXLAYER_OL3,
864 	NIX_TXLAYER_OL4,
865 	NIX_TXLAYER_IL3,
866 	NIX_TXLAYER_IL4,
867 };
868 
869 struct nix_lso_format {
870 #if defined(__BIG_ENDIAN_BITFIELD)
871 	u64 rsvd_19_63		: 45;
872 	u64 alg			: 3;
873 	u64 rsvd_14_15		: 2;
874 	u64 sizem1		: 2;
875 	u64 rsvd_10_11		: 2;
876 	u64 layer		: 2;
877 	u64 offset		: 8;
878 #else
879 	u64 offset		: 8;
880 	u64 layer		: 2;
881 	u64 rsvd_10_11		: 2;
882 	u64 sizem1		: 2;
883 	u64 rsvd_14_15		: 2;
884 	u64 alg			: 3;
885 	u64 rsvd_19_63		: 45;
886 #endif
887 };
888 
889 struct nix_rx_flowkey_alg {
890 #if defined(__BIG_ENDIAN_BITFIELD)
891 	u64 reserved_35_63	:29;
892 	u64 ltype_match		:4;
893 	u64 ltype_mask		:4;
894 	u64 sel_chan		:1;
895 	u64 ena			:1;
896 	u64 reserved_24_24	:1;
897 	u64 lid			:3;
898 	u64 bytesm1		:5;
899 	u64 hdr_offset		:8;
900 	u64 fn_mask		:1;
901 	u64 ln_mask		:1;
902 	u64 key_offset		:6;
903 #else
904 	u64 key_offset		:6;
905 	u64 ln_mask		:1;
906 	u64 fn_mask		:1;
907 	u64 hdr_offset		:8;
908 	u64 bytesm1		:5;
909 	u64 lid			:3;
910 	u64 reserved_24_24	:1;
911 	u64 ena			:1;
912 	u64 sel_chan		:1;
913 	u64 ltype_mask		:4;
914 	u64 ltype_match		:4;
915 	u64 reserved_35_63	:29;
916 #endif
917 };
918 
919 /* NIX VTAG size */
920 enum nix_vtag_size {
921 	VTAGSIZE_T4   = 0x0,
922 	VTAGSIZE_T8   = 0x1,
923 };
924 
925 enum nix_tx_vtag_op {
926 	NOP		= 0x0,
927 	VTAG_INSERT	= 0x1,
928 	VTAG_REPLACE	= 0x2,
929 };
930 
931 /* NIX RX VTAG actions */
932 #define VTAG_STRIP	BIT_ULL(4)
933 #define VTAG_CAPTURE	BIT_ULL(5)
934 
935 #endif /* RVU_STRUCT_H */
936