ethtool: enable GSO and GRO by default
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Tue, 15 Feb 2011 16:59:16 +0000 (16:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Feb 2011 22:16:32 +0000 (14:16 -0800)
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c

index d08ef6538579eaf3af38374a655cd4f6e4160009..168e3ad14daf5dc69915fd3429b097c8e0c4304e 100644 (file)
@@ -984,6 +984,9 @@ struct net_device {
                                 NETIF_F_SG | NETIF_F_HIGHDMA |         \
                                 NETIF_F_FRAGLIST)
 
+       /* changeable features with no special hardware requirements */
+#define NETIF_F_SOFT_FEATURES  (NETIF_F_GSO | NETIF_F_GRO)
+
        /* Interface index. Unique device identifier    */
        int                     ifindex;
        int                     iflink;
index 4580460ebecd63d3e33eff969571bc4b7aae21d5..8686f6ffe7f0a560b5e2d9e1f9072ac58241abbf 100644 (file)
@@ -5274,6 +5274,12 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
                features &= ~NETIF_F_TSO;
        }
 
+       /* Software GSO depends on SG. */
+       if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
+               netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
+               features &= ~NETIF_F_GSO;
+       }
+
        /* UFO needs SG and checksumming */
        if (features & NETIF_F_UFO) {
                /* maybe split UFO into V4 and V6? */
@@ -5430,11 +5436,15 @@ int register_netdevice(struct net_device *dev)
        if (dev->iflink == -1)
                dev->iflink = dev->ifindex;
 
-       dev->features = netdev_fix_features(dev, dev->features);
+       /* Enable software offloads by default - will be stripped in
+        * netdev_fix_features() if not supported. */
+       dev->features |= NETIF_F_SOFT_FEATURES;
 
-       /* Enable software GSO if SG is supported. */
-       if (dev->features & NETIF_F_SG)
-               dev->features |= NETIF_F_GSO;
+       /* Avoid warning from netdev_fix_features() for GSO without SG */
+       if (!(dev->features & NETIF_F_SG))
+               dev->features &= ~NETIF_F_GSO;
+
+       dev->features = netdev_fix_features(dev, dev->features);
 
        /* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
         * vlan_dev_init() will do the dev->features check, so these features
This page took 0.044374 seconds and 5 git commands to generate.