1 /*********************************************************
2 * Copyright (C) 2007 VMware, Inc. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
6 *********************************************************/
11 * Definitions shared by device emulation and guest drivers for
15 #ifndef _VMXNET3_DEFS_H_
16 #define _VMXNET3_DEFS_H_
18 #include "vmxnet3_osdep.h"
19 #include "upt1_defs.h"
21 /* all registers are 32 bit wide */
23 #define VMXNET3_REG_VRRS 0x0 /* Vmxnet3 Revision Report Selection */
24 #define VMXNET3_REG_UVRS 0x8 /* UPT Version Report Selection */
25 #define VMXNET3_REG_DSAL 0x10 /* Driver Shared Address Low */
26 #define VMXNET3_REG_DSAH 0x18 /* Driver Shared Address High */
27 #define VMXNET3_REG_CMD 0x20 /* Command */
28 #define VMXNET3_REG_MACL 0x28 /* MAC Address Low */
29 #define VMXNET3_REG_MACH 0x30 /* MAC Address High */
30 #define VMXNET3_REG_ICR 0x38 /* Interrupt Cause Register */
31 #define VMXNET3_REG_ECR 0x40 /* Event Cause Register */
33 #define VMXNET3_REG_WSAL 0xF00 /* Wireless Shared Address Lo */
34 #define VMXNET3_REG_WSAH 0xF08 /* Wireless Shared Address Hi */
35 #define VMXNET3_REG_WCMD 0xF18 /* Wireless Command */
38 #define VMXNET3_REG_IMR 0x0 /* Interrupt Mask Register */
39 #define VMXNET3_REG_TXPROD 0x600 /* Tx Producer Index */
40 #define VMXNET3_REG_RXPROD 0x800 /* Rx Producer Index for ring 1 */
41 #define VMXNET3_REG_RXPROD2 0xA00 /* Rx Producer Index for ring 2 */
43 #define VMXNET3_PT_REG_SIZE 4096 /* BAR 0 */
44 #define VMXNET3_VD_REG_SIZE 4096 /* BAR 1 */
47 * The two Vmxnet3 MMIO Register PCI BARs (BAR 0 at offset 10h and BAR 1 at
48 * offset 14h) as well as the MSI-X BAR are combined into one PhysMem region:
49 * <-VMXNET3_PT_REG_SIZE-><-VMXNET3_VD_REG_SIZE-><-VMXNET3_MSIX_BAR_SIZE-->
50 * -------------------------------------------------------------------------
51 * |Pass Thru Registers | Virtual Dev Registers | MSI-X Vector/PBA Table |
52 * -------------------------------------------------------------------------
53 * VMXNET3_MSIX_BAR_SIZE is defined in "vmxnet3Int.h"
55 #define VMXNET3_PHYSMEM_PAGES 4
57 #define VMXNET3_REG_ALIGN 8 /* All registers are 8-byte aligned. */
58 #define VMXNET3_REG_ALIGN_MASK 0x7
60 /* I/O Mapped access to registers */
61 #define VMXNET3_IO_TYPE_PT 0
62 #define VMXNET3_IO_TYPE_VD 1
63 #define VMXNET3_IO_ADDR(type, reg) (((type) << 24) | ((reg) & 0xFFFFFF))
64 #define VMXNET3_IO_TYPE(addr) ((addr) >> 24)
65 #define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF)
78 VMXNET3_CMD_FIRST_SET = 0xCAFE0000,
79 VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET,
80 VMXNET3_CMD_QUIESCE_DEV,
81 VMXNET3_CMD_RESET_DEV,
82 VMXNET3_CMD_UPDATE_RX_MODE,
83 VMXNET3_CMD_UPDATE_MAC_FILTERS,
84 VMXNET3_CMD_UPDATE_VLAN_FILTERS,
85 VMXNET3_CMD_UPDATE_RSSIDT,
86 VMXNET3_CMD_UPDATE_IML,
87 VMXNET3_CMD_UPDATE_PMCFG,
88 VMXNET3_CMD_UPDATE_FEATURE,
89 VMXNET3_CMD_STOP_EMULATION,
90 VMXNET3_CMD_LOAD_PLUGIN,
91 VMXNET3_CMD_ACTIVATE_VF,
92 VMXNET3_CMD_RESERVED3,
93 VMXNET3_CMD_RESERVED4,
94 VMXNET3_CMD_REGISTER_MEMREGS,
96 VMXNET3_CMD_FIRST_GET = 0xF00D0000,
97 VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
98 VMXNET3_CMD_GET_STATS,
100 VMXNET3_CMD_GET_PERM_MAC_LO,
101 VMXNET3_CMD_GET_PERM_MAC_HI,
102 VMXNET3_CMD_GET_DID_LO,
103 VMXNET3_CMD_GET_DID_HI,
104 VMXNET3_CMD_GET_DEV_EXTRA_INFO,
105 VMXNET3_CMD_GET_CONF_INTR,
106 VMXNET3_CMD_GET_ADAPTIVE_RING_INFO,
107 VMXNET3_CMD_GET_TXDATA_DESC_SIZE,
108 VMXNET3_CMD_RESERVED5,
111 /* Adaptive Ring Info Flags */
112 #define VMXNET3_DISABLE_ADAPTIVE_RING 1
115 * Little Endian layout of bitfields -
116 * Byte 0 : 7.....len.....0
117 * Byte 1 : rsvd gen 13.len.8
118 * Byte 2 : 5.msscof.0 ext1 dtype
119 * Byte 3 : 13...msscof...6
121 * Big Endian layout of bitfields -
122 * Byte 0: 13...msscof...6
123 * Byte 1 : 5.msscof.0 ext1 dtype
124 * Byte 2 : rsvd gen 13.len.8
125 * Byte 3 : 7.....len.....0
127 * Thus, le32_to_cpu on the dword will allow the big endian driver to read
128 * the bit fields correctly. And cpu_to_le32 will convert bitfields
129 * bit fields written by big endian driver to format required by device.
133 #include "vmware_pack_begin.h"
134 struct Vmxnet3_TxDesc {
137 #ifdef __BIG_ENDIAN_BITFIELD
138 uint32 msscof:14; /* MSS, checksum offset, flags */
140 uint32 dtype:1; /* descriptor type */
142 uint32 gen:1; /* generation bit */
146 uint32 gen:1; /* generation bit */
148 uint32 dtype:1; /* descriptor type */
150 uint32 msscof:14; /* MSS, checksum offset, flags */
151 #endif /* __BIG_ENDIAN_BITFIELD */
153 #ifdef __BIG_ENDIAN_BITFIELD
154 uint32 tci:16; /* Tag to Insert */
155 uint32 ti:1; /* VLAN Tag Insertion */
157 uint32 cq:1; /* completion request */
158 uint32 eop:1; /* End Of Packet */
159 uint32 om:2; /* offload mode */
160 uint32 hlen:10; /* header len */
162 uint32 hlen:10; /* header len */
163 uint32 om:2; /* offload mode */
164 uint32 eop:1; /* End Of Packet */
165 uint32 cq:1; /* completion request */
167 uint32 ti:1; /* VLAN Tag Insertion */
168 uint32 tci:16; /* Tag to Insert */
169 #endif /* __BIG_ENDIAN_BITFIELD */
171 #include "vmware_pack_end.h"
174 /* TxDesc.OM values */
175 #define VMXNET3_OM_NONE 0
176 #define VMXNET3_OM_CSUM 2
177 #define VMXNET3_OM_TSO 3
179 /* fields in TxDesc we access w/o using bit fields */
180 #define VMXNET3_TXD_EOP_SHIFT 12
181 #define VMXNET3_TXD_CQ_SHIFT 13
182 #define VMXNET3_TXD_GEN_SHIFT 14
183 #define VMXNET3_TXD_EOP_DWORD_SHIFT 3
184 #define VMXNET3_TXD_GEN_DWORD_SHIFT 2
186 #define VMXNET3_TXD_CQ (1 << VMXNET3_TXD_CQ_SHIFT)
187 #define VMXNET3_TXD_EOP (1 << VMXNET3_TXD_EOP_SHIFT)
188 #define VMXNET3_TXD_GEN (1 << VMXNET3_TXD_GEN_SHIFT)
190 #define VMXNET3_TXD_GEN_SIZE 1
191 #define VMXNET3_TXD_EOP_SIZE 1
193 #define VMXNET3_HDR_COPY_SIZE 128
196 #include "vmware_pack_begin.h"
197 struct Vmxnet3_TxDataDesc {
198 uint8 data[VMXNET3_HDR_COPY_SIZE];
200 #include "vmware_pack_end.h"
203 #define VMXNET3_TCD_GEN_SHIFT 31
204 #define VMXNET3_TCD_GEN_SIZE 1
205 #define VMXNET3_TCD_TXIDX_SHIFT 0
206 #define VMXNET3_TCD_TXIDX_SIZE 12
207 #define VMXNET3_TCD_GEN_DWORD_SHIFT 3
210 #include "vmware_pack_begin.h"
211 struct Vmxnet3_TxCompDesc {
212 uint32 txdIdx:12; /* Index of the EOP TxDesc */
219 uint32 type:7; /* completion type */
220 uint32 gen:1; /* generation bit */
222 #include "vmware_pack_end.h"
226 #include "vmware_pack_begin.h"
227 struct Vmxnet3_RxDesc {
230 #ifdef __BIG_ENDIAN_BITFIELD
231 uint32 gen:1; /* Generation bit */
233 uint32 dtype:1; /* Descriptor type */
234 uint32 btype:1; /* Buffer Type */
238 uint32 btype:1; /* Buffer Type */
239 uint32 dtype:1; /* Descriptor type */
241 uint32 gen:1; /* Generation bit */
245 #include "vmware_pack_end.h"
248 /* values of RXD.BTYPE */
249 #define VMXNET3_RXD_BTYPE_HEAD 0 /* head only */
250 #define VMXNET3_RXD_BTYPE_BODY 1 /* body only */
252 /* fields in RxDesc we access w/o using bit fields */
253 #define VMXNET3_RXD_BTYPE_SHIFT 14
254 #define VMXNET3_RXD_GEN_SHIFT 31
257 #include "vmware_pack_begin.h"
258 struct Vmxnet3_RxCompDesc {
259 #ifdef __BIG_ENDIAN_BITFIELD
261 uint32 cnc:1; /* Checksum Not Calculated */
262 uint32 rssType:4; /* RSS hash type used */
263 uint32 rqID:10; /* rx queue/ring ID */
264 uint32 sop:1; /* Start of Packet */
265 uint32 eop:1; /* End of Packet */
267 uint32 rxdIdx:12; /* Index of the RxDesc */
269 uint32 rxdIdx:12; /* Index of the RxDesc */
271 uint32 eop:1; /* End of Packet */
272 uint32 sop:1; /* Start of Packet */
273 uint32 rqID:10; /* rx queue/ring ID */
274 uint32 rssType:4; /* RSS hash type used */
275 uint32 cnc:1; /* Checksum Not Calculated */
277 #endif /* __BIG_ENDIAN_BITFIELD */
279 __le32 rssHash; /* RSS hash value */
281 #ifdef __BIG_ENDIAN_BITFIELD
282 uint32 tci:16; /* Tag stripped */
283 uint32 ts:1; /* Tag is stripped */
284 uint32 err:1; /* Error */
285 uint32 len:14; /* data length */
287 uint32 len:14; /* data length */
288 uint32 err:1; /* Error */
289 uint32 ts:1; /* Tag is stripped */
290 uint32 tci:16; /* Tag stripped */
291 #endif /* __BIG_ENDIAN_BITFIELD */
294 #ifdef __BIG_ENDIAN_BITFIELD
295 uint32 gen:1; /* generation bit */
296 uint32 type:7; /* completion type */
297 uint32 fcs:1; /* Frame CRC correct */
298 uint32 frg:1; /* IP Fragment */
299 uint32 v4:1; /* IPv4 */
300 uint32 v6:1; /* IPv6 */
301 uint32 ipc:1; /* IP Checksum Correct */
302 uint32 tcp:1; /* TCP packet */
303 uint32 udp:1; /* UDP packet */
304 uint32 tuc:1; /* TCP/UDP Checksum Correct */
308 uint32 tuc:1; /* TCP/UDP Checksum Correct */
309 uint32 udp:1; /* UDP packet */
310 uint32 tcp:1; /* TCP packet */
311 uint32 ipc:1; /* IP Checksum Correct */
312 uint32 v6:1; /* IPv6 */
313 uint32 v4:1; /* IPv4 */
314 uint32 frg:1; /* IP Fragment */
315 uint32 fcs:1; /* Frame CRC correct */
316 uint32 type:7; /* completion type */
317 uint32 gen:1; /* generation bit */
318 #endif /* __BIG_ENDIAN_BITFIELD */
320 #include "vmware_pack_end.h"
324 #include "vmware_pack_begin.h"
325 struct Vmxnet3_RxCompDescExt {
327 uint8 segCnt; /* Number of aggregated packets */
328 uint8 dupAckCnt; /* Number of duplicate Acks */
329 __le16 tsDelta; /* TCP timestamp difference */
332 #include "vmware_pack_end.h"
333 Vmxnet3_RxCompDescExt;
335 /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */
336 #define VMXNET3_RCD_TUC_SHIFT 16
337 #define VMXNET3_RCD_IPC_SHIFT 19
339 /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.qword[1] */
340 #define VMXNET3_RCD_TYPE_SHIFT 56
341 #define VMXNET3_RCD_GEN_SHIFT 63
343 /* csum OK for TCP/UDP pkts over IP */
344 #define VMXNET3_RCD_CSUM_OK (1 << VMXNET3_RCD_TUC_SHIFT | 1 << VMXNET3_RCD_IPC_SHIFT)
346 /* value of RxCompDesc.rssType */
347 #define VMXNET3_RCD_RSS_TYPE_NONE 0
348 #define VMXNET3_RCD_RSS_TYPE_IPV4 1
349 #define VMXNET3_RCD_RSS_TYPE_TCPIPV4 2
350 #define VMXNET3_RCD_RSS_TYPE_IPV6 3
351 #define VMXNET3_RCD_RSS_TYPE_TCPIPV6 4
353 /* a union for accessing all cmd/completion descriptors */
354 typedef union Vmxnet3_GenericDesc {
360 Vmxnet3_TxCompDesc tcd;
361 Vmxnet3_RxCompDesc rcd;
362 Vmxnet3_RxCompDescExt rcdExt;
363 } Vmxnet3_GenericDesc;
365 #define VMXNET3_INIT_GEN 1
367 /* Max size of a single tx buffer */
368 #define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)
370 /* # of tx desc needed for a tx buffer size */
371 #define VMXNET3_TXD_NEEDED(size) (((size) + VMXNET3_MAX_TX_BUF_SIZE - 1) / VMXNET3_MAX_TX_BUF_SIZE)
373 /* max # of tx descs for a non-tso pkt */
374 #define VMXNET3_MAX_TXD_PER_PKT 16
376 /* Max size of a single rx buffer */
377 #define VMXNET3_MAX_RX_BUF_SIZE ((1 << 14) - 1)
378 /* Minimum size of a type 0 buffer */
379 #define VMXNET3_MIN_T0_BUF_SIZE 128
380 #define VMXNET3_MAX_CSUM_OFFSET 1024
382 /* Ring base address alignment */
383 #define VMXNET3_RING_BA_ALIGN 512
384 #define VMXNET3_RING_BA_MASK (VMXNET3_RING_BA_ALIGN - 1)
386 /* Ring size must be a multiple of 32 */
387 #define VMXNET3_RING_SIZE_ALIGN 32
388 #define VMXNET3_RING_SIZE_MASK (VMXNET3_RING_SIZE_ALIGN - 1)
390 /* Tx Data Ring buffer size must be a multiple of 64 */
391 #define VMXNET3_TXDATA_DESC_SIZE_ALIGN 64
392 #define VMXNET3_TXDATA_DESC_SIZE_MASK (VMXNET3_TXDATA_DESC_SIZE_ALIGN - 1)
394 /* Rx Data Ring buffer size must be a multiple of 64 */
395 #define VMXNET3_RXDATA_DESC_SIZE_ALIGN 64
396 #define VMXNET3_RXDATA_DESC_SIZE_MASK (VMXNET3_RXDATA_DESC_SIZE_ALIGN - 1)
399 #define VMXNET3_TX_RING_MAX_SIZE 4096
400 #define VMXNET3_TC_RING_MAX_SIZE 4096
401 #define VMXNET3_RX_RING_MAX_SIZE 4096
402 #define VMXNET3_RC_RING_MAX_SIZE 8192
404 #define VMXNET3_TXDATA_DESC_MIN_SIZE 128
405 #define VMXNET3_TXDATA_DESC_MAX_SIZE 2048
407 #define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
409 /* a list of reasons for queue stop */
411 #define VMXNET3_ERR_NOEOP 0x80000000 /* cannot find the EOP desc of a pkt */
412 #define VMXNET3_ERR_TXD_REUSE 0x80000001 /* reuse a TxDesc before tx completion */
413 #define VMXNET3_ERR_BIG_PKT 0x80000002 /* too many TxDesc for a pkt */
414 #define VMXNET3_ERR_DESC_NOT_SPT 0x80000003 /* descriptor type not supported */
415 #define VMXNET3_ERR_SMALL_BUF 0x80000004 /* type 0 buffer too small */
416 #define VMXNET3_ERR_STRESS 0x80000005 /* stress option firing in vmkernel */
417 #define VMXNET3_ERR_SWITCH 0x80000006 /* mode switch failure */
418 #define VMXNET3_ERR_TXD_INVALID 0x80000007 /* invalid TxDesc */
420 /* completion descriptor types */
421 #define VMXNET3_CDTYPE_TXCOMP 0 /* Tx Completion Descriptor */
422 #define VMXNET3_CDTYPE_RXCOMP 3 /* Rx Completion Descriptor */
423 #define VMXNET3_CDTYPE_RXCOMP_LRO 4 /* Rx Completion Descriptor for LRO */
425 #define VMXNET3_GOS_BITS_UNK 0 /* unknown */
426 #define VMXNET3_GOS_BITS_32 1
427 #define VMXNET3_GOS_BITS_64 2
429 #define VMXNET3_GOS_TYPE_UNK 0 /* unknown */
430 #define VMXNET3_GOS_TYPE_LINUX 1
431 #define VMXNET3_GOS_TYPE_WIN 2
432 #define VMXNET3_GOS_TYPE_SOLARIS 3
433 #define VMXNET3_GOS_TYPE_FREEBSD 4
434 #define VMXNET3_GOS_TYPE_PXE 5
436 /* All structures in DriverShared are padded to multiples of 8 bytes */
439 #include "vmware_pack_begin.h"
440 struct Vmxnet3_GOSInfo {
441 #ifdef __BIG_ENDIAN_BITFIELD
442 uint32 gosMisc: 10; /* other info about gos */
443 uint32 gosVer: 16; /* gos version */
444 uint32 gosType: 4; /* which guest */
445 uint32 gosBits: 2; /* 32-bit or 64-bit? */
447 uint32 gosBits: 2; /* 32-bit or 64-bit? */
448 uint32 gosType: 4; /* which guest */
449 uint32 gosVer: 16; /* gos version */
450 uint32 gosMisc: 10; /* other info about gos */
451 #endif /* __BIG_ENDIAN_BITFIELD */
453 #include "vmware_pack_end.h"
457 #include "vmware_pack_begin.h"
458 struct Vmxnet3_DriverInfo {
459 __le32 version; /* driver version */
461 __le32 vmxnet3RevSpt; /* vmxnet3 revision supported */
462 __le32 uptVerSpt; /* upt version supported */
464 #include "vmware_pack_end.h"
467 #define VMXNET3_REV1_MAGIC 0xbabefee1
470 * QueueDescPA must be 128 bytes aligned. It points to an array of
471 * Vmxnet3_TxQueueDesc followed by an array of Vmxnet3_RxQueueDesc.
472 * The number of Vmxnet3_TxQueueDesc/Vmxnet3_RxQueueDesc are specified by
473 * Vmxnet3_MiscConf.numTxQueues/numRxQueues, respectively.
475 #define VMXNET3_QUEUE_DESC_ALIGN 128
478 #include "vmware_pack_begin.h"
479 struct Vmxnet3_MiscConf {
480 Vmxnet3_DriverInfo driverInfo;
482 __le64 ddPA; /* driver data PA */
483 __le64 queueDescPA; /* queue descriptor table PA */
484 __le32 ddLen; /* driver data len */
485 __le32 queueDescLen; /* queue descriptor table len, in bytes */
492 #include "vmware_pack_end.h"
496 #include "vmware_pack_begin.h"
497 struct Vmxnet3_TxQueueConf {
499 __le64 dataRingBasePA;
500 __le64 compRingBasePA;
501 __le64 ddPA; /* driver data */
503 __le32 txRingSize; /* # of tx desc */
504 __le32 dataRingSize; /* # of data desc */
505 __le32 compRingSize; /* # of comp desc */
506 __le32 ddLen; /* size of driver data */
509 __le16 txDataRingDescSize;
512 #include "vmware_pack_end.h"
516 #include "vmware_pack_begin.h"
517 struct Vmxnet3_RxQueueConf {
518 __le64 rxRingBasePA[2];
519 __le64 compRingBasePA;
520 __le64 ddPA; /* driver data */
521 __le64 rxDataRingBasePA;
522 __le32 rxRingSize[2]; /* # of rx desc */
523 __le32 compRingSize; /* # of rx comp desc */
524 __le32 ddLen; /* size of driver data */
527 __le16 rxDataRingDescSize; /* size of rx data ring buffer */
530 #include "vmware_pack_end.h"
533 enum vmxnet3_intr_mask_mode {
534 VMXNET3_IMM_AUTO = 0,
535 VMXNET3_IMM_ACTIVE = 1,
539 enum vmxnet3_intr_type {
546 #define VMXNET3_MAX_TX_QUEUES 8
547 #define VMXNET3_MAX_RX_QUEUES 16
548 /* addition 1 for events */
549 #define VMXNET3_MAX_INTRS 25
551 /* value of intrCtrl */
552 #define VMXNET3_IC_DISABLE_ALL 0x1 /* bit 0 */
555 #include "vmware_pack_begin.h"
556 struct Vmxnet3_IntrConf {
558 uint8 numIntrs; /* # of interrupts */
560 uint8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for each intr */
564 #include "vmware_pack_end.h"
567 /* one bit per VLAN ID, the size is in the units of uint32 */
568 #define VMXNET3_VFT_SIZE (4096 / (sizeof(uint32) * 8))
571 #include "vmware_pack_begin.h"
572 struct Vmxnet3_QueueStatus {
577 #include "vmware_pack_end.h"
581 #include "vmware_pack_begin.h"
582 struct Vmxnet3_TxQueueCtrl {
583 __le32 txNumDeferred;
587 #include "vmware_pack_end.h"
591 #include "vmware_pack_begin.h"
592 struct Vmxnet3_RxQueueCtrl {
597 #include "vmware_pack_end.h"
600 #define VMXNET3_RXM_UCAST 0x01 /* unicast only */
601 #define VMXNET3_RXM_MCAST 0x02 /* multicast passing the filters */
602 #define VMXNET3_RXM_BCAST 0x04 /* broadcast only */
603 #define VMXNET3_RXM_ALL_MULTI 0x08 /* all multicast */
604 #define VMXNET3_RXM_PROMISC 0x10 /* promiscuous */
607 #include "vmware_pack_begin.h"
608 struct Vmxnet3_RxFilterConf {
609 __le32 rxMode; /* VMXNET3_RXM_xxx */
610 __le16 mfTableLen; /* size of the multicast filter table */
612 __le64 mfTablePA; /* PA of the multicast filters table */
613 __le32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */
615 #include "vmware_pack_end.h"
616 Vmxnet3_RxFilterConf;
618 #define VMXNET3_PM_MAX_FILTERS 6
619 #define VMXNET3_PM_MAX_PATTERN_SIZE 128
620 #define VMXNET3_PM_MAX_MASK_SIZE (VMXNET3_PM_MAX_PATTERN_SIZE / 8)
622 #define VMXNET3_PM_WAKEUP_MAGIC 0x01 /* wake up on magic pkts */
623 #define VMXNET3_PM_WAKEUP_FILTER 0x02 /* wake up on pkts matching filters */
626 #include "vmware_pack_begin.h"
627 struct Vmxnet3_PM_PktFilter {
630 uint8 mask[VMXNET3_PM_MAX_MASK_SIZE];
631 uint8 pattern[VMXNET3_PM_MAX_PATTERN_SIZE];
634 #include "vmware_pack_end.h"
635 Vmxnet3_PM_PktFilter;
638 #include "vmware_pack_begin.h"
639 struct Vmxnet3_PMConf {
640 __le16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */
643 Vmxnet3_PM_PktFilter filters[VMXNET3_PM_MAX_FILTERS];
645 #include "vmware_pack_end.h"
649 #include "vmware_pack_begin.h"
650 struct Vmxnet3_VariableLenConfDesc {
655 #include "vmware_pack_end.h"
656 Vmxnet3_VariableLenConfDesc;
659 #include "vmware_pack_begin.h"
660 struct Vmxnet3_DSDevRead {
661 /* read-only region for device, read by dev in response to a SET cmd */
662 Vmxnet3_MiscConf misc;
663 Vmxnet3_IntrConf intrConf;
664 Vmxnet3_RxFilterConf rxFilterConf;
665 Vmxnet3_VariableLenConfDesc rssConfDesc;
666 Vmxnet3_VariableLenConfDesc pmConfDesc;
667 Vmxnet3_VariableLenConfDesc pluginConfDesc;
669 #include "vmware_pack_end.h"
673 #include "vmware_pack_begin.h"
674 struct Vmxnet3_TxQueueDesc {
675 Vmxnet3_TxQueueCtrl ctrl;
676 Vmxnet3_TxQueueConf conf;
677 /* Driver read after a GET command */
678 Vmxnet3_QueueStatus status;
680 uint8 _pad[88]; /* 128 aligned */
682 #include "vmware_pack_end.h"
686 #include "vmware_pack_begin.h"
687 struct Vmxnet3_RxQueueDesc {
688 Vmxnet3_RxQueueCtrl ctrl;
689 Vmxnet3_RxQueueConf conf;
690 /* Driver read after a GET command */
691 Vmxnet3_QueueStatus status;
693 uint8 _pad[88]; /* 128 aligned */
695 #include "vmware_pack_end.h"
699 #include "vmware_pack_begin.h"
700 struct Vmxnet3_SetPolling {
703 #include "vmware_pack_end.h"
707 #include "vmware_pack_begin.h"
708 struct Vmxnet3_MemoryRegion {
711 __le16 txQueueBits; /* bit n corresponding to tx queue n */
712 __le16 rxQueueBits; /* bit n corresponding to rx queue n */
714 #include "vmware_pack_end.h"
715 Vmxnet3_MemoryRegion;
717 #define MAX_MEMORY_REGION_PER_QUEUE 16
718 #define MAX_MEMORY_REGION_PER_DEVICE 256
721 #include "vmware_pack_begin.h"
722 struct Vmxnet3_MemRegs {
725 Vmxnet3_MemoryRegion memRegs[1];
727 #include "vmware_pack_end.h"
731 * If the command data <= 16 bytes, use the shared memory direcly.
732 * Otherwise, use the variable length configuration descriptor.
735 #include "vmware_pack_begin.h"
736 union Vmxnet3_CmdInfo {
737 Vmxnet3_VariableLenConfDesc varConf;
738 Vmxnet3_SetPolling setPolling;
741 #include "vmware_pack_end.h"
745 #include "vmware_pack_begin.h"
746 struct Vmxnet3_DriverShared {
748 __le32 pad; /* make devRead start at 64-bit boundaries */
749 Vmxnet3_DSDevRead devRead;
755 Vmxnet3_CmdInfo cmdInfo; /* only valid in the context of executing the
760 #include "vmware_pack_end.h"
761 Vmxnet3_DriverShared;
763 #define VMXNET3_ECR_RQERR (1 << 0)
764 #define VMXNET3_ECR_TQERR (1 << 1)
765 #define VMXNET3_ECR_LINK (1 << 2)
766 #define VMXNET3_ECR_DIC (1 << 3)
767 #define VMXNET3_ECR_DEBUG (1 << 4)
769 /* flip the gen bit of a ring */
770 #define VMXNET3_FLIP_RING_GEN(gen) ((gen) = (gen) ^ 0x1)
772 /* only use this if moving the idx won't affect the gen bit */
773 #define VMXNET3_INC_RING_IDX_ONLY(idx, ring_size) \
776 if (UNLIKELY((idx) == (ring_size))) {\
781 #define VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid) \
782 vfTable[vid >> 5] |= (1 << (vid & 31))
783 #define VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid) \
784 vfTable[vid >> 5] &= ~(1 << (vid & 31))
786 #define VMXNET3_VFTABLE_ENTRY_IS_SET(vfTable, vid) \
787 ((vfTable[vid >> 5] & (1 << (vid & 31))) != 0)
789 #define VMXNET3_MAX_MTU 9000
790 #define VMXNET3_MIN_MTU 60
792 #define VMXNET3_LINK_UP (10000 << 16 | 1) // 10 Gbps, up
793 #define VMXNET3_LINK_DOWN 0
795 #define VMXWIFI_DRIVER_SHARED_LEN 8192
797 #define VMXNET3_DID_PASSTHRU 0xFFFF
799 #endif /* _VMXNET3_DEFS_H_ */