Commit 34324dc2bf27c1773045fea63cb11f7e2a6ad2b9

Authored by Michał Mirosław
Committed by David S. Miller
1 parent a861a8b233

net: remove NETIF_F_NO_CSUM feature bit

Only distinct use is checking if NETIF_F_NOCACHE_COPY should be
enabled by default. The check heuristics is altered a bit here,
so it hits other people than before. The default shouldn't be
trusted for performance-critical cases anyway.

For all other uses NETIF_F_NO_CSUM is equivalent to NETIF_F_HW_CSUM.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 14 changed files with 19 additions and 31 deletions Side-by-side Diff

drivers/ieee802154/fakehard.c
... ... @@ -343,7 +343,7 @@
343 343 {
344 344 dev->addr_len = IEEE802154_ADDR_LEN;
345 345 memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
346   - dev->features = NETIF_F_NO_CSUM;
  346 + dev->features = NETIF_F_HW_CSUM;
347 347 dev->needed_tailroom = 2; /* FCS */
348 348 dev->mtu = 127;
349 349 dev->tx_queue_len = 10;
drivers/misc/sgi-xp/xpnet.c
... ... @@ -576,7 +576,7 @@
576 576 * report an error if the data is not retrievable and the
577 577 * packet will be dropped.
578 578 */
579   - xpnet_device->features = NETIF_F_NO_CSUM;
  579 + xpnet_device->features = NETIF_F_HW_CSUM;
580 580  
581 581 result = register_netdev(xpnet_device);
582 582 if (result != 0) {
drivers/net/bonding/bond_main.c
... ... @@ -4361,7 +4361,7 @@
4361 4361 NETIF_F_HW_VLAN_RX |
4362 4362 NETIF_F_HW_VLAN_FILTER;
4363 4363  
4364   - bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM);
  4364 + bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
4365 4365 bond_dev->features |= bond_dev->hw_features;
4366 4366 }
4367 4367  
drivers/net/can/dev.c
... ... @@ -454,7 +454,7 @@
454 454  
455 455 /* New-style flags. */
456 456 dev->flags = IFF_NOARP;
457   - dev->features = NETIF_F_NO_CSUM;
  457 + dev->features = NETIF_F_HW_CSUM;
458 458 }
459 459  
460 460 struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
drivers/net/can/slcan.c
... ... @@ -387,7 +387,7 @@
387 387  
388 388 /* New-style flags. */
389 389 dev->flags = IFF_NOARP;
390   - dev->features = NETIF_F_NO_CSUM;
  390 + dev->features = NETIF_F_HW_CSUM;
391 391 }
392 392  
393 393 /******************************************
... ... @@ -134,7 +134,7 @@
134 134 dev->flags |= IFF_NOARP;
135 135 dev->flags &= ~IFF_MULTICAST;
136 136 dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO;
137   - dev->features |= NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
  137 + dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
138 138 random_ether_addr(dev->dev_addr);
139 139 }
140 140  
... ... @@ -164,7 +164,7 @@
164 164 .ndo_validate_addr = eth_validate_addr,
165 165 };
166 166  
167   -#define IFB_FEATURES (NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \
  167 +#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \
168 168 NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6 | \
169 169 NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
170 170  
drivers/net/loopback.c
... ... @@ -169,7 +169,7 @@
169 169 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
170 170 | NETIF_F_ALL_TSO
171 171 | NETIF_F_UFO
172   - | NETIF_F_NO_CSUM
  172 + | NETIF_F_HW_CSUM
173 173 | NETIF_F_RXCSUM
174 174 | NETIF_F_HIGHDMA
175 175 | NETIF_F_LLTX
... ... @@ -271,7 +271,7 @@
271 271 dev->features |= NETIF_F_LLTX;
272 272 dev->destructor = veth_dev_free;
273 273  
274   - dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
  274 + dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
275 275 }
276 276  
277 277 /*
include/linux/netdev_features.h
... ... @@ -17,7 +17,7 @@
17 17 enum {
18 18 NETIF_F_SG_BIT, /* Scatter/gather IO. */
19 19 NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
20   - NETIF_F_NO_CSUM_BIT, /* Does not require checksum. F.e. loopack. */
  20 + __UNUSED_NETIF_F_1,
21 21 NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
22 22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
... ... @@ -88,7 +88,6 @@
88 88 #define NETIF_F_LRO __NETIF_F(LRO)
89 89 #define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL)
90 90 #define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY)
91   -#define NETIF_F_NO_CSUM __NETIF_F(NO_CSUM)
92 91 #define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
93 92 #define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
94 93 #define NETIF_F_RXHASH __NETIF_F(RXHASH)
... ... @@ -118,7 +117,7 @@
118 117 #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
119 118 NETIF_F_TSO6 | NETIF_F_UFO)
120 119  
121   -#define NETIF_F_GEN_CSUM (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)
  120 +#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
122 121 #define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
123 122 #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
124 123 #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
include/linux/skbuff.h
... ... @@ -88,7 +88,6 @@
88 88 * at device setup time.
89 89 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum
90 90 * everything.
91   - * NETIF_F_NO_CSUM - loopback or reliable single hop media.
92 91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only
93 92 * TCP/UDP over IPv4. Sigh. Vendors like this
94 93 * way by an unknown reason. Though, see comment above
net/bridge/br_device.c
... ... @@ -342,10 +342,10 @@
342 342 dev->priv_flags = IFF_EBRIDGE;
343 343  
344 344 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
345   - NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
  345 + NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX |
346 346 NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX;
347 347 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
348   - NETIF_F_GSO_MASK | NETIF_F_NO_CSUM |
  348 + NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
349 349 NETIF_F_HW_VLAN_TX;
350 350  
351 351 br->dev = dev;
... ... @@ -5362,12 +5362,6 @@
5362 5362 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
5363 5363 }
5364 5364  
5365   - if ((features & NETIF_F_NO_CSUM) &&
5366   - (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
5367   - netdev_warn(dev, "mixed no checksumming and other settings.\n");
5368   - features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
5369   - }
5370   -
5371 5365 /* Fix illegal SG+CSUM combinations. */
5372 5366 if ((features & NETIF_F_SG) &&
5373 5367 !(features & NETIF_F_ALL_CSUM)) {
... ... @@ -5624,11 +5618,12 @@
5624 5618 dev->wanted_features = dev->features & dev->hw_features;
5625 5619  
5626 5620 /* Turn on no cache copy if HW is doing checksum */
5627   - dev->hw_features |= NETIF_F_NOCACHE_COPY;
5628   - if ((dev->features & NETIF_F_ALL_CSUM) &&
5629   - !(dev->features & NETIF_F_NO_CSUM)) {
5630   - dev->wanted_features |= NETIF_F_NOCACHE_COPY;
5631   - dev->features |= NETIF_F_NOCACHE_COPY;
  5621 + if (!(dev->flags & IFF_LOOPBACK)) {
  5622 + dev->hw_features |= NETIF_F_NOCACHE_COPY;
  5623 + if (dev->features & NETIF_F_ALL_CSUM) {
  5624 + dev->wanted_features |= NETIF_F_NOCACHE_COPY;
  5625 + dev->features |= NETIF_F_NOCACHE_COPY;
  5626 + }
5632 5627 }
5633 5628  
5634 5629 /* Make NETIF_F_HIGHDMA inheritable to VLAN devices.
... ... @@ -6373,10 +6368,6 @@
6373 6368  
6374 6369 all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask;
6375 6370 all &= one | ~NETIF_F_ALL_FOR_ALL;
6376   -
6377   - /* If device needs checksumming, downgrade to it. */
6378   - if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM))
6379   - all &= ~NETIF_F_NO_CSUM;
6380 6371  
6381 6372 /* If one device supports hw checksumming, set for all. */
6382 6373 if (all & NETIF_F_GEN_CSUM)
... ... @@ -43,7 +43,6 @@
43 43 static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
44 44 [NETIF_F_SG_BIT] = "tx-scatter-gather",
45 45 [NETIF_F_IP_CSUM_BIT] = "tx-checksum-ipv4",
46   - [NETIF_F_NO_CSUM_BIT] = "tx-checksum-unneeded",
47 46 [NETIF_F_HW_CSUM_BIT] = "tx-checksum-ip-generic",
48 47 [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6",
49 48 [NETIF_F_HIGHDMA_BIT] = "highdma",