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