aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-02-15 11:59:16 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-17 17:16:32 -0500
commit212b573f5552c60265da721ff9ce32e3462a2cdd (patch)
treeb930a91d4d9c84414eca6e13d67bd5dba7c3c1e0
parent9a279ea3a77ebcc91b68f0546e7cfa5018a12513 (diff)
ethtool: enable GSO and GRO by default
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--net/core/dev.c18
2 files changed, 17 insertions, 4 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d08ef653857..168e3ad14da 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -984,6 +984,9 @@ struct net_device {
984 NETIF_F_SG | NETIF_F_HIGHDMA | \ 984 NETIF_F_SG | NETIF_F_HIGHDMA | \
985 NETIF_F_FRAGLIST) 985 NETIF_F_FRAGLIST)
986 986
987 /* changeable features with no special hardware requirements */
988#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
989
987 /* Interface index. Unique device identifier */ 990 /* Interface index. Unique device identifier */
988 int ifindex; 991 int ifindex;
989 int iflink; 992 int iflink;
diff --git a/net/core/dev.c b/net/core/dev.c
index 4580460ebec..8686f6ffe7f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5274,6 +5274,12 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
5274 features &= ~NETIF_F_TSO; 5274 features &= ~NETIF_F_TSO;
5275 } 5275 }
5276 5276
5277 /* Software GSO depends on SG. */
5278 if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
5279 netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
5280 features &= ~NETIF_F_GSO;
5281 }
5282
5277 /* UFO needs SG and checksumming */ 5283 /* UFO needs SG and checksumming */
5278 if (features & NETIF_F_UFO) { 5284 if (features & NETIF_F_UFO) {
5279 /* maybe split UFO into V4 and V6? */ 5285 /* maybe split UFO into V4 and V6? */
@@ -5430,11 +5436,15 @@ int register_netdevice(struct net_device *dev)
5430 if (dev->iflink == -1) 5436 if (dev->iflink == -1)
5431 dev->iflink = dev->ifindex; 5437 dev->iflink = dev->ifindex;
5432 5438
5433 dev->features = netdev_fix_features(dev, dev->features); 5439 /* Enable software offloads by default - will be stripped in
5440 * netdev_fix_features() if not supported. */
5441 dev->features |= NETIF_F_SOFT_FEATURES;
5434 5442
5435 /* Enable software GSO if SG is supported. */ 5443 /* Avoid warning from netdev_fix_features() for GSO without SG */
5436 if (dev->features & NETIF_F_SG) 5444 if (!(dev->features & NETIF_F_SG))
5437 dev->features |= NETIF_F_GSO; 5445 dev->features &= ~NETIF_F_GSO;
5446
5447 dev->features = netdev_fix_features(dev, dev->features);
5438 5448
5439 /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, 5449 /* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
5440 * vlan_dev_init() will do the dev->features check, so these features 5450 * vlan_dev_init() will do the dev->features check, so these features