diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-22 02:31:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-28 16:33:07 -0400 |
commit | 1742f183fc218798dab6fcf0ded25b6608fc0a48 (patch) | |
tree | 47910c74f188e8dc9eb4fbefba01a1cf29de9965 | |
parent | 96339d6c490a32de35fa798ca7922d13a8538ecd (diff) |
net: fix netdev_increment_features()
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>
-rw-r--r-- | include/linux/netdevice.h | 7 | ||||
-rw-r--r-- | net/core/dev.c | 35 |
2 files changed, 17 insertions, 25 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 364bcf212f71..b7d0304762aa 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1106,7 +1106,12 @@ struct net_device { | |||
1106 | */ | 1106 | */ |
1107 | #define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ | 1107 | #define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ |
1108 | NETIF_F_SG | NETIF_F_HIGHDMA | \ | 1108 | NETIF_F_SG | NETIF_F_HIGHDMA | \ |
1109 | NETIF_F_FRAGLIST) | 1109 | NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED) |
1110 | /* | ||
1111 | * If one device doesn't support one of these features, then disable it | ||
1112 | * for all in netdev_increment_features. | ||
1113 | */ | ||
1114 | #define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO) | ||
1110 | 1115 | ||
1111 | /* changeable features with no special hardware requirements */ | 1116 | /* changeable features with no special hardware requirements */ |
1112 | #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) | 1117 | #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) |
diff --git a/net/core/dev.c b/net/core/dev.c index 3bbb4c2ce92e..7db99b52679f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -6164,33 +6164,20 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
6164 | */ | 6164 | */ |
6165 | u32 netdev_increment_features(u32 all, u32 one, u32 mask) | 6165 | u32 netdev_increment_features(u32 all, u32 one, u32 mask) |
6166 | { | 6166 | { |
6167 | /* If device needs checksumming, downgrade to it. */ | 6167 | if (mask & NETIF_F_GEN_CSUM) |
6168 | if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) | 6168 | mask |= NETIF_F_ALL_CSUM; |
6169 | all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM); | 6169 | mask |= NETIF_F_VLAN_CHALLENGED; |
6170 | else if (mask & NETIF_F_ALL_CSUM) { | ||
6171 | /* If one device supports v4/v6 checksumming, set for all. */ | ||
6172 | if (one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM) && | ||
6173 | !(all & NETIF_F_GEN_CSUM)) { | ||
6174 | all &= ~NETIF_F_ALL_CSUM; | ||
6175 | all |= one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | ||
6176 | } | ||
6177 | |||
6178 | /* If one device supports hw checksumming, set for all. */ | ||
6179 | if (one & NETIF_F_GEN_CSUM && !(all & NETIF_F_GEN_CSUM)) { | ||
6180 | all &= ~NETIF_F_ALL_CSUM; | ||
6181 | all |= NETIF_F_HW_CSUM; | ||
6182 | } | ||
6183 | } | ||
6184 | 6170 | ||
6185 | /* If device can't no cache copy, don't do for all */ | 6171 | all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask; |
6186 | if (!(one & NETIF_F_NOCACHE_COPY)) | 6172 | all &= one | ~NETIF_F_ALL_FOR_ALL; |
6187 | all &= ~NETIF_F_NOCACHE_COPY; | ||
6188 | 6173 | ||
6189 | one |= NETIF_F_ALL_CSUM; | 6174 | /* If device needs checksumming, downgrade to it. */ |
6175 | if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM)) | ||
6176 | all &= ~NETIF_F_NO_CSUM; | ||
6190 | 6177 | ||
6191 | one |= all & NETIF_F_ONE_FOR_ALL; | 6178 | /* If one device supports hw checksumming, set for all. */ |
6192 | all &= one | NETIF_F_LLTX | NETIF_F_GSO | NETIF_F_UFO; | 6179 | if (all & NETIF_F_GEN_CSUM) |
6193 | all |= one & mask & NETIF_F_ONE_FOR_ALL; | 6180 | all &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM); |
6194 | 6181 | ||
6195 | return all; | 6182 | return all; |
6196 | } | 6183 | } |