aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2010-11-30 01:38:00 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-06 15:59:04 -0500
commit7903264402546f45f9bac8ad2bfdb00d00eb124a (patch)
tree32076a169b37ce9c98916ed2d702de5cab1aeb6c /net/core
parent900d495a189dc3ff5952b98a77d18e3018f8286c (diff)
net: Fix too optimistic NETIF_F_HW_CSUM features
NETIF_F_HW_CSUM is a superset of NETIF_F_IP_CSUM+NETIF_F_IPV6_CSUM, but some drivers miss the difference. Fix this and also fix UFO dependency on checksumming offload as it makes the same mistake in assumptions. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by: Jon Mason <jon.mason@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c7
-rw-r--r--net/core/ethtool.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index cd2437495428..55ff66fabce4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5041,10 +5041,13 @@ unsigned long netdev_fix_features(unsigned long features, const char *name)
5041 } 5041 }
5042 5042
5043 if (features & NETIF_F_UFO) { 5043 if (features & NETIF_F_UFO) {
5044 if (!(features & NETIF_F_GEN_CSUM)) { 5044 /* maybe split UFO into V4 and V6? */
5045 if (!((features & NETIF_F_GEN_CSUM) ||
5046 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
5047 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
5045 if (name) 5048 if (name)
5046 printk(KERN_ERR "%s: Dropping NETIF_F_UFO " 5049 printk(KERN_ERR "%s: Dropping NETIF_F_UFO "
5047 "since no NETIF_F_HW_CSUM feature.\n", 5050 "since no checksum offload features.\n",
5048 name); 5051 name);
5049 features &= ~NETIF_F_UFO; 5052 features &= ~NETIF_F_UFO;
5050 } 5053 }
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 956a9f4971cb..d5bc28818883 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1171,7 +1171,9 @@ static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr)
1171 return -EFAULT; 1171 return -EFAULT;
1172 if (edata.data && !(dev->features & NETIF_F_SG)) 1172 if (edata.data && !(dev->features & NETIF_F_SG))
1173 return -EINVAL; 1173 return -EINVAL;
1174 if (edata.data && !(dev->features & NETIF_F_HW_CSUM)) 1174 if (edata.data && !((dev->features & NETIF_F_GEN_CSUM) ||
1175 (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
1176 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)))
1175 return -EINVAL; 1177 return -EINVAL;
1176 return dev->ethtool_ops->set_ufo(dev, edata.data); 1178 return dev->ethtool_ops->set_ufo(dev, edata.data);
1177} 1179}