[ovs-dev] [PATCH v2] datapath: Enable vlan offload on internal devices.

Jesse Gross jesse at nicira.com
Wed Mar 9 20:49:20 UTC 2011


Although it is generally best to configure vlans directly though
Open vSwitch, enabling vlan acceleration on internal devices can
avoid some issues and hardware limitations if Linux vlan devices
are used.  It is only used on kernels that support modern vlan
data structures, which are 2.6.27 and later.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
There are two changes from the previous version:
* Drop ethtool operation to disable vlan acceleration.  Some NICs
  do not support offloading without using acceleration, so disabling
  it can cause problems.  This brings Linux vlan tagging inline with
  OVS tagging in that it always uses acceleration.
* Enable offloads for vlans.  Although the networking core cannot
  properly handle these until 2.6.37 the mechanism used for tagging
  is the same as OVS tagging and we therefore already deal with all
  of the offloads before egress. 
---
 datapath/vport-internal_dev.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 63f3f69..fff4f4e 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -176,6 +176,11 @@ static void do_setup(struct net_device *netdev)
 	netdev->features = NETIF_F_LLTX | NETIF_F_SG | NETIF_F_FRAGLIST |
 				NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_TSO;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+	netdev->vlan_features = netdev->features;
+	netdev->features |= NETIF_F_HW_VLAN_TX;
+#endif
+
 	vport_gen_rand_ether_addr(netdev->dev_addr);
 }
 
-- 
1.7.1




More information about the dev mailing list