1 /*********************************************************
2 * Copyright (C) 2007 VMware, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 *********************************************************/
31 * Definitions shared by device emulation and guest drivers for
35 #ifndef _VMXNET3_DEFS_H_
36 #define _VMXNET3_DEFS_H_
38 #include "vmxnet3_osdep.h"
39 #include "upt1_defs.h"
41 /* all registers are 32 bit wide */
43 #define VMXNET3_REG_VRRS 0x0 /* Vmxnet3 Revision Report Selection */
44 #define VMXNET3_REG_UVRS 0x8 /* UPT Version Report Selection */
45 #define VMXNET3_REG_DSAL 0x10 /* Driver Shared Address Low */
46 #define VMXNET3_REG_DSAH 0x18 /* Driver Shared Address High */
47 #define VMXNET3_REG_CMD 0x20 /* Command */
48 #define VMXNET3_REG_MACL 0x28 /* MAC Address Low */
49 #define VMXNET3_REG_MACH 0x30 /* MAC Address High */
50 #define VMXNET3_REG_ICR 0x38 /* Interrupt Cause Register */
51 #define VMXNET3_REG_ECR 0x40 /* Event Cause Register */
53 #define VMXNET3_REG_WSAL 0xF00 /* Wireless Shared Address Lo */
54 #define VMXNET3_REG_WSAH 0xF08 /* Wireless Shared Address Hi */
55 #define VMXNET3_REG_WCMD 0xF18 /* Wireless Command */
58 #define VMXNET3_REG_IMR 0x0 /* Interrupt Mask Register */
59 #define VMXNET3_REG_TXPROD 0x600 /* Tx Producer Index */
60 #define VMXNET3_REG_RXPROD 0x800 /* Rx Producer Index for ring 1 */
61 #define VMXNET3_REG_RXPROD2 0xA00 /* Rx Producer Index for ring 2 */
63 #define VMXNET3_PT_REG_SIZE 4096 /* BAR 0 */
64 #define VMXNET3_VD_REG_SIZE 4096 /* BAR 1 */
67 * The two Vmxnet3 MMIO Register PCI BARs (BAR 0 at offset 10h and BAR 1 at
68 * offset 14h) as well as the MSI-X BAR are combined into one PhysMem region:
69 * <-VMXNET3_PT_REG_SIZE-><-VMXNET3_VD_REG_SIZE-><-VMXNET3_MSIX_BAR_SIZE-->
70 * -------------------------------------------------------------------------
71 * |Pass Thru Registers | Virtual Dev Registers | MSI-X Vector/PBA Table |
72 * -------------------------------------------------------------------------
73 * VMXNET3_MSIX_BAR_SIZE is defined in "vmxnet3Int.h"
75 #define VMXNET3_PHYSMEM_PAGES 4
77 #define VMXNET3_REG_ALIGN 8 /* All registers are 8-byte aligned. */
78 #define VMXNET3_REG_ALIGN_MASK 0x7
80 /* I/O Mapped access to registers */
81 #define VMXNET3_IO_TYPE_PT 0
82 #define VMXNET3_IO_TYPE_VD 1
83 #define VMXNET3_IO_ADDR(type, reg) (((type) << 24) | ((reg) & 0xFFFFFF))
84 #define VMXNET3_IO_TYPE(addr) ((addr) >> 24)
85 #define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF)
98 VMXNET3_CMD_FIRST_SET = 0xCAFE0000,
99 VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET,
100 VMXNET3_CMD_QUIESCE_DEV,
101 VMXNET3_CMD_RESET_DEV,
102 VMXNET3_CMD_UPDATE_RX_MODE,
103 VMXNET3_CMD_UPDATE_MAC_FILTERS,
104 VMXNET3_CMD_UPDATE_VLAN_FILTERS,
105 VMXNET3_CMD_UPDATE_RSSIDT,
106 VMXNET3_CMD_UPDATE_IML,
107 VMXNET3_CMD_UPDATE_PMCFG,
108 VMXNET3_CMD_UPDATE_FEATURE,
109 VMXNET3_CMD_STOP_EMULATION,
110 VMXNET3_CMD_LOAD_PLUGIN,
111 VMXNET3_CMD_ACTIVATE_VF,
112 VMXNET3_CMD_RESERVED3,
114 VMXNET3_CMD_FIRST_GET = 0xF00D0000,
115 VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
116 VMXNET3_CMD_GET_STATS,
117 VMXNET3_CMD_GET_LINK,
118 VMXNET3_CMD_GET_PERM_MAC_LO,
119 VMXNET3_CMD_GET_PERM_MAC_HI,
120 VMXNET3_CMD_GET_DID_LO,
121 VMXNET3_CMD_GET_DID_HI,
122 VMXNET3_CMD_GET_DEV_EXTRA_INFO,
123 VMXNET3_CMD_GET_CONF_INTR,
124 VMXNET3_CMD_GET_ADAPTIVE_RING_INFO,
125 VMXNET3_CMD_GET_TXDATA_DESC_SIZE
128 /* Adaptive Ring Info Flags */
129 #define VMXNET3_DISABLE_ADAPTIVE_RING 1
132 * Little Endian layout of bitfields -
133 * Byte 0 : 7.....len.....0
134 * Byte 1 : rsvd gen 13.len.8
135 * Byte 2 : 5.msscof.0 ext1 dtype
136 * Byte 3 : 13...msscof...6
138 * Big Endian layout of bitfields -
139 * Byte 0: 13...msscof...6
140 * Byte 1 : 5.msscof.0 ext1 dtype
141 * Byte 2 : rsvd gen 13.len.8
142 * Byte 3 : 7.....len.....0
144 * Thus, le32_to_cpu on the dword will allow the big endian driver to read
145 * the bit fields correctly. And cpu_to_le32 will convert bitfields
146 * bit fields written by big endian driver to format required by device.
150 #include "vmware_pack_begin.h"
151 struct Vmxnet3_TxDesc {
154 #ifdef __BIG_ENDIAN_BITFIELD
155 uint32 msscof:14; /* MSS, checksum offset, flags */
157 uint32 dtype:1; /* descriptor type */
159 uint32 gen:1; /* generation bit */
163 uint32 gen:1; /* generation bit */
165 uint32 dtype:1; /* descriptor type */
167 uint32 msscof:14; /* MSS, checksum offset, flags */
168 #endif /* __BIG_ENDIAN_BITFIELD */
170 #ifdef __BIG_ENDIAN_BITFIELD
171 uint32 tci:16; /* Tag to Insert */
172 uint32 ti:1; /* VLAN Tag Insertion */
174 uint32 cq:1; /* completion request */
175 uint32 eop:1; /* End Of Packet */
176 uint32 om:2; /* offload mode */
177 uint32 hlen:10; /* header len */
179 uint32 hlen:10; /* header len */
180 uint32 om:2; /* offload mode */
181 uint32 eop:1; /* End Of Packet */
182 uint32 cq:1; /* completion request */
184 uint32 ti:1; /* VLAN Tag Insertion */
185 uint32 tci:16; /* Tag to Insert */
186 #endif /* __BIG_ENDIAN_BITFIELD */
188 #include "vmware_pack_end.h"
191 /* TxDesc.OM values */
192 #define VMXNET3_OM_NONE 0
193 #define VMXNET3_OM_CSUM 2
194 #define VMXNET3_OM_TSO 3
196 /* fields in TxDesc we access w/o using bit fields */
197 #define VMXNET3_TXD_EOP_SHIFT 12
198 #define VMXNET3_TXD_CQ_SHIFT 13
199 #define VMXNET3_TXD_GEN_SHIFT 14
200 #define VMXNET3_TXD_EOP_DWORD_SHIFT 3
201 #define VMXNET3_TXD_GEN_DWORD_SHIFT 2
203 #define VMXNET3_TXD_CQ (1 << VMXNET3_TXD_CQ_SHIFT)
204 #define VMXNET3_TXD_EOP (1 << VMXNET3_TXD_EOP_SHIFT)
205 #define VMXNET3_TXD_GEN (1 << VMXNET3_TXD_GEN_SHIFT)
207 #define VMXNET3_TXD_GEN_SIZE 1
208 #define VMXNET3_TXD_EOP_SIZE 1
210 #define VMXNET3_HDR_COPY_SIZE 128
213 #include "vmware_pack_begin.h"
214 struct Vmxnet3_TxDataDesc {
215 uint8 data[VMXNET3_HDR_COPY_SIZE];
217 #include "vmware_pack_end.h"
220 #define VMXNET3_TCD_GEN_SHIFT 31
221 #define VMXNET3_TCD_GEN_SIZE 1
222 #define VMXNET3_TCD_TXIDX_SHIFT 0
223 #define VMXNET3_TCD_TXIDX_SIZE 12
224 #define VMXNET3_TCD_GEN_DWORD_SHIFT 3
227 #include "vmware_pack_begin.h"
228 struct Vmxnet3_TxCompDesc {
229 uint32 txdIdx:12; /* Index of the EOP TxDesc */
236 uint32 type:7; /* completion type */
237 uint32 gen:1; /* generation bit */
239 #include "vmware_pack_end.h"
243 #include "vmware_pack_begin.h"
244 struct Vmxnet3_RxDesc {
247 #ifdef __BIG_ENDIAN_BITFIELD
248 uint32 gen:1; /* Generation bit */
250 uint32 dtype:1; /* Descriptor type */
251 uint32 btype:1; /* Buffer Type */
255 uint32 btype:1; /* Buffer Type */
256 uint32 dtype:1; /* Descriptor type */
258 uint32 gen:1; /* Generation bit */
262 #include "vmware_pack_end.h"
265 /* values of RXD.BTYPE */
266 #define VMXNET3_RXD_BTYPE_HEAD 0 /* head only */
267 #define VMXNET3_RXD_BTYPE_BODY 1 /* body only */
269 /* fields in RxDesc we access w/o using bit fields */
270 #define VMXNET3_RXD_BTYPE_SHIFT 14
271 #define VMXNET3_RXD_GEN_SHIFT 31
274 #include "vmware_pack_begin.h"
275 struct Vmxnet3_RxCompDesc {
276 #ifdef __BIG_ENDIAN_BITFIELD
278 uint32 cnc:1; /* Checksum Not Calculated */
279 uint32 rssType:4; /* RSS hash type used */
280 uint32 rqID:10; /* rx queue/ring ID */
281 uint32 sop:1; /* Start of Packet */
282 uint32 eop:1; /* End of Packet */
284 uint32 rxdIdx:12; /* Index of the RxDesc */
286 uint32 rxdIdx:12; /* Index of the RxDesc */
288 uint32 eop:1; /* End of Packet */
289 uint32 sop:1; /* Start of Packet */
290 uint32 rqID:10; /* rx queue/ring ID */
291 uint32 rssType:4; /* RSS hash type used */
292 uint32 cnc:1; /* Checksum Not Calculated */
294 #endif /* __BIG_ENDIAN_BITFIELD */
296 __le32 rssHash; /* RSS hash value */
298 #ifdef __BIG_ENDIAN_BITFIELD
299 uint32 tci:16; /* Tag stripped */
300 uint32 ts:1; /* Tag is stripped */
301 uint32 err:1; /* Error */
302 uint32 len:14; /* data length */
304 uint32 len:14; /* data length */
305 uint32 err:1; /* Error */
306 uint32 ts:1; /* Tag is stripped */
307 uint32 tci:16; /* Tag stripped */
308 #endif /* __BIG_ENDIAN_BITFIELD */
311 #ifdef __BIG_ENDIAN_BITFIELD
312 uint32 gen:1; /* generation bit */
313 uint32 type:7; /* completion type */
314 uint32 fcs:1; /* Frame CRC correct */
315 uint32 frg:1; /* IP Fragment */
316 uint32 v4:1; /* IPv4 */
317 uint32 v6:1; /* IPv6 */
318 uint32 ipc:1; /* IP Checksum Correct */
319 uint32 tcp:1; /* TCP packet */
320 uint32 udp:1; /* UDP packet */
321 uint32 tuc:1; /* TCP/UDP Checksum Correct */
325 uint32 tuc:1; /* TCP/UDP Checksum Correct */
326 uint32 udp:1; /* UDP packet */
327 uint32 tcp:1; /* TCP packet */
328 uint32 ipc:1; /* IP Checksum Correct */
329 uint32 v6:1; /* IPv6 */
330 uint32 v4:1; /* IPv4 */
331 uint32 frg:1; /* IP Fragment */
332 uint32 fcs:1; /* Frame CRC correct */
333 uint32 type:7; /* completion type */
334 uint32 gen:1; /* generation bit */
335 #endif /* __BIG_ENDIAN_BITFIELD */
337 #include "vmware_pack_end.h"
341 #include "vmware_pack_begin.h"
342 struct Vmxnet3_RxCompDescExt {
344 uint8 segCnt; /* Number of aggregated packets */
345 uint8 dupAckCnt; /* Number of duplicate Acks */
346 __le16 tsDelta; /* TCP timestamp difference */
349 #include "vmware_pack_end.h"
350 Vmxnet3_RxCompDescExt;
352 /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */
353 #define VMXNET3_RCD_TUC_SHIFT 16
354 #define VMXNET3_RCD_IPC_SHIFT 19
356 /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.qword[1] */
357 #define VMXNET3_RCD_TYPE_SHIFT 56
358 #define VMXNET3_RCD_GEN_SHIFT 63
360 /* csum OK for TCP/UDP pkts over IP */
361 #define VMXNET3_RCD_CSUM_OK (1 << VMXNET3_RCD_TUC_SHIFT | 1 << VMXNET3_RCD_IPC_SHIFT)
363 /* value of RxCompDesc.rssType */
364 #define VMXNET3_RCD_RSS_TYPE_NONE 0
365 #define VMXNET3_RCD_RSS_TYPE_IPV4 1
366 #define VMXNET3_RCD_RSS_TYPE_TCPIPV4 2
367 #define VMXNET3_RCD_RSS_TYPE_IPV6 3
368 #define VMXNET3_RCD_RSS_TYPE_TCPIPV6 4
370 /* a union for accessing all cmd/completion descriptors */
371 typedef union Vmxnet3_GenericDesc {
377 Vmxnet3_TxCompDesc tcd;
378 Vmxnet3_RxCompDesc rcd;
379 Vmxnet3_RxCompDescExt rcdExt;
380 } Vmxnet3_GenericDesc;
382 #define VMXNET3_INIT_GEN 1
384 /* Max size of a single tx buffer */
385 #define VMXNET3_MAX_TX_BUF_SIZE (1 << 14)
387 /* # of tx desc needed for a tx buffer size */
388 #define VMXNET3_TXD_NEEDED(size) (((size) + VMXNET3_MAX_TX_BUF_SIZE - 1) / VMXNET3_MAX_TX_BUF_SIZE)
390 /* max # of tx descs for a non-tso pkt */
391 #define VMXNET3_MAX_TXD_PER_PKT 16
393 /* Max size of a single rx buffer */
394 #define VMXNET3_MAX_RX_BUF_SIZE ((1 << 14) - 1)
395 /* Minimum size of a type 0 buffer */
396 #define VMXNET3_MIN_T0_BUF_SIZE 128
397 #define VMXNET3_MAX_CSUM_OFFSET 1024
399 /* Ring base address alignment */
400 #define VMXNET3_RING_BA_ALIGN 512
401 #define VMXNET3_RING_BA_MASK (VMXNET3_RING_BA_ALIGN - 1)
403 /* Ring size must be a multiple of 32 */
404 #define VMXNET3_RING_SIZE_ALIGN 32
405 #define VMXNET3_RING_SIZE_MASK (VMXNET3_RING_SIZE_ALIGN - 1)
407 /* Tx Data Ring buffer size must be a multiple of 64 */
408 #define VMXNET3_TXDATA_DESC_SIZE_ALIGN 64
409 #define VMXNET3_TXDATA_DESC_SIZE_MASK (VMXNET3_TXDATA_DESC_SIZE_ALIGN - 1)
412 #define VMXNET3_TX_RING_MAX_SIZE 4096
413 #define VMXNET3_TC_RING_MAX_SIZE 4096
414 #define VMXNET3_RX_RING_MAX_SIZE 4096
415 #define VMXNET3_RC_RING_MAX_SIZE 8192
417 #define VMXNET3_TXDATA_DESC_MIN_SIZE 128
418 #define VMXNET3_TXDATA_DESC_MAX_SIZE 2048
420 /* a list of reasons for queue stop */
422 #define VMXNET3_ERR_NOEOP 0x80000000 /* cannot find the EOP desc of a pkt */
423 #define VMXNET3_ERR_TXD_REUSE 0x80000001 /* reuse a TxDesc before tx completion */
424 #define VMXNET3_ERR_BIG_PKT 0x80000002 /* too many TxDesc for a pkt */
425 #define VMXNET3_ERR_DESC_NOT_SPT 0x80000003 /* descriptor type not supported */
426 #define VMXNET3_ERR_SMALL_BUF 0x80000004 /* type 0 buffer too small */
427 #define VMXNET3_ERR_STRESS 0x80000005 /* stress option firing in vmkernel */
428 #define VMXNET3_ERR_SWITCH 0x80000006 /* mode switch failure */
429 #define VMXNET3_ERR_TXD_INVALID 0x80000007 /* invalid TxDesc */
431 /* completion descriptor types */
432 #define VMXNET3_CDTYPE_TXCOMP 0 /* Tx Completion Descriptor */
433 #define VMXNET3_CDTYPE_RXCOMP 3 /* Rx Completion Descriptor */
434 #define VMXNET3_CDTYPE_RXCOMP_LRO 4 /* Rx Completion Descriptor for LRO */
436 #define VMXNET3_GOS_BITS_UNK 0 /* unknown */
437 #define VMXNET3_GOS_BITS_32 1
438 #define VMXNET3_GOS_BITS_64 2
440 #define VMXNET3_GOS_TYPE_UNK 0 /* unknown */
441 #define VMXNET3_GOS_TYPE_LINUX 1
442 #define VMXNET3_GOS_TYPE_WIN 2
443 #define VMXNET3_GOS_TYPE_SOLARIS 3
444 #define VMXNET3_GOS_TYPE_FREEBSD 4
445 #define VMXNET3_GOS_TYPE_PXE 5
447 /* All structures in DriverShared are padded to multiples of 8 bytes */
450 #include "vmware_pack_begin.h"
451 struct Vmxnet3_GOSInfo {
452 #ifdef __BIG_ENDIAN_BITFIELD
453 uint32 gosMisc: 10; /* other info about gos */
454 uint32 gosVer: 16; /* gos version */
455 uint32 gosType: 4; /* which guest */
456 uint32 gosBits: 2; /* 32-bit or 64-bit? */
458 uint32 gosBits: 2; /* 32-bit or 64-bit? */
459 uint32 gosType: 4; /* which guest */
460 uint32 gosVer: 16; /* gos version */
461 uint32 gosMisc: 10; /* other info about gos */
462 #endif /* __BIG_ENDIAN_BITFIELD */
464 #include "vmware_pack_end.h"
468 #include "vmware_pack_begin.h"
469 struct Vmxnet3_DriverInfo {
470 __le32 version; /* driver version */
472 __le32 vmxnet3RevSpt; /* vmxnet3 revision supported */
473 __le32 uptVerSpt; /* upt version supported */
475 #include "vmware_pack_end.h"
478 #define VMXNET3_REV1_MAGIC 0xbabefee1
481 * QueueDescPA must be 128 bytes aligned. It points to an array of
482 * Vmxnet3_TxQueueDesc followed by an array of Vmxnet3_RxQueueDesc.
483 * The number of Vmxnet3_TxQueueDesc/Vmxnet3_RxQueueDesc are specified by
484 * Vmxnet3_MiscConf.numTxQueues/numRxQueues, respectively.
486 #define VMXNET3_QUEUE_DESC_ALIGN 128
489 #include "vmware_pack_begin.h"
490 struct Vmxnet3_MiscConf {
491 Vmxnet3_DriverInfo driverInfo;
493 __le64 ddPA; /* driver data PA */
494 __le64 queueDescPA; /* queue descriptor table PA */
495 __le32 ddLen; /* driver data len */
496 __le32 queueDescLen; /* queue descriptor table len, in bytes */
503 #include "vmware_pack_end.h"
507 #include "vmware_pack_begin.h"
508 struct Vmxnet3_TxQueueConf {
510 __le64 dataRingBasePA;
511 __le64 compRingBasePA;
512 __le64 ddPA; /* driver data */
514 __le32 txRingSize; /* # of tx desc */
515 __le32 dataRingSize; /* # of data desc */
516 __le32 compRingSize; /* # of comp desc */
517 __le32 ddLen; /* size of driver data */
520 __le16 txDataRingDescSize;
523 #include "vmware_pack_end.h"
527 #include "vmware_pack_begin.h"
528 struct Vmxnet3_RxQueueConf {
529 __le64 rxRingBasePA[2];
530 __le64 compRingBasePA;
531 __le64 ddPA; /* driver data */
533 __le32 rxRingSize[2]; /* # of rx desc */
534 __le32 compRingSize; /* # of rx comp desc */
535 __le32 ddLen; /* size of driver data */
539 #include "vmware_pack_end.h"
542 enum vmxnet3_intr_mask_mode {
543 VMXNET3_IMM_AUTO = 0,
544 VMXNET3_IMM_ACTIVE = 1,
548 enum vmxnet3_intr_type {
555 #define VMXNET3_MAX_TX_QUEUES 8
556 #define VMXNET3_MAX_RX_QUEUES 16
557 /* addition 1 for events */
558 #define VMXNET3_MAX_INTRS 25
560 /* value of intrCtrl */
561 #define VMXNET3_IC_DISABLE_ALL 0x1 /* bit 0 */
564 #include "vmware_pack_begin.h"
565 struct Vmxnet3_IntrConf {
567 uint8 numIntrs; /* # of interrupts */
569 uint8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for each intr */
573 #include "vmware_pack_end.h"
576 /* one bit per VLAN ID, the size is in the units of uint32 */
577 #define VMXNET3_VFT_SIZE (4096 / (sizeof(uint32) * 8))
580 #include "vmware_pack_begin.h"
581 struct Vmxnet3_QueueStatus {
586 #include "vmware_pack_end.h"
590 #include "vmware_pack_begin.h"
591 struct Vmxnet3_TxQueueCtrl {
592 __le32 txNumDeferred;
596 #include "vmware_pack_end.h"
600 #include "vmware_pack_begin.h"
601 struct Vmxnet3_RxQueueCtrl {
606 #include "vmware_pack_end.h"
609 #define VMXNET3_RXM_UCAST 0x01 /* unicast only */
610 #define VMXNET3_RXM_MCAST 0x02 /* multicast passing the filters */
611 #define VMXNET3_RXM_BCAST 0x04 /* broadcast only */
612 #define VMXNET3_RXM_ALL_MULTI 0x08 /* all multicast */
613 #define VMXNET3_RXM_PROMISC 0x10 /* promiscuous */
616 #include "vmware_pack_begin.h"
617 struct Vmxnet3_RxFilterConf {
618 __le32 rxMode; /* VMXNET3_RXM_xxx */
619 __le16 mfTableLen; /* size of the multicast filter table */
621 __le64 mfTablePA; /* PA of the multicast filters table */
622 __le32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */
624 #include "vmware_pack_end.h"
625 Vmxnet3_RxFilterConf;
627 #define VMXNET3_PM_MAX_FILTERS 6
628 #define VMXNET3_PM_MAX_PATTERN_SIZE 128
629 #define VMXNET3_PM_MAX_MASK_SIZE (VMXNET3_PM_MAX_PATTERN_SIZE / 8)
631 #define VMXNET3_PM_WAKEUP_MAGIC 0x01 /* wake up on magic pkts */
632 #define VMXNET3_PM_WAKEUP_FILTER 0x02 /* wake up on pkts matching filters */
635 #include "vmware_pack_begin.h"
636 struct Vmxnet3_PM_PktFilter {
639 uint8 mask[VMXNET3_PM_MAX_MASK_SIZE];
640 uint8 pattern[VMXNET3_PM_MAX_PATTERN_SIZE];
643 #include "vmware_pack_end.h"
644 Vmxnet3_PM_PktFilter;
647 #include "vmware_pack_begin.h"
648 struct Vmxnet3_PMConf {
649 __le16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */
652 Vmxnet3_PM_PktFilter filters[VMXNET3_PM_MAX_FILTERS];
654 #include "vmware_pack_end.h"
658 #include "vmware_pack_begin.h"
659 struct Vmxnet3_VariableLenConfDesc {
664 #include "vmware_pack_end.h"
665 Vmxnet3_VariableLenConfDesc;
668 #include "vmware_pack_begin.h"
669 struct Vmxnet3_DSDevRead {
670 /* read-only region for device, read by dev in response to a SET cmd */
671 Vmxnet3_MiscConf misc;
672 Vmxnet3_IntrConf intrConf;
673 Vmxnet3_RxFilterConf rxFilterConf;
674 Vmxnet3_VariableLenConfDesc rssConfDesc;
675 Vmxnet3_VariableLenConfDesc pmConfDesc;
676 Vmxnet3_VariableLenConfDesc pluginConfDesc;
678 #include "vmware_pack_end.h"
682 #include "vmware_pack_begin.h"
683 struct Vmxnet3_TxQueueDesc {
684 Vmxnet3_TxQueueCtrl ctrl;
685 Vmxnet3_TxQueueConf conf;
686 /* Driver read after a GET command */
687 Vmxnet3_QueueStatus status;
689 uint8 _pad[88]; /* 128 aligned */
691 #include "vmware_pack_end.h"
695 #include "vmware_pack_begin.h"
696 struct Vmxnet3_RxQueueDesc {
697 Vmxnet3_RxQueueCtrl ctrl;
698 Vmxnet3_RxQueueConf conf;
699 /* Driver read after a GET command */
700 Vmxnet3_QueueStatus status;
702 uint8 _pad[88]; /* 128 aligned */
704 #include "vmware_pack_end.h"
708 #include "vmware_pack_begin.h"
709 struct Vmxnet3_SetPolling {
712 #include "vmware_pack_end.h"
716 * If the command data <= 16 bytes, use the shared memory direcly.
717 * Otherwise, use the variable length configuration descriptor.
720 #include "vmware_pack_begin.h"
721 union Vmxnet3_CmdInfo {
722 Vmxnet3_VariableLenConfDesc varConf;
723 Vmxnet3_SetPolling setPolling;
726 #include "vmware_pack_end.h"
730 #include "vmware_pack_begin.h"
731 struct Vmxnet3_DriverShared {
733 __le32 pad; /* make devRead start at 64-bit boundaries */
734 Vmxnet3_DSDevRead devRead;
740 Vmxnet3_CmdInfo cmdInfo; /* only valid in the context of executing the
745 #include "vmware_pack_end.h"
746 Vmxnet3_DriverShared;
748 #define VMXNET3_ECR_RQERR (1 << 0)
749 #define VMXNET3_ECR_TQERR (1 << 1)
750 #define VMXNET3_ECR_LINK (1 << 2)
751 #define VMXNET3_ECR_DIC (1 << 3)
752 #define VMXNET3_ECR_DEBUG (1 << 4)
754 /* flip the gen bit of a ring */
755 #define VMXNET3_FLIP_RING_GEN(gen) ((gen) = (gen) ^ 0x1)
757 /* only use this if moving the idx won't affect the gen bit */
758 #define VMXNET3_INC_RING_IDX_ONLY(idx, ring_size) \
761 if (UNLIKELY((idx) == (ring_size))) {\
766 #define VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid) \
767 vfTable[vid >> 5] |= (1 << (vid & 31))
768 #define VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid) \
769 vfTable[vid >> 5] &= ~(1 << (vid & 31))
771 #define VMXNET3_VFTABLE_ENTRY_IS_SET(vfTable, vid) \
772 ((vfTable[vid >> 5] & (1 << (vid & 31))) != 0)
774 #define VMXNET3_MAX_MTU 9000
775 #define VMXNET3_MIN_MTU 60
777 #define VMXNET3_LINK_UP (10000 << 16 | 1) // 10 Gbps, up
778 #define VMXNET3_LINK_DOWN 0
780 #define VMXWIFI_DRIVER_SHARED_LEN 8192
782 #define VMXNET3_DID_PASSTHRU 0xFFFF
784 #endif /* _VMXNET3_DEFS_H_ */