datapath: Enable vlan offload on internal devices.
authorJesse Gross <jesse@nicira.com>
Fri, 4 Mar 2011 23:52:43 +0000 (15:52 -0800)
committerJesse Gross <jesse@nicira.com>
Thu, 10 Mar 2011 00:27:55 +0000 (16:27 -0800)
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@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/vport-internal_dev.c

index 63f3f69..fff4f4e 100644 (file)
@@ -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);
 }