Skip to contentSkip to conversation

VMXNET3 paravirtual NIC device implementation

PATCH New Dmitry Fleytman 1 participant 1 message Feb 28, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VMXNET3 paravirtual NIC device implementation

Implementation of VMWare VMXNET3 paravirtual NIC device. Supports of all the device features including offload capabilties, VLANs and etc.
The device is tested on different OSes:
Fedora 15
Ubuntu 10.4
Centos 6.2
Windows 2008R2
Windows 2008 64bit
Windows 2008 32bit
Windows 2003 64bit
Windows 2003 32bit
Currently live migration is not supported.

---
 qemu/Makefile.objs           |    1 +
 qemu/default-configs/pci.mak |    1 +
 qemu/hw/pci.c                |    2 +
 qemu/hw/pci.h                |    1 +
 qemu/hw/virtio-net.h         |   13 +-
 qemu/hw/vmware_utils.h       |  146 +++
 qemu/hw/vmxnet3.c            | 2574 ++++++++++++++++++++++++++++++++++++++++++
 qemu/hw/vmxnet3.h            |  767 +++++++++++++
 qemu/hw/vmxnet3_debug.h      |  119 ++
 qemu/hw/vmxnet_utils.c       |  187 +++
 qemu/hw/vmxnet_utils.h       |  257 +++++
 qemu/net.c                   |    2 +-
 qemu/net/checksum.h          |    7 +
 13 files changed, 4070 insertions(+), 7 deletions(-)
 create mode 100644 qemu/hw/vmware_utils.h
 create mode 100644 qemu/hw/vmxnet3.c
 create mode 100644 qemu/hw/vmxnet3.h
 create mode 100644 qemu/hw/vmxnet3_debug.h
 create mode 100644 qemu/hw/vmxnet_utils.c
 create mode 100644 qemu/hw/vmxnet_utils.h
qemu/Makefile.objs +1 -0
index 808de6a..3f846a6 100644
@@ -264,6 +264,7 @@ hw-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o
 hw-obj-$(CONFIG_PCNET_COMMON) += pcnet.o
 hw-obj-$(CONFIG_E1000_PCI) += e1000.o
 hw-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o
+hw-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o vmxnet_utils.o
 
 hw-obj-$(CONFIG_SMC91C111) += smc91c111.o
 hw-obj-$(CONFIG_LAN9118) += lan9118.o
qemu/default-configs/pci.mak +1 -0
index 21e4ccf..f8e6ee1 100644
@@ -13,6 +13,7 @@ CONFIG_PCNET_COMMON=y
 CONFIG_LSI_SCSI_PCI=y
 CONFIG_RTL8139_PCI=y
 CONFIG_E1000_PCI=y
+CONFIG_VMXNET3_PCI=y
 CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
qemu/hw/pci.c +2 -0
index bf046bf..f0fb1ee 100644
@@ -1350,6 +1350,7 @@ static const char * const pci_nic_models[] = {
     "e1000",
     "pcnet",
     "virtio",
+    "vmxnet3",
     NULL
 };
 
@@ -1362,6 +1363,7 @@ static const char * const pci_nic_names[] = {
     "e1000",
     "pcnet",
     "virtio-net-pci",
+    "vmxnet3",
     NULL
 };
 
qemu/hw/pci.h +1 -0
index 4f19fdb..fee8250 100644
@@ -60,6 +60,7 @@
 #define PCI_DEVICE_ID_VMWARE_NET         0x0720
 #define PCI_DEVICE_ID_VMWARE_SCSI        0x0730
 #define PCI_DEVICE_ID_VMWARE_IDE         0x1729
+#define PCI_DEVICE_ID_VMWARE_VMXNET3     0x07B0
 
 /* Intel (0x8086) */
 #define PCI_DEVICE_ID_INTEL_82551IT      0x1209
qemu/hw/virtio-net.h +7 -6
index 4468741..fa3c17b 100644
@@ -78,13 +78,14 @@ struct virtio_net_config
  * specify GSO or CSUM features, you can simply ignore the header. */
 struct virtio_net_hdr
 {
-#define VIRTIO_NET_HDR_F_NEEDS_CSUM     1       // Use csum_start, csum_offset
+#define VIRTIO_NET_HDR_F_NEEDS_CSUM     1     /* Use csum_start, csum_offset */
+#define VIRTIO_NET_HDR_F_DATA_VALID     2     /* Csum is valid               */
     uint8_t flags;
-#define VIRTIO_NET_HDR_GSO_NONE         0       // Not a GSO frame
-#define VIRTIO_NET_HDR_GSO_TCPV4        1       // GSO frame, IPv4 TCP (TSO)
-#define VIRTIO_NET_HDR_GSO_UDP          3       // GSO frame, IPv4 UDP (UFO)
-#define VIRTIO_NET_HDR_GSO_TCPV6        4       // GSO frame, IPv6 TCP
-#define VIRTIO_NET_HDR_GSO_ECN          0x80    // TCP has ECN set
+#define VIRTIO_NET_HDR_GSO_NONE         0     /* Not a GSO frame             */
+#define VIRTIO_NET_HDR_GSO_TCPV4        1     /* GSO frame, IPv4 TCP (TSO)   */
+#define VIRTIO_NET_HDR_GSO_UDP          3     /* GSO frame, IPv4 UDP (UFO)   */
+#define VIRTIO_NET_HDR_GSO_TCPV6        4     /* GSO frame, IPv6 TCP         */
+#define VIRTIO_NET_HDR_GSO_ECN          0x80  /* TCP has ECN set             */
     uint8_t gso_type;
     uint16_t hdr_len;
     uint16_t gso_size;
qemu/hw/vmware_utils.h new file +146 -0

146 lines not on this page · raw message

qemu/hw/vmxnet3.c new file +2574 -0

2,574 lines not on this page · raw message

qemu/hw/vmxnet3.h new file +767 -0

225 lines not on this page · raw message

qemu/hw/vmxnet3_debug.h new file +119 -0

119 lines not on this page · raw message

qemu/hw/vmxnet_utils.c new file +187 -0

187 lines not on this page · raw message

qemu/hw/vmxnet_utils.h new file +257 -0

257 lines not on this page · raw message

qemu/net.c +1 -1
index c34474f..e2f586c 100644

Lines of this file are not shown. View the raw message.

qemu/net/checksum.h +7 -0
index 1f05298..5f42a02 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.7.6

Part of the diff is not shown here. View the raw message.