net: VMware virtual Ethernet NIC driver: vmxnet3
Subsystems (4)
PATCH 1/1 net: VMware virtual Ethernet NIC driver: vmxnet3
Ethernet NIC driver for VMware's vmxnet3
From: Shreyas Bhatewara <[email protected]>
This patch adds driver support for VMware's virtual Ethernet NIC: vmxnet3
Guests running on VMware hypervisors supporting vmxnet3 device will thus have access to improved network functionalities and performance.
---
VMware virtual Ethernet NIC Driver : vmxnet3 - v2
Changelog (v2-v1)
- Rebased the patch to v2.6.32-rc1
- Changed all uint32_t types to u32 and friends
- Removed duplicate max queue size from upt1_defs.h
- Replaced #defines by enum
- uniform spacing between datatype and membername in structures
- removed some noisy printks, eliminated some BUG_ONs
- corrected arguments of kcalloc
- used pc_request_selected_regions, pci_enable_dev_mem
- elminated not-so-useful wrapper functions, used eth_op_ functions instead
- used strlcpy
- used get_sset_counts instead of get_stats_count
- used net_device_stats from struct net_device
Please review the patch and provide your feedback.
Thanking you
->Shreyas
---
MAINTAINERS +7 -0
@@ -5608,6 +5608,13 @@ S: Maintained F: drivers/vlynq/vlynq.c F: include/linux/vlynq.h +VMWARE VMXNET3 ETHERNET DRIVER +M: Shreyas Bhatewara <[email protected]> +M: VMware PV-Drivers <[email protected]> +L: [email protected] +S: Maintained +F: drivers/net/vmxnet3/ + VOLTAGE AND CURRENT REGULATOR FRAMEWORK M: Liam Girdwood <[email protected]> M: Mark Brown <[email protected]>
drivers/net/Kconfig +8 -0
@@ -3223,4 +3223,12 @@ config VIRTIO_NET This is the virtual network driver for virtio. It can be used with lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. +config VMXNET3 + tristate "VMware VMXNET3 ethernet driver" + depends on PCI && X86 + help + This driver supports VMware's vmxnet3 virtual ethernet NIC. + To compile this driver as a module, choose M here: the + module will be called vmxnet3. + endif # NETDEVICES
drivers/net/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_TEHUTI) += tehuti.o obj-$(CONFIG_ENIC) += enic/ obj-$(CONFIG_JME) += jme.o obj-$(CONFIG_BE2NET) += benet/ +obj-$(CONFIG_VMXNET3) += vmxnet3/ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o \
drivers/net/vmxnet3/Makefile new file +35 -0
@@ -0,0 +1,35 @@ +################################################################################ +# +# Linux driver for VMware's vmxnet3 ethernet NIC. +# +# Copyright (C) 2007-2009, VMware, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License and no later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or +# NON INFRINGEMENT. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". +# +# Maintained by: Shreyas Bhatewara <[email protected]> +# +# +################################################################################ + +# +# Makefile for the VMware vmxnet3 ethernet NIC driver +# + +obj-$(CONFIG_VMXNET3) += vmxnet3.o + +vmxnet3-objs := vmxnet3_drv.o vmxnet3_ethtool.o
drivers/net/vmxnet3/upt1_defs.h new file +99 -0
99 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_defs.h new file +535 -0
535 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_drv.c new file +2561 -0
2,299 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +538 -0
538 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_int.h new file +389 -0
389 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Shreyas Bhatewara <[email protected]> wrote:
Note: your patch was linewrapped again
Quoted 14 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +14
-0+ + +static void +vmxnet3_declare_features (struct vmxnet3_adapter *adapter,bool dma64) +{ +struct net_device *netdev = adapter->netdev; + + netdev->features =NETIF_F_SG | +NETIF_F_HW_CSUM | +NETIF_F_HW_VLAN_TX | +NETIF_F_HW_VLAN_RX | +NETIF_F_HW_VLAN_FILTER | +NETIF_F_TSO | +NETIF_F_TSO6 ;
drivers/net/vmxnet3/vmxnet3_drv.c line 2101
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +10
-0+ +printk (KERN_INFO "features: sg csum vlan jf tso tsoIPv6" ); + + adapter->rxcsum = true; + adapter->jumbo_frame = true; + +if (!disable_lro) { + adapter->lro = true; +printk (" lro" ); + }
Why not use NETIF_F_LRO and ethtool to control LRO support?
Stephen,
Thanks for taking a look.
Quoted 10 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Wednesday, September 30, 2009 5:39 PM
To: Shreyas Bhatewara
Cc: linux-kernel; netdev; Stephen Hemminger; David S. Miller; Jeff Garzik; Anthony Liguori; Chris Wright; Greg Kroah-Hartman; Andrew Morton; virtualization; pv-drivers
Subject: Re: [PATCH 2.6.32-rc1] net: VMware virtual Ethernet NIC
driver: vmxnet3
Quoted 5 lines
On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Shreyas Bhatewara <[email protected]> wrote:Note: your patch was linewrapped again
Fixed the alpine option. Should not happen again.
Quoted 19 lines
drivers/net/vmxnet3/vmxnet3_drv.c
Quoted 4 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +4
-0+ + +static void +vmxnet3_declare_features(struct vmxnet3_adapter *adapter, booldma64)
Quoted 14 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +14
-0+{ +struct net_device *netdev = adapter->netdev; + + netdev->features =NETIF_F_SG | +NETIF_F_HW_CSUM | +NETIF_F_HW_VLAN_TX | +NETIF_F_HW_VLAN_RX | +NETIF_F_HW_VLAN_FILTER | +NETIF_F_TSO | +NETIF_F_TSO6 ; + +printk (KERN_INFO "features: sg csum vlan jf tso tsoIPv6" ); + + adapter->rxcsum = true;
Quoted 8 lines
drivers/net/vmxnet3/vmxnet3_drv.c line 2101
Quoted 6 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +6
-0+ adapter->jumbo_frame = true; + +if (!disable_lro) { + adapter->lro = true; +printk (" lro" ); + }Why not use
NETIF_F_LROand ethtool to control LRO support?
Yes, that would be a better way to do it. I will make that change.
Stephen,
Thanks for taking a look.
Quoted 10 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Wednesday, September 30, 2009 5:39 PM
To: Shreyas Bhatewara
Cc: linux-kernel; netdev; Stephen Hemminger; David S. Miller; Jeff Garzik; Anthony Liguori; Chris Wright; Greg Kroah-Hartman; Andrew Morton; virtualization; pv-drivers
Subject: Re: [PATCH 2.6.32-rc1] net: VMware virtual Ethernet NIC
driver: vmxnet3
Quoted 5 lines
On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Shreyas Bhatewara <[email protected]> wrote:Note: your patch was linewrapped again
Fixed the alpine option. Should not happen again.
Quoted 19 lines
drivers/net/vmxnet3/vmxnet3_drv.c
Quoted 4 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +4
-0+ + +static void +vmxnet3_declare_features(struct vmxnet3_adapter *adapter, booldma64)
Quoted 14 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +14
-0+{ +struct net_device *netdev = adapter->netdev; + + netdev->features =NETIF_F_SG | +NETIF_F_HW_CSUM | +NETIF_F_HW_VLAN_TX | +NETIF_F_HW_VLAN_RX | +NETIF_F_HW_VLAN_FILTER | +NETIF_F_TSO | +NETIF_F_TSO6 ; + +printk (KERN_INFO "features: sg csum vlan jf tso tsoIPv6" ); + + adapter->rxcsum = true;
Quoted 8 lines
drivers/net/vmxnet3/vmxnet3_drv.c line 2101
Quoted 6 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +6
-0+ adapter->jumbo_frame = true; + +if (!disable_lro) { + adapter->lro = true; +printk (" lro" ); + }Why not use
NETIF_F_LROand ethtool to control LRO support?
Yes, that would be a better way to do it. I will make that change.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Wed, 30 Sep 2009 17:39:23 -0700
Quoted 1 line
Why not use
NETIF_F_LROand ethtool to control LRO support?
In fact, you must, in order to handle bridging and routing correctly.
Bridging and routing is illegal with LRO enabled, so the kernel automatically issues the necessary ethtool commands to disable LRO in the relevant devices.
Therefore you must support the ethtool LRO operation in order to support LRO at all.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Wed, 30 Sep 2009 17:39:23 -0700
Quoted 1 line
Why not use
NETIF_F_LROand ethtool to control LRO support?
In fact, you must, in order to handle bridging and routing correctly.
Bridging and routing is illegal with LRO enabled, so the kernel automatically issues the necessary ethtool commands to disable LRO in the relevant devices.
Therefore you must support the ethtool LRO operation in order to support LRO at all.
On Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Shreyas Bhatewara <[email protected]> wrote:
Note: your patch was linewrapped again
Quoted 14 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +14
-0+ + +static void +vmxnet3_declare_features (struct vmxnet3_adapter *adapter,bool dma64) +{ +struct net_device *netdev = adapter->netdev; + + netdev->features =NETIF_F_SG | +NETIF_F_HW_CSUM | +NETIF_F_HW_VLAN_TX | +NETIF_F_HW_VLAN_RX | +NETIF_F_HW_VLAN_FILTER | +NETIF_F_TSO | +NETIF_F_TSO6 ;
drivers/net/vmxnet3/vmxnet3_drv.c line 2101
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_drv.c new file +10
-0+ +printk (KERN_INFO "features: sg csum vlan jf tso tsoIPv6" ); + + adapter->rxcsum = true; + adapter->jumbo_frame = true; + +if (!disable_lro) { + adapter->lro = true; +printk (" lro" ); + }
Why not use NETIF_F_LRO and ethtool to control LRO support?
David Miller
maintainerFrom: Shreyas Bhatewara <[email protected]>
Date: Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Quoted 9 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +6
-0+{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); +u8 *base; +int i; + + VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_GET_STATS);drivers/net/vmxnet3/vmxnet3_ethtool.c new file +2
-0+ +/* this does assume each counter is 64-bit wide */
drivers/net/vmxnet3/vmxnet3_ethtool.c line 297
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +10
-0+ + base = (u8 *)&adapter->tqd_start->stats; +for (i =0 ; i <ARRAY_SIZE (vmxnet3_tq_dev_stats); i++) + *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset); + + base = (u8 *)&adapter->tx_queue.stats; +for (i =0 ; i <ARRAY_SIZE (vmxnet3_tq_driver_stats); i++) + *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset); + + base = (u8 *)&adapter->rqd_start->stats;
There's a lot of code like this that isn't indented properly. Either that or your email client has corrupted the patch by breaking up long lines or similar.
Another example:
Quoted 11 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +11
-0+static int +vmxnet3_set_rx_csum (struct net_device *netdev,u32 val) +{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); + +if (adapter->rxcsum != val) { + adapter->rxcsum = val; +if (netif_running (netdev)) { +if (val) + adapter->shared->devRead.misc.uptFeatures |= +UPT1_F_RXCSUM ;
drivers/net/vmxnet3/vmxnet3_ethtool.c line 64
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +10
-0+else + adapter->shared->devRead.misc.uptFeatures &= + ~UPT1_F_RXCSUM ; + +VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_CMD , +VMXNET3_CMD_UPDATE_FEATURE ); + } + } +return 0 ; +}
Yikes! :-)
David Miller
maintainerFrom: Shreyas Bhatewara <[email protected]>
Date: Wed, 30 Sep 2009 14:34:57 -0700 (PDT)
Quoted 9 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +6
-0+{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); +u8 *base; +int i; + + VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
VMXNET3_CMD_GET_STATS);drivers/net/vmxnet3/vmxnet3_ethtool.c new file +2
-0+ +/* this does assume each counter is 64-bit wide */
drivers/net/vmxnet3/vmxnet3_ethtool.c line 297
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +10
-0+ + base = (u8 *)&adapter->tqd_start->stats; +for (i =0 ; i <ARRAY_SIZE (vmxnet3_tq_dev_stats); i++) + *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset); + + base = (u8 *)&adapter->tx_queue.stats; +for (i =0 ; i <ARRAY_SIZE (vmxnet3_tq_driver_stats); i++) + *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset); + + base = (u8 *)&adapter->rqd_start->stats;
There's a lot of code like this that isn't indented properly. Either that or your email client has corrupted the patch by breaking up long lines or similar.
Another example:
Quoted 11 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +11
-0+static int +vmxnet3_set_rx_csum (struct net_device *netdev,u32 val) +{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); + +if (adapter->rxcsum != val) { + adapter->rxcsum = val; +if (netif_running (netdev)) { +if (val) + adapter->shared->devRead.misc.uptFeatures |= +UPT1_F_RXCSUM ;
drivers/net/vmxnet3/vmxnet3_ethtool.c line 64
Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_ethtool.c new file +10
-0+else + adapter->shared->devRead.misc.uptFeatures &= + ~UPT1_F_RXCSUM ; + +VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_CMD , +VMXNET3_CMD_UPDATE_FEATURE ); + } + } +return 0 ; +}
Yikes! :-)