0fe673e6d03628c8ffb845e865092cecaea7cb53
[deb_dpdk.git] / drivers / net / thunderx / base / nicvf_hw_defs.h
1 /*
2  *   BSD LICENSE
3  *
4  *   Copyright (C) Cavium, Inc. 2016.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Cavium, Inc nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _THUNDERX_NICVF_HW_DEFS_H
34 #define _THUNDERX_NICVF_HW_DEFS_H
35
36 #include <stdint.h>
37 #include <stdbool.h>
38
39 #include "nicvf_plat.h"
40
41 /* Virtual function register offsets */
42
43 #define NIC_VF_CFG                      (0x000020)
44 #define NIC_VF_PF_MAILBOX_0_1           (0x000130)
45 #define NIC_VF_INT                      (0x000200)
46 #define NIC_VF_INT_W1S                  (0x000220)
47 #define NIC_VF_ENA_W1C                  (0x000240)
48 #define NIC_VF_ENA_W1S                  (0x000260)
49
50 #define NIC_VNIC_RSS_CFG                (0x0020E0)
51 #define NIC_VNIC_RSS_KEY_0_4            (0x002200)
52 #define NIC_VNIC_TX_STAT_0_4            (0x004000)
53 #define NIC_VNIC_RX_STAT_0_13           (0x004100)
54 #define NIC_VNIC_RQ_GEN_CFG             (0x010010)
55
56 #define NIC_QSET_CQ_0_7_CFG             (0x010400)
57 #define NIC_QSET_CQ_0_7_CFG2            (0x010408)
58 #define NIC_QSET_CQ_0_7_THRESH          (0x010410)
59 #define NIC_QSET_CQ_0_7_BASE            (0x010420)
60 #define NIC_QSET_CQ_0_7_HEAD            (0x010428)
61 #define NIC_QSET_CQ_0_7_TAIL            (0x010430)
62 #define NIC_QSET_CQ_0_7_DOOR            (0x010438)
63 #define NIC_QSET_CQ_0_7_STATUS          (0x010440)
64 #define NIC_QSET_CQ_0_7_STATUS2         (0x010448)
65 #define NIC_QSET_CQ_0_7_DEBUG           (0x010450)
66
67 #define NIC_QSET_RQ_0_7_CFG             (0x010600)
68 #define NIC_QSET_RQ_0_7_STATUS0         (0x010700)
69 #define NIC_QSET_RQ_0_7_STATUS1         (0x010708)
70
71 #define NIC_QSET_SQ_0_7_CFG             (0x010800)
72 #define NIC_QSET_SQ_0_7_THRESH          (0x010810)
73 #define NIC_QSET_SQ_0_7_BASE            (0x010820)
74 #define NIC_QSET_SQ_0_7_HEAD            (0x010828)
75 #define NIC_QSET_SQ_0_7_TAIL            (0x010830)
76 #define NIC_QSET_SQ_0_7_DOOR            (0x010838)
77 #define NIC_QSET_SQ_0_7_STATUS          (0x010840)
78 #define NIC_QSET_SQ_0_7_DEBUG           (0x010848)
79 #define NIC_QSET_SQ_0_7_STATUS0         (0x010900)
80 #define NIC_QSET_SQ_0_7_STATUS1         (0x010908)
81
82 #define NIC_QSET_RBDR_0_1_CFG           (0x010C00)
83 #define NIC_QSET_RBDR_0_1_THRESH        (0x010C10)
84 #define NIC_QSET_RBDR_0_1_BASE          (0x010C20)
85 #define NIC_QSET_RBDR_0_1_HEAD          (0x010C28)
86 #define NIC_QSET_RBDR_0_1_TAIL          (0x010C30)
87 #define NIC_QSET_RBDR_0_1_DOOR          (0x010C38)
88 #define NIC_QSET_RBDR_0_1_STATUS0       (0x010C40)
89 #define NIC_QSET_RBDR_0_1_STATUS1       (0x010C48)
90 #define NIC_QSET_RBDR_0_1_PRFCH_STATUS  (0x010C50)
91
92 /* vNIC HW Constants */
93
94 #define NIC_Q_NUM_SHIFT                 18
95
96 #define MAX_QUEUE_SET                   128
97 #define MAX_RCV_QUEUES_PER_QS           8
98 #define MAX_RCV_BUF_DESC_RINGS_PER_QS   2
99 #define MAX_SND_QUEUES_PER_QS           8
100 #define MAX_CMP_QUEUES_PER_QS           8
101
102 #define NICVF_INTR_CQ_SHIFT             0
103 #define NICVF_INTR_SQ_SHIFT             8
104 #define NICVF_INTR_RBDR_SHIFT           16
105 #define NICVF_INTR_PKT_DROP_SHIFT       20
106 #define NICVF_INTR_TCP_TIMER_SHIFT      21
107 #define NICVF_INTR_MBOX_SHIFT           22
108 #define NICVF_INTR_QS_ERR_SHIFT         23
109
110 #define NICVF_QS_RQ_DIS_APAD_SHIFT      22
111
112 #define NICVF_INTR_CQ_MASK              (0xFF << NICVF_INTR_CQ_SHIFT)
113 #define NICVF_INTR_SQ_MASK              (0xFF << NICVF_INTR_SQ_SHIFT)
114 #define NICVF_INTR_RBDR_MASK            (0x03 << NICVF_INTR_RBDR_SHIFT)
115 #define NICVF_INTR_PKT_DROP_MASK        (1 << NICVF_INTR_PKT_DROP_SHIFT)
116 #define NICVF_INTR_TCP_TIMER_MASK       (1 << NICVF_INTR_TCP_TIMER_SHIFT)
117 #define NICVF_INTR_MBOX_MASK            (1 << NICVF_INTR_MBOX_SHIFT)
118 #define NICVF_INTR_QS_ERR_MASK          (1 << NICVF_INTR_QS_ERR_SHIFT)
119 #define NICVF_INTR_ALL_MASK             (0x7FFFFF)
120
121 #define NICVF_CQ_WR_FULL                (1ULL << 26)
122 #define NICVF_CQ_WR_DISABLE             (1ULL << 25)
123 #define NICVF_CQ_WR_FAULT               (1ULL << 24)
124 #define NICVF_CQ_ERR_MASK               (NICVF_CQ_WR_FULL |\
125                                          NICVF_CQ_WR_DISABLE |\
126                                          NICVF_CQ_WR_FAULT)
127 #define NICVF_CQ_CQE_COUNT_MASK         (0xFFFF)
128
129 #define NICVF_SQ_ERR_STOPPED            (1ULL << 21)
130 #define NICVF_SQ_ERR_SEND               (1ULL << 20)
131 #define NICVF_SQ_ERR_DPE                (1ULL << 19)
132 #define NICVF_SQ_ERR_MASK               (NICVF_SQ_ERR_STOPPED |\
133                                          NICVF_SQ_ERR_SEND |\
134                                          NICVF_SQ_ERR_DPE)
135 #define NICVF_SQ_STATUS_STOPPED_BIT     (21)
136
137 #define NICVF_RBDR_FIFO_STATE_SHIFT     (62)
138 #define NICVF_RBDR_FIFO_STATE_MASK      (3ULL << NICVF_RBDR_FIFO_STATE_SHIFT)
139 #define NICVF_RBDR_COUNT_MASK           (0x7FFFF)
140
141 /* Queue reset */
142 #define NICVF_CQ_RESET                  (1ULL << 41)
143 #define NICVF_SQ_RESET                  (1ULL << 17)
144 #define NICVF_RBDR_RESET                (1ULL << 43)
145
146 /* RSS constants */
147 #define NIC_MAX_RSS_HASH_BITS           (8)
148 #define NIC_MAX_RSS_IDR_TBL_SIZE        (1 << NIC_MAX_RSS_HASH_BITS)
149 #define RSS_HASH_KEY_SIZE               (5) /* 320 bit key */
150 #define RSS_HASH_KEY_BYTE_SIZE          (40) /* 320 bit key */
151
152 #define RSS_L2_EXTENDED_HASH_ENA        (1 << 0)
153 #define RSS_IP_ENA                      (1 << 1)
154 #define RSS_TCP_ENA                     (1 << 2)
155 #define RSS_TCP_SYN_ENA                 (1 << 3)
156 #define RSS_UDP_ENA                     (1 << 4)
157 #define RSS_L4_EXTENDED_ENA             (1 << 5)
158 #define RSS_L3_BI_DIRECTION_ENA         (1 << 7)
159 #define RSS_L4_BI_DIRECTION_ENA         (1 << 8)
160 #define RSS_TUN_VXLAN_ENA               (1 << 9)
161 #define RSS_TUN_GENEVE_ENA              (1 << 10)
162 #define RSS_TUN_NVGRE_ENA               (1 << 11)
163
164 #define RBDR_QUEUE_SZ_8K                (8 * 1024)
165 #define RBDR_QUEUE_SZ_16K               (16 * 1024)
166 #define RBDR_QUEUE_SZ_32K               (32 * 1024)
167 #define RBDR_QUEUE_SZ_64K               (64 * 1024)
168 #define RBDR_QUEUE_SZ_128K              (128 * 1024)
169 #define RBDR_QUEUE_SZ_256K              (256 * 1024)
170 #define RBDR_QUEUE_SZ_512K              (512 * 1024)
171 #define RBDR_QUEUE_SZ_MAX               RBDR_QUEUE_SZ_512K
172
173 #define RBDR_SIZE_SHIFT                 (13) /* 8k */
174
175 #define SND_QUEUE_SZ_1K                 (1 * 1024)
176 #define SND_QUEUE_SZ_2K                 (2 * 1024)
177 #define SND_QUEUE_SZ_4K                 (4 * 1024)
178 #define SND_QUEUE_SZ_8K                 (8 * 1024)
179 #define SND_QUEUE_SZ_16K                (16 * 1024)
180 #define SND_QUEUE_SZ_32K                (32 * 1024)
181 #define SND_QUEUE_SZ_64K                (64 * 1024)
182 #define SND_QUEUE_SZ_MAX                SND_QUEUE_SZ_64K
183
184 #define SND_QSIZE_SHIFT                 (10) /* 1k */
185
186 #define CMP_QUEUE_SZ_1K                 (1 * 1024)
187 #define CMP_QUEUE_SZ_2K                 (2 * 1024)
188 #define CMP_QUEUE_SZ_4K                 (4 * 1024)
189 #define CMP_QUEUE_SZ_8K                 (8 * 1024)
190 #define CMP_QUEUE_SZ_16K                (16 * 1024)
191 #define CMP_QUEUE_SZ_32K                (32 * 1024)
192 #define CMP_QUEUE_SZ_64K                (64 * 1024)
193 #define CMP_QUEUE_SZ_MAX                CMP_QUEUE_SZ_64K
194
195 #define CMP_QSIZE_SHIFT                 (10) /* 1k */
196
197 #define NICVF_QSIZE_MIN_VAL             (0)
198 #define NICVF_QSIZE_MAX_VAL             (6)
199
200 /* Min/Max packet size */
201 #define NIC_HW_MIN_FRS                  (64)
202 #define NIC_HW_MAX_FRS                  (9200) /* 9216 max pkt including FCS */
203 #define NIC_HW_MAX_SEGS                 (12)
204
205 /* Descriptor alignments */
206 #define NICVF_RBDR_BASE_ALIGN_BYTES     (128) /* 7 bits */
207 #define NICVF_CQ_BASE_ALIGN_BYTES       (512) /* 9 bits */
208 #define NICVF_SQ_BASE_ALIGN_BYTES       (128) /* 7 bits */
209
210 #define NICVF_CQE_RBPTR_WORD            (6)
211 #define NICVF_CQE_RX2_RBPTR_WORD        (7)
212
213 #define NICVF_STATIC_ASSERT(s) _Static_assert(s, #s)
214 #define assert_primary(nic) assert((nic)->sqs_mode == 0)
215
216 typedef uint64_t nicvf_phys_addr_t;
217
218 /* vNIC HW Enumerations */
219
220 enum nic_send_ld_type_e {
221         NIC_SEND_LD_TYPE_E_LDD,
222         NIC_SEND_LD_TYPE_E_LDT,
223         NIC_SEND_LD_TYPE_E_LDWB,
224         NIC_SEND_LD_TYPE_E_ENUM_LAST,
225 };
226
227 enum ether_type_algorithm {
228         ETYPE_ALG_NONE,
229         ETYPE_ALG_SKIP,
230         ETYPE_ALG_ENDPARSE,
231         ETYPE_ALG_VLAN,
232         ETYPE_ALG_VLAN_STRIP,
233 };
234
235 enum layer3_type {
236         L3TYPE_NONE,
237         L3TYPE_GRH,
238         L3TYPE_IPV4 = 0x4,
239         L3TYPE_IPV4_OPTIONS = 0x5,
240         L3TYPE_IPV6 = 0x6,
241         L3TYPE_IPV6_OPTIONS = 0x7,
242         L3TYPE_ET_STOP = 0xD,
243         L3TYPE_OTHER = 0xE,
244 };
245
246 #define NICVF_L3TYPE_OPTIONS_MASK       ((uint8_t)1)
247 #define NICVF_L3TYPE_IPVX_MASK          ((uint8_t)0x06)
248
249 enum layer4_type {
250         L4TYPE_NONE,
251         L4TYPE_IPSEC_ESP,
252         L4TYPE_IPFRAG,
253         L4TYPE_IPCOMP,
254         L4TYPE_TCP,
255         L4TYPE_UDP,
256         L4TYPE_SCTP,
257         L4TYPE_GRE,
258         L4TYPE_ROCE_BTH,
259         L4TYPE_OTHER = 0xE,
260 };
261
262 /* CPI and RSSI configuration */
263 enum cpi_algorithm_type {
264         CPI_ALG_NONE,
265         CPI_ALG_VLAN,
266         CPI_ALG_VLAN16,
267         CPI_ALG_DIFF,
268 };
269
270 enum rss_algorithm_type {
271         RSS_ALG_NONE,
272         RSS_ALG_PORT,
273         RSS_ALG_IP,
274         RSS_ALG_TCP_IP,
275         RSS_ALG_UDP_IP,
276         RSS_ALG_SCTP_IP,
277         RSS_ALG_GRE_IP,
278         RSS_ALG_ROCE,
279 };
280
281 enum rss_hash_cfg {
282         RSS_HASH_L2ETC,
283         RSS_HASH_IP,
284         RSS_HASH_TCP,
285         RSS_HASH_TCP_SYN_DIS,
286         RSS_HASH_UDP,
287         RSS_HASH_L4ETC,
288         RSS_HASH_ROCE,
289         RSS_L3_BIDI,
290         RSS_L4_BIDI,
291 };
292
293 /* Completion queue entry types */
294 enum cqe_type {
295         CQE_TYPE_INVALID,
296         CQE_TYPE_RX = 0x2,
297         CQE_TYPE_RX_SPLIT = 0x3,
298         CQE_TYPE_RX_TCP = 0x4,
299         CQE_TYPE_SEND = 0x8,
300         CQE_TYPE_SEND_PTP = 0x9,
301 };
302
303 enum cqe_rx_tcp_status {
304         CQE_RX_STATUS_VALID_TCP_CNXT,
305         CQE_RX_STATUS_INVALID_TCP_CNXT = 0x0F,
306 };
307
308 enum cqe_send_status {
309         CQE_SEND_STATUS_GOOD,
310         CQE_SEND_STATUS_DESC_FAULT = 0x01,
311         CQE_SEND_STATUS_HDR_CONS_ERR = 0x11,
312         CQE_SEND_STATUS_SUBDESC_ERR = 0x12,
313         CQE_SEND_STATUS_IMM_SIZE_OFLOW = 0x80,
314         CQE_SEND_STATUS_CRC_SEQ_ERR = 0x81,
315         CQE_SEND_STATUS_DATA_SEQ_ERR = 0x82,
316         CQE_SEND_STATUS_MEM_SEQ_ERR = 0x83,
317         CQE_SEND_STATUS_LOCK_VIOL = 0x84,
318         CQE_SEND_STATUS_LOCK_UFLOW = 0x85,
319         CQE_SEND_STATUS_DATA_FAULT = 0x86,
320         CQE_SEND_STATUS_TSTMP_CONFLICT = 0x87,
321         CQE_SEND_STATUS_TSTMP_TIMEOUT = 0x88,
322         CQE_SEND_STATUS_MEM_FAULT = 0x89,
323         CQE_SEND_STATUS_CSUM_OVERLAP = 0x8A,
324         CQE_SEND_STATUS_CSUM_OVERFLOW = 0x8B,
325 };
326
327 enum cqe_rx_tcp_end_reason {
328         CQE_RX_TCP_END_FIN_FLAG_DET,
329         CQE_RX_TCP_END_INVALID_FLAG,
330         CQE_RX_TCP_END_TIMEOUT,
331         CQE_RX_TCP_END_OUT_OF_SEQ,
332         CQE_RX_TCP_END_PKT_ERR,
333         CQE_RX_TCP_END_QS_DISABLED = 0x0F,
334 };
335
336 /* Packet protocol level error enumeration */
337 enum cqe_rx_err_level {
338         CQE_RX_ERRLVL_RE,
339         CQE_RX_ERRLVL_L2,
340         CQE_RX_ERRLVL_L3,
341         CQE_RX_ERRLVL_L4,
342 };
343
344 /* Packet protocol level error type enumeration */
345 enum cqe_rx_err_opcode {
346         CQE_RX_ERR_RE_NONE,
347         CQE_RX_ERR_RE_PARTIAL,
348         CQE_RX_ERR_RE_JABBER,
349         CQE_RX_ERR_RE_FCS = 0x7,
350         CQE_RX_ERR_RE_TERMINATE = 0x9,
351         CQE_RX_ERR_RE_RX_CTL = 0xb,
352         CQE_RX_ERR_PREL2_ERR = 0x1f,
353         CQE_RX_ERR_L2_FRAGMENT = 0x20,
354         CQE_RX_ERR_L2_OVERRUN = 0x21,
355         CQE_RX_ERR_L2_PFCS = 0x22,
356         CQE_RX_ERR_L2_PUNY = 0x23,
357         CQE_RX_ERR_L2_MAL = 0x24,
358         CQE_RX_ERR_L2_OVERSIZE = 0x25,
359         CQE_RX_ERR_L2_UNDERSIZE = 0x26,
360         CQE_RX_ERR_L2_LENMISM = 0x27,
361         CQE_RX_ERR_L2_PCLP = 0x28,
362         CQE_RX_ERR_IP_NOT = 0x41,
363         CQE_RX_ERR_IP_CHK = 0x42,
364         CQE_RX_ERR_IP_MAL = 0x43,
365         CQE_RX_ERR_IP_MALD = 0x44,
366         CQE_RX_ERR_IP_HOP = 0x45,
367         CQE_RX_ERR_L3_ICRC = 0x46,
368         CQE_RX_ERR_L3_PCLP = 0x47,
369         CQE_RX_ERR_L4_MAL = 0x61,
370         CQE_RX_ERR_L4_CHK = 0x62,
371         CQE_RX_ERR_UDP_LEN = 0x63,
372         CQE_RX_ERR_L4_PORT = 0x64,
373         CQE_RX_ERR_TCP_FLAG = 0x65,
374         CQE_RX_ERR_TCP_OFFSET = 0x66,
375         CQE_RX_ERR_L4_PCLP = 0x67,
376         CQE_RX_ERR_RBDR_TRUNC = 0x70,
377 };
378
379 enum send_l4_csum_type {
380         SEND_L4_CSUM_DISABLE,
381         SEND_L4_CSUM_UDP,
382         SEND_L4_CSUM_TCP,
383 };
384
385 enum send_crc_alg {
386         SEND_CRCALG_CRC32,
387         SEND_CRCALG_CRC32C,
388         SEND_CRCALG_ICRC,
389 };
390
391 enum send_load_type {
392         SEND_LD_TYPE_LDD,
393         SEND_LD_TYPE_LDT,
394         SEND_LD_TYPE_LDWB,
395 };
396
397 enum send_mem_alg_type {
398         SEND_MEMALG_SET,
399         SEND_MEMALG_ADD = 0x08,
400         SEND_MEMALG_SUB = 0x09,
401         SEND_MEMALG_ADDLEN = 0x0A,
402         SEND_MEMALG_SUBLEN = 0x0B,
403 };
404
405 enum send_mem_dsz_type {
406         SEND_MEMDSZ_B64,
407         SEND_MEMDSZ_B32,
408         SEND_MEMDSZ_B8 = 0x03,
409 };
410
411 enum sq_subdesc_type {
412         SQ_DESC_TYPE_INVALID,
413         SQ_DESC_TYPE_HEADER,
414         SQ_DESC_TYPE_CRC,
415         SQ_DESC_TYPE_IMMEDIATE,
416         SQ_DESC_TYPE_GATHER,
417         SQ_DESC_TYPE_MEMORY,
418 };
419
420 enum l3_type_t {
421         L3_NONE,
422         L3_IPV4         = 0x04,
423         L3_IPV4_OPT     = 0x05,
424         L3_IPV6         = 0x06,
425         L3_IPV6_OPT     = 0x07,
426         L3_ET_STOP      = 0x0D,
427         L3_OTHER        = 0x0E
428 };
429
430 enum l4_type_t {
431         L4_NONE,
432         L4_IPSEC_ESP    = 0x01,
433         L4_IPFRAG       = 0x02,
434         L4_IPCOMP       = 0x03,
435         L4_TCP          = 0x04,
436         L4_UDP_PASS1    = 0x05,
437         L4_GRE          = 0x07,
438         L4_UDP_PASS2    = 0x08,
439         L4_UDP_GENEVE   = 0x09,
440         L4_UDP_VXLAN    = 0x0A,
441         L4_NVGRE        = 0x0C,
442         L4_OTHER        = 0x0E
443 };
444
445 enum vlan_strip {
446         NO_STRIP,
447         STRIP_FIRST_VLAN,
448         STRIP_SECOND_VLAN,
449         STRIP_RESERV,
450 };
451
452 enum rbdr_state {
453         RBDR_FIFO_STATE_INACTIVE,
454         RBDR_FIFO_STATE_ACTIVE,
455         RBDR_FIFO_STATE_RESET,
456         RBDR_FIFO_STATE_FAIL,
457 };
458
459 enum rq_cache_allocation {
460         RQ_CACHE_ALLOC_OFF,
461         RQ_CACHE_ALLOC_ALL,
462         RQ_CACHE_ALLOC_FIRST,
463         RQ_CACHE_ALLOC_TWO,
464 };
465
466 enum cq_rx_errlvl_e {
467         CQ_ERRLVL_MAC,
468         CQ_ERRLVL_L2,
469         CQ_ERRLVL_L3,
470         CQ_ERRLVL_L4,
471 };
472
473 enum cq_rx_errop_e {
474         CQ_RX_ERROP_RE_NONE,
475         CQ_RX_ERROP_RE_PARTIAL = 0x1,
476         CQ_RX_ERROP_RE_JABBER = 0x2,
477         CQ_RX_ERROP_RE_FCS = 0x7,
478         CQ_RX_ERROP_RE_TERMINATE = 0x9,
479         CQ_RX_ERROP_RE_RX_CTL = 0xb,
480         CQ_RX_ERROP_PREL2_ERR = 0x1f,
481         CQ_RX_ERROP_L2_FRAGMENT = 0x20,
482         CQ_RX_ERROP_L2_OVERRUN = 0x21,
483         CQ_RX_ERROP_L2_PFCS = 0x22,
484         CQ_RX_ERROP_L2_PUNY = 0x23,
485         CQ_RX_ERROP_L2_MAL = 0x24,
486         CQ_RX_ERROP_L2_OVERSIZE = 0x25,
487         CQ_RX_ERROP_L2_UNDERSIZE = 0x26,
488         CQ_RX_ERROP_L2_LENMISM = 0x27,
489         CQ_RX_ERROP_L2_PCLP = 0x28,
490         CQ_RX_ERROP_IP_NOT = 0x41,
491         CQ_RX_ERROP_IP_CSUM_ERR = 0x42,
492         CQ_RX_ERROP_IP_MAL = 0x43,
493         CQ_RX_ERROP_IP_MALD = 0x44,
494         CQ_RX_ERROP_IP_HOP = 0x45,
495         CQ_RX_ERROP_L3_ICRC = 0x46,
496         CQ_RX_ERROP_L3_PCLP = 0x47,
497         CQ_RX_ERROP_L4_MAL = 0x61,
498         CQ_RX_ERROP_L4_CHK = 0x62,
499         CQ_RX_ERROP_UDP_LEN = 0x63,
500         CQ_RX_ERROP_L4_PORT = 0x64,
501         CQ_RX_ERROP_TCP_FLAG = 0x65,
502         CQ_RX_ERROP_TCP_OFFSET = 0x66,
503         CQ_RX_ERROP_L4_PCLP = 0x67,
504         CQ_RX_ERROP_RBDR_TRUNC = 0x70,
505 };
506
507 enum cq_tx_errop_e {
508         CQ_TX_ERROP_GOOD,
509         CQ_TX_ERROP_DESC_FAULT = 0x10,
510         CQ_TX_ERROP_HDR_CONS_ERR = 0x11,
511         CQ_TX_ERROP_SUBDC_ERR = 0x12,
512         CQ_TX_ERROP_IMM_SIZE_OFLOW = 0x80,
513         CQ_TX_ERROP_DATA_SEQUENCE_ERR = 0x81,
514         CQ_TX_ERROP_MEM_SEQUENCE_ERR = 0x82,
515         CQ_TX_ERROP_LOCK_VIOL = 0x83,
516         CQ_TX_ERROP_DATA_FAULT = 0x84,
517         CQ_TX_ERROP_TSTMP_CONFLICT = 0x85,
518         CQ_TX_ERROP_TSTMP_TIMEOUT = 0x86,
519         CQ_TX_ERROP_MEM_FAULT = 0x87,
520         CQ_TX_ERROP_CK_OVERLAP = 0x88,
521         CQ_TX_ERROP_CK_OFLOW = 0x89,
522         CQ_TX_ERROP_ENUM_LAST = 0x8a,
523 };
524
525 enum rq_sq_stats_reg_offset {
526         RQ_SQ_STATS_OCTS,
527         RQ_SQ_STATS_PKTS,
528 };
529
530 enum nic_stat_vnic_rx_e {
531         RX_OCTS,
532         RX_UCAST,
533         RX_BCAST,
534         RX_MCAST,
535         RX_RED,
536         RX_RED_OCTS,
537         RX_ORUN,
538         RX_ORUN_OCTS,
539         RX_FCS,
540         RX_L2ERR,
541         RX_DRP_BCAST,
542         RX_DRP_MCAST,
543         RX_DRP_L3BCAST,
544         RX_DRP_L3MCAST,
545 };
546
547 enum nic_stat_vnic_tx_e {
548         TX_OCTS,
549         TX_UCAST,
550         TX_BCAST,
551         TX_MCAST,
552         TX_DROP,
553 };
554
555 /* vNIC HW Register structures */
556
557 typedef union {
558         uint64_t u64;
559         struct {
560 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
561                 uint64_t cqe_type:4;
562                 uint64_t stdn_fault:1;
563                 uint64_t rsvd0:1;
564                 uint64_t rq_qs:7;
565                 uint64_t rq_idx:3;
566                 uint64_t rsvd1:12;
567                 uint64_t rss_alg:4;
568                 uint64_t rsvd2:4;
569                 uint64_t rb_cnt:4;
570                 uint64_t vlan_found:1;
571                 uint64_t vlan_stripped:1;
572                 uint64_t vlan2_found:1;
573                 uint64_t vlan2_stripped:1;
574                 uint64_t l4_type:4;
575                 uint64_t l3_type:4;
576                 uint64_t l2_present:1;
577                 uint64_t err_level:3;
578                 uint64_t err_opcode:8;
579 #else
580                 uint64_t err_opcode:8;
581                 uint64_t err_level:3;
582                 uint64_t l2_present:1;
583                 uint64_t l3_type:4;
584                 uint64_t l4_type:4;
585                 uint64_t vlan2_stripped:1;
586                 uint64_t vlan2_found:1;
587                 uint64_t vlan_stripped:1;
588                 uint64_t vlan_found:1;
589                 uint64_t rb_cnt:4;
590                 uint64_t rsvd2:4;
591                 uint64_t rss_alg:4;
592                 uint64_t rsvd1:12;
593                 uint64_t rq_idx:3;
594                 uint64_t rq_qs:7;
595                 uint64_t rsvd0:1;
596                 uint64_t stdn_fault:1;
597                 uint64_t cqe_type:4;
598 #endif
599         };
600 } cqe_rx_word0_t;
601
602 typedef union {
603         uint64_t u64;
604         struct {
605 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
606                 uint64_t pkt_len:16;
607                 uint64_t l2_ptr:8;
608                 uint64_t l3_ptr:8;
609                 uint64_t l4_ptr:8;
610                 uint64_t cq_pkt_len:8;
611                 uint64_t align_pad:3;
612                 uint64_t rsvd3:1;
613                 uint64_t chan:12;
614 #else
615                 uint64_t chan:12;
616                 uint64_t rsvd3:1;
617                 uint64_t align_pad:3;
618                 uint64_t cq_pkt_len:8;
619                 uint64_t l4_ptr:8;
620                 uint64_t l3_ptr:8;
621                 uint64_t l2_ptr:8;
622                 uint64_t pkt_len:16;
623 #endif
624         };
625 } cqe_rx_word1_t;
626
627 typedef union {
628         uint64_t u64;
629         struct {
630 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
631                 uint64_t rss_tag:32;
632                 uint64_t vlan_tci:16;
633                 uint64_t vlan_ptr:8;
634                 uint64_t vlan2_ptr:8;
635 #else
636                 uint64_t vlan2_ptr:8;
637                 uint64_t vlan_ptr:8;
638                 uint64_t vlan_tci:16;
639                 uint64_t rss_tag:32;
640 #endif
641         };
642 } cqe_rx_word2_t;
643
644 typedef union {
645         uint64_t u64;
646         struct {
647 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
648                 uint16_t rb3_sz;
649                 uint16_t rb2_sz;
650                 uint16_t rb1_sz;
651                 uint16_t rb0_sz;
652 #else
653                 uint16_t rb0_sz;
654                 uint16_t rb1_sz;
655                 uint16_t rb2_sz;
656                 uint16_t rb3_sz;
657 #endif
658         };
659 } cqe_rx_word3_t;
660
661 typedef union {
662         uint64_t u64;
663         struct {
664 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
665                 uint16_t rb7_sz;
666                 uint16_t rb6_sz;
667                 uint16_t rb5_sz;
668                 uint16_t rb4_sz;
669 #else
670                 uint16_t rb4_sz;
671                 uint16_t rb5_sz;
672                 uint16_t rb6_sz;
673                 uint16_t rb7_sz;
674 #endif
675         };
676 } cqe_rx_word4_t;
677
678 typedef union {
679         uint64_t u64;
680         struct {
681 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
682                 uint16_t rb11_sz;
683                 uint16_t rb10_sz;
684                 uint16_t rb9_sz;
685                 uint16_t rb8_sz;
686 #else
687                 uint16_t rb8_sz;
688                 uint16_t rb9_sz;
689                 uint16_t rb10_sz;
690                 uint16_t rb11_sz;
691 #endif
692         };
693 } cqe_rx_word5_t;
694
695 typedef union {
696         uint64_t u64;
697         struct {
698 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
699                 uint64_t vlan_found:1;
700                 uint64_t vlan_stripped:1;
701                 uint64_t vlan2_found:1;
702                 uint64_t vlan2_stripped:1;
703                 uint64_t rsvd2:3;
704                 uint64_t inner_l2:1;
705                 uint64_t inner_l4type:4;
706                 uint64_t inner_l3type:4;
707                 uint64_t vlan_ptr:8;
708                 uint64_t vlan2_ptr:8;
709                 uint64_t rsvd1:8;
710                 uint64_t rsvd0:8;
711                 uint64_t inner_l3ptr:8;
712                 uint64_t inner_l4ptr:8;
713 #else
714                 uint64_t inner_l4ptr:8;
715                 uint64_t inner_l3ptr:8;
716                 uint64_t rsvd0:8;
717                 uint64_t rsvd1:8;
718                 uint64_t vlan2_ptr:8;
719                 uint64_t vlan_ptr:8;
720                 uint64_t inner_l3type:4;
721                 uint64_t inner_l4type:4;
722                 uint64_t inner_l2:1;
723                 uint64_t rsvd2:3;
724                 uint64_t vlan2_stripped:1;
725                 uint64_t vlan2_found:1;
726                 uint64_t vlan_stripped:1;
727                 uint64_t vlan_found:1;
728 #endif
729         };
730 } cqe_rx2_word6_t;
731
732 struct cqe_rx_t {
733         cqe_rx_word0_t word0;
734         cqe_rx_word1_t word1;
735         cqe_rx_word2_t word2;
736         cqe_rx_word3_t word3;
737         cqe_rx_word4_t word4;
738         cqe_rx_word5_t word5;
739         cqe_rx2_word6_t word6; /* if NIC_PF_RX_CFG[CQE_RX2_ENA] set */
740 };
741
742 struct cqe_rx_tcp_err_t {
743 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
744         uint64_t   cqe_type:4; /* W0 */
745         uint64_t   rsvd0:60;
746
747         uint64_t   rsvd1:4; /* W1 */
748         uint64_t   partial_first:1;
749         uint64_t   rsvd2:27;
750         uint64_t   rbdr_bytes:8;
751         uint64_t   rsvd3:24;
752 #else
753         uint64_t   rsvd0:60;
754         uint64_t   cqe_type:4;
755
756         uint64_t   rsvd3:24;
757         uint64_t   rbdr_bytes:8;
758         uint64_t   rsvd2:27;
759         uint64_t   partial_first:1;
760         uint64_t   rsvd1:4;
761 #endif
762 };
763
764 struct cqe_rx_tcp_t {
765 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
766         uint64_t   cqe_type:4; /* W0 */
767         uint64_t   rsvd0:52;
768         uint64_t   cq_tcp_status:8;
769
770         uint64_t   rsvd1:32; /* W1 */
771         uint64_t   tcp_cntx_bytes:8;
772         uint64_t   rsvd2:8;
773         uint64_t   tcp_err_bytes:16;
774 #else
775         uint64_t   cq_tcp_status:8;
776         uint64_t   rsvd0:52;
777         uint64_t   cqe_type:4; /* W0 */
778
779         uint64_t   tcp_err_bytes:16;
780         uint64_t   rsvd2:8;
781         uint64_t   tcp_cntx_bytes:8;
782         uint64_t   rsvd1:32; /* W1 */
783 #endif
784 };
785
786 struct cqe_send_t {
787 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
788         uint64_t   cqe_type:4; /* W0 */
789         uint64_t   rsvd0:4;
790         uint64_t   sqe_ptr:16;
791         uint64_t   rsvd1:4;
792         uint64_t   rsvd2:10;
793         uint64_t   sq_qs:7;
794         uint64_t   sq_idx:3;
795         uint64_t   rsvd3:8;
796         uint64_t   send_status:8;
797
798         uint64_t   ptp_timestamp:64; /* W1 */
799 #elif NICVF_BYTE_ORDER == NICVF_LITTLE_ENDIAN
800         uint64_t   send_status:8;
801         uint64_t   rsvd3:8;
802         uint64_t   sq_idx:3;
803         uint64_t   sq_qs:7;
804         uint64_t   rsvd2:10;
805         uint64_t   rsvd1:4;
806         uint64_t   sqe_ptr:16;
807         uint64_t   rsvd0:4;
808         uint64_t   cqe_type:4; /* W0 */
809
810         uint64_t   ptp_timestamp:64;
811 #endif
812 };
813
814 struct cq_entry_type_t {
815 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
816         uint64_t cqe_type:4;
817         uint64_t __pad:60;
818 #else
819         uint64_t __pad:60;
820         uint64_t cqe_type:4;
821 #endif
822 };
823
824 union cq_entry_t {
825         uint64_t u[64];
826         struct cq_entry_type_t type;
827         struct cqe_rx_t rx_hdr;
828         struct cqe_rx_tcp_t rx_tcp_hdr;
829         struct cqe_rx_tcp_err_t rx_tcp_err_hdr;
830         struct cqe_send_t cqe_send;
831 };
832
833 NICVF_STATIC_ASSERT(sizeof(union cq_entry_t) == 512);
834
835 struct rbdr_entry_t {
836 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
837         union {
838                 struct {
839                         uint64_t   rsvd0:15;
840                         uint64_t   buf_addr:42;
841                         uint64_t   cache_align:7;
842                 };
843                 nicvf_phys_addr_t full_addr;
844         };
845 #else
846         union {
847                 struct {
848                         uint64_t   cache_align:7;
849                         uint64_t   buf_addr:42;
850                         uint64_t   rsvd0:15;
851                 };
852                 nicvf_phys_addr_t full_addr;
853         };
854 #endif
855 };
856
857 NICVF_STATIC_ASSERT(sizeof(struct rbdr_entry_t) == sizeof(uint64_t));
858
859 /* TCP reassembly context */
860 struct rbe_tcp_cnxt_t {
861 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
862         uint64_t   tcp_pkt_cnt:12;
863         uint64_t   rsvd1:4;
864         uint64_t   align_hdr_bytes:4;
865         uint64_t   align_ptr_bytes:4;
866         uint64_t   ptr_bytes:16;
867         uint64_t   rsvd2:24;
868         uint64_t   cqe_type:4;
869         uint64_t   rsvd0:54;
870         uint64_t   tcp_end_reason:2;
871         uint64_t   tcp_status:4;
872 #else
873         uint64_t   tcp_status:4;
874         uint64_t   tcp_end_reason:2;
875         uint64_t   rsvd0:54;
876         uint64_t   cqe_type:4;
877         uint64_t   rsvd2:24;
878         uint64_t   ptr_bytes:16;
879         uint64_t   align_ptr_bytes:4;
880         uint64_t   align_hdr_bytes:4;
881         uint64_t   rsvd1:4;
882         uint64_t   tcp_pkt_cnt:12;
883 #endif
884 };
885
886 /* Always Big endian */
887 struct rx_hdr_t {
888         uint64_t   opaque:32;
889         uint64_t   rss_flow:8;
890         uint64_t   skip_length:6;
891         uint64_t   disable_rss:1;
892         uint64_t   disable_tcp_reassembly:1;
893         uint64_t   nodrop:1;
894         uint64_t   dest_alg:2;
895         uint64_t   rsvd0:2;
896         uint64_t   dest_rq:11;
897 };
898
899 struct sq_crc_subdesc {
900 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
901         uint64_t    rsvd1:32;
902         uint64_t    crc_ival:32;
903         uint64_t    subdesc_type:4;
904         uint64_t    crc_alg:2;
905         uint64_t    rsvd0:10;
906         uint64_t    crc_insert_pos:16;
907         uint64_t    hdr_start:16;
908         uint64_t    crc_len:16;
909 #else
910         uint64_t    crc_len:16;
911         uint64_t    hdr_start:16;
912         uint64_t    crc_insert_pos:16;
913         uint64_t    rsvd0:10;
914         uint64_t    crc_alg:2;
915         uint64_t    subdesc_type:4;
916         uint64_t    crc_ival:32;
917         uint64_t    rsvd1:32;
918 #endif
919 };
920
921 struct sq_gather_subdesc {
922 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
923         uint64_t    subdesc_type:4; /* W0 */
924         uint64_t    ld_type:2;
925         uint64_t    rsvd0:42;
926         uint64_t    size:16;
927
928         uint64_t    rsvd1:15; /* W1 */
929         uint64_t    addr:49;
930 #else
931         uint64_t    size:16;
932         uint64_t    rsvd0:42;
933         uint64_t    ld_type:2;
934         uint64_t    subdesc_type:4; /* W0 */
935
936         uint64_t    addr:49;
937         uint64_t    rsvd1:15; /* W1 */
938 #endif
939 };
940
941 /* SQ immediate subdescriptor */
942 struct sq_imm_subdesc {
943 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
944         uint64_t    subdesc_type:4; /* W0 */
945         uint64_t    rsvd0:46;
946         uint64_t    len:14;
947
948         uint64_t    data:64; /* W1 */
949 #else
950         uint64_t    len:14;
951         uint64_t    rsvd0:46;
952         uint64_t    subdesc_type:4; /* W0 */
953
954         uint64_t    data:64; /* W1 */
955 #endif
956 };
957
958 struct sq_mem_subdesc {
959 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
960         uint64_t    subdesc_type:4; /* W0 */
961         uint64_t    mem_alg:4;
962         uint64_t    mem_dsz:2;
963         uint64_t    wmem:1;
964         uint64_t    rsvd0:21;
965         uint64_t    offset:32;
966
967         uint64_t    rsvd1:15; /* W1 */
968         uint64_t    addr:49;
969 #else
970         uint64_t    offset:32;
971         uint64_t    rsvd0:21;
972         uint64_t    wmem:1;
973         uint64_t    mem_dsz:2;
974         uint64_t    mem_alg:4;
975         uint64_t    subdesc_type:4; /* W0 */
976
977         uint64_t    addr:49;
978         uint64_t    rsvd1:15; /* W1 */
979 #endif
980 };
981
982 struct sq_hdr_subdesc {
983 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
984         uint64_t    subdesc_type:4;
985         uint64_t    tso:1;
986         uint64_t    post_cqe:1; /* Post CQE on no error also */
987         uint64_t    dont_send:1;
988         uint64_t    tstmp:1;
989         uint64_t    subdesc_cnt:8;
990         uint64_t    csum_l4:2;
991         uint64_t    csum_l3:1;
992         uint64_t    csum_inner_l4:2;
993         uint64_t    csum_inner_l3:1;
994         uint64_t    rsvd0:2;
995         uint64_t    l4_offset:8;
996         uint64_t    l3_offset:8;
997         uint64_t    rsvd1:4;
998         uint64_t    tot_len:20; /* W0 */
999
1000         uint64_t    rsvd2:24;
1001         uint64_t    inner_l4_offset:8;
1002         uint64_t    inner_l3_offset:8;
1003         uint64_t    tso_start:8;
1004         uint64_t    rsvd3:2;
1005         uint64_t    tso_max_paysize:14; /* W1 */
1006 #else
1007         uint64_t    tot_len:20;
1008         uint64_t    rsvd1:4;
1009         uint64_t    l3_offset:8;
1010         uint64_t    l4_offset:8;
1011         uint64_t    rsvd0:2;
1012         uint64_t    csum_inner_l3:1;
1013         uint64_t    csum_inner_l4:2;
1014         uint64_t    csum_l3:1;
1015         uint64_t    csum_l4:2;
1016         uint64_t    subdesc_cnt:8;
1017         uint64_t    tstmp:1;
1018         uint64_t    dont_send:1;
1019         uint64_t    post_cqe:1; /* Post CQE on no error also */
1020         uint64_t    tso:1;
1021         uint64_t    subdesc_type:4; /* W0 */
1022
1023         uint64_t    tso_max_paysize:14;
1024         uint64_t    rsvd3:2;
1025         uint64_t    tso_start:8;
1026         uint64_t    inner_l3_offset:8;
1027         uint64_t    inner_l4_offset:8;
1028         uint64_t    rsvd2:24; /* W1 */
1029 #endif
1030 };
1031
1032 /* Each sq entry is 128 bits wide */
1033 union sq_entry_t {
1034         uint64_t buff[2];
1035         struct sq_hdr_subdesc hdr;
1036         struct sq_imm_subdesc imm;
1037         struct sq_gather_subdesc gather;
1038         struct sq_crc_subdesc crc;
1039         struct sq_mem_subdesc mem;
1040 };
1041
1042 NICVF_STATIC_ASSERT(sizeof(union sq_entry_t) == 16);
1043
1044 /* Queue config register formats */
1045 struct rq_cfg { union { struct {
1046 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1047         uint64_t reserved_2_63:62;
1048         uint64_t ena:1;
1049         uint64_t reserved_0:1;
1050 #else
1051         uint64_t reserved_0:1;
1052         uint64_t ena:1;
1053         uint64_t reserved_2_63:62;
1054 #endif
1055         };
1056         uint64_t value;
1057 }; };
1058
1059 struct cq_cfg { union { struct {
1060 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1061         uint64_t reserved_43_63:21;
1062         uint64_t ena:1;
1063         uint64_t reset:1;
1064         uint64_t caching:1;
1065         uint64_t reserved_35_39:5;
1066         uint64_t qsize:3;
1067         uint64_t reserved_25_31:7;
1068         uint64_t avg_con:9;
1069         uint64_t reserved_0_15:16;
1070 #else
1071         uint64_t reserved_0_15:16;
1072         uint64_t avg_con:9;
1073         uint64_t reserved_25_31:7;
1074         uint64_t qsize:3;
1075         uint64_t reserved_35_39:5;
1076         uint64_t caching:1;
1077         uint64_t reset:1;
1078         uint64_t ena:1;
1079         uint64_t reserved_43_63:21;
1080 #endif
1081         };
1082         uint64_t value;
1083 }; };
1084
1085 struct sq_cfg { union { struct {
1086 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1087         uint64_t reserved_32_63:32;
1088         uint64_t cq_limit:8;
1089         uint64_t ena:1;
1090         uint64_t reserved_18_18:1;
1091         uint64_t reset:1;
1092         uint64_t ldwb:1;
1093         uint64_t reserved_11_15:5;
1094         uint64_t qsize:3;
1095         uint64_t reserved_3_7:5;
1096         uint64_t tstmp_bgx_intf:3;
1097 #else
1098         uint64_t tstmp_bgx_intf:3;
1099         uint64_t reserved_3_7:5;
1100         uint64_t qsize:3;
1101         uint64_t reserved_11_15:5;
1102         uint64_t ldwb:1;
1103         uint64_t reset:1;
1104         uint64_t reserved_18_18:1;
1105         uint64_t ena:1;
1106         uint64_t cq_limit:8;
1107         uint64_t reserved_32_63:32;
1108 #endif
1109         };
1110         uint64_t value;
1111 }; };
1112
1113 struct rbdr_cfg { union { struct {
1114 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1115         uint64_t reserved_45_63:19;
1116         uint64_t ena:1;
1117         uint64_t reset:1;
1118         uint64_t ldwb:1;
1119         uint64_t reserved_36_41:6;
1120         uint64_t qsize:4;
1121         uint64_t reserved_25_31:7;
1122         uint64_t avg_con:9;
1123         uint64_t reserved_12_15:4;
1124         uint64_t lines:12;
1125 #else
1126         uint64_t lines:12;
1127         uint64_t reserved_12_15:4;
1128         uint64_t avg_con:9;
1129         uint64_t reserved_25_31:7;
1130         uint64_t qsize:4;
1131         uint64_t reserved_36_41:6;
1132         uint64_t ldwb:1;
1133         uint64_t reset:1;
1134         uint64_t ena: 1;
1135         uint64_t reserved_45_63:19;
1136 #endif
1137         };
1138         uint64_t value;
1139 }; };
1140
1141 struct pf_qs_cfg { union { struct {
1142 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1143         uint64_t reserved_32_63:32;
1144         uint64_t ena:1;
1145         uint64_t reserved_27_30:4;
1146         uint64_t sq_ins_ena:1;
1147         uint64_t sq_ins_pos:6;
1148         uint64_t lock_ena:1;
1149         uint64_t lock_viol_cqe_ena:1;
1150         uint64_t send_tstmp_ena:1;
1151         uint64_t be:1;
1152         uint64_t reserved_7_15:9;
1153         uint64_t vnic:7;
1154 #else
1155         uint64_t vnic:7;
1156         uint64_t reserved_7_15:9;
1157         uint64_t be:1;
1158         uint64_t send_tstmp_ena:1;
1159         uint64_t lock_viol_cqe_ena:1;
1160         uint64_t lock_ena:1;
1161         uint64_t sq_ins_pos:6;
1162         uint64_t sq_ins_ena:1;
1163         uint64_t reserved_27_30:4;
1164         uint64_t ena:1;
1165         uint64_t reserved_32_63:32;
1166 #endif
1167         };
1168         uint64_t value;
1169 }; };
1170
1171 struct pf_rq_cfg { union { struct {
1172 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1173         uint64_t reserved1:1;
1174         uint64_t reserved0:34;
1175         uint64_t strip_pre_l2:1;
1176         uint64_t caching:2;
1177         uint64_t cq_qs:7;
1178         uint64_t cq_idx:3;
1179         uint64_t rbdr_cont_qs:7;
1180         uint64_t rbdr_cont_idx:1;
1181         uint64_t rbdr_strt_qs:7;
1182         uint64_t rbdr_strt_idx:1;
1183 #else
1184         uint64_t rbdr_strt_idx:1;
1185         uint64_t rbdr_strt_qs:7;
1186         uint64_t rbdr_cont_idx:1;
1187         uint64_t rbdr_cont_qs:7;
1188         uint64_t cq_idx:3;
1189         uint64_t cq_qs:7;
1190         uint64_t caching:2;
1191         uint64_t strip_pre_l2:1;
1192         uint64_t reserved0:34;
1193         uint64_t reserved1:1;
1194 #endif
1195         };
1196         uint64_t value;
1197 }; };
1198
1199 struct pf_rq_drop_cfg { union { struct {
1200 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
1201         uint64_t rbdr_red:1;
1202         uint64_t cq_red:1;
1203         uint64_t reserved3:14;
1204         uint64_t rbdr_pass:8;
1205         uint64_t rbdr_drop:8;
1206         uint64_t reserved2:8;
1207         uint64_t cq_pass:8;
1208         uint64_t cq_drop:8;
1209         uint64_t reserved1:8;
1210 #else
1211         uint64_t reserved1:8;
1212         uint64_t cq_drop:8;
1213         uint64_t cq_pass:8;
1214         uint64_t reserved2:8;
1215         uint64_t rbdr_drop:8;
1216         uint64_t rbdr_pass:8;
1217         uint64_t reserved3:14;
1218         uint64_t cq_red:1;
1219         uint64_t rbdr_red:1;
1220 #endif
1221         };
1222         uint64_t value;
1223 }; };
1224
1225 #endif /* _THUNDERX_NICVF_HW_DEFS_H */