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