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