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