diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-01-22 07:14:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-24 18:29:11 -0500 |
commit | 57422dc530115e427dff464cc0a32bcd0efb5008 (patch) | |
tree | 8f1f42d5036d86abf70120c0bccdda013b18a39c /net/core | |
parent | 2505c5483137aa630806df9cd08a82d1cac72cc9 (diff) |
net: Move check of checksum features to netdev_fix_features()
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index aa761472f9e2..ad3741898584 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -5215,6 +5215,23 @@ static void rollback_registered(struct net_device *dev) | |||
5215 | 5215 | ||
5216 | unsigned long netdev_fix_features(unsigned long features, const char *name) | 5216 | unsigned long netdev_fix_features(unsigned long features, const char *name) |
5217 | { | 5217 | { |
5218 | /* Fix illegal checksum combinations */ | ||
5219 | if ((features & NETIF_F_HW_CSUM) && | ||
5220 | (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | ||
5221 | if (name) | ||
5222 | printk(KERN_NOTICE "%s: mixed HW and IP checksum settings.\n", | ||
5223 | name); | ||
5224 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); | ||
5225 | } | ||
5226 | |||
5227 | if ((features & NETIF_F_NO_CSUM) && | ||
5228 | (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | ||
5229 | if (name) | ||
5230 | printk(KERN_NOTICE "%s: mixed no checksumming and other settings.\n", | ||
5231 | name); | ||
5232 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); | ||
5233 | } | ||
5234 | |||
5218 | /* Fix illegal SG+CSUM combinations. */ | 5235 | /* Fix illegal SG+CSUM combinations. */ |
5219 | if ((features & NETIF_F_SG) && | 5236 | if ((features & NETIF_F_SG) && |
5220 | !(features & NETIF_F_ALL_CSUM)) { | 5237 | !(features & NETIF_F_ALL_CSUM)) { |
@@ -5390,21 +5407,6 @@ int register_netdevice(struct net_device *dev) | |||
5390 | if (dev->iflink == -1) | 5407 | if (dev->iflink == -1) |
5391 | dev->iflink = dev->ifindex; | 5408 | dev->iflink = dev->ifindex; |
5392 | 5409 | ||
5393 | /* Fix illegal checksum combinations */ | ||
5394 | if ((dev->features & NETIF_F_HW_CSUM) && | ||
5395 | (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | ||
5396 | printk(KERN_NOTICE "%s: mixed HW and IP checksum settings.\n", | ||
5397 | dev->name); | ||
5398 | dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); | ||
5399 | } | ||
5400 | |||
5401 | if ((dev->features & NETIF_F_NO_CSUM) && | ||
5402 | (dev->features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | ||
5403 | printk(KERN_NOTICE "%s: mixed no checksumming and other settings.\n", | ||
5404 | dev->name); | ||
5405 | dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); | ||
5406 | } | ||
5407 | |||
5408 | dev->features = netdev_fix_features(dev->features, dev->name); | 5410 | dev->features = netdev_fix_features(dev->features, dev->name); |
5409 | 5411 | ||
5410 | /* Enable software GSO if SG is supported. */ | 5412 | /* Enable software GSO if SG is supported. */ |