]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
net: fix netdev_increment_features()
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Fri, 22 Apr 2011 06:31:16 +0000 (06:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Apr 2011 20:33:07 +0000 (13:33 -0700)
Simplify and fix netdev_increment_features() to conform to what is
stated in netdevice.h comments about NETIF_F_ONE_FOR_ALL.
Include FCoE segmentation and VLAN-challedged flags in computation.

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 364bcf212f715aeb2a16c2e8bd08df59377fd3c3..b7d0304762aae517cb75265864b67124a7c5b3b6 100644 (file)
@@ -1106,7 +1106,12 @@ struct net_device {
         */
 #define NETIF_F_ONE_FOR_ALL    (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
                                 NETIF_F_SG | NETIF_F_HIGHDMA |         \
-                                NETIF_F_FRAGLIST)
+                                NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
+       /*
+        * If one device doesn't support one of these features, then disable it
+        * for all in netdev_increment_features.
+        */
+#define NETIF_F_ALL_FOR_ALL    (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
 
        /* changeable features with no special hardware requirements */
 #define NETIF_F_SOFT_FEATURES  (NETIF_F_GSO | NETIF_F_GRO)
index 3bbb4c2ce92e57203d68b73bdba5e6be9428c693..7db99b52679f09ee83d4cedae34faecb5fb3f6b2 100644 (file)
@@ -6164,33 +6164,20 @@ static int dev_cpu_callback(struct notifier_block *nfb,
  */
 u32 netdev_increment_features(u32 all, u32 one, u32 mask)
 {
-       /* If device needs checksumming, downgrade to it. */
-       if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
-               all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM);
-       else if (mask & NETIF_F_ALL_CSUM) {
-               /* If one device supports v4/v6 checksumming, set for all. */
-               if (one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM) &&
-                   !(all & NETIF_F_GEN_CSUM)) {
-                       all &= ~NETIF_F_ALL_CSUM;
-                       all |= one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
-               }
-
-               /* If one device supports hw checksumming, set for all. */
-               if (one & NETIF_F_GEN_CSUM && !(all & NETIF_F_GEN_CSUM)) {
-                       all &= ~NETIF_F_ALL_CSUM;
-                       all |= NETIF_F_HW_CSUM;
-               }
-       }
+       if (mask & NETIF_F_GEN_CSUM)
+               mask |= NETIF_F_ALL_CSUM;
+       mask |= NETIF_F_VLAN_CHALLENGED;
 
-       /* If device can't no cache copy, don't do for all */
-       if (!(one & NETIF_F_NOCACHE_COPY))
-               all &= ~NETIF_F_NOCACHE_COPY;
+       all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask;
+       all &= one | ~NETIF_F_ALL_FOR_ALL;
 
-       one |= NETIF_F_ALL_CSUM;
+       /* If device needs checksumming, downgrade to it. */
+       if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM))
+               all &= ~NETIF_F_NO_CSUM;
 
-       one |= all & NETIF_F_ONE_FOR_ALL;
-       all &= one | NETIF_F_LLTX | NETIF_F_GSO | NETIF_F_UFO;
-       all |= one & mask & NETIF_F_ONE_FOR_ALL;
+       /* If one device supports hw checksumming, set for all. */
+       if (all & NETIF_F_GEN_CSUM)
+               all &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
 
        return all;
 }