Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michał Mirosław and committed by
David S. Miller
34324dc2 a861a8b2

+19 -31
+1 -1
drivers/ieee802154/fakehard.c
··· 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;
+1 -1
drivers/misc/sgi-xp/xpnet.c
··· 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) {
+1 -1
drivers/net/bonding/bond_main.c
··· 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
+1 -1
drivers/net/can/dev.c
··· 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)
+1 -1
drivers/net/can/slcan.c
··· 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 /******************************************
+1 -1
drivers/net/dummy.c
··· 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
+1 -1
drivers/net/ifb.c
··· 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
+1 -1
drivers/net/loopback.c
··· 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
+1 -1
drivers/net/veth.c
··· 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 /*
+2 -3
include/linux/netdev_features.h
··· 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 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) ··· 117 118 #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ 118 119 NETIF_F_TSO6 | NETIF_F_UFO) 119 120 120 - #define NETIF_F_GEN_CSUM (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM) 121 + #define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM 121 122 #define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) 122 123 #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 123 124 #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
-1
include/linux/skbuff.h
··· 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
+2 -2
net/bridge/br_device.c
··· 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;
+6 -15
net/core/dev.c
··· 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)) { ··· 5618 5624 dev->wanted_features = dev->features & dev->hw_features; 5619 5625 5620 5626 /* Turn on no cache copy if HW is doing checksum */ 5621 - dev->hw_features |= NETIF_F_NOCACHE_COPY; 5622 - if ((dev->features & NETIF_F_ALL_CSUM) && 5623 - !(dev->features & NETIF_F_NO_CSUM)) { 5624 - dev->wanted_features |= NETIF_F_NOCACHE_COPY; 5625 - dev->features |= NETIF_F_NOCACHE_COPY; 5627 + if (!(dev->flags & IFF_LOOPBACK)) { 5628 + dev->hw_features |= NETIF_F_NOCACHE_COPY; 5629 + if (dev->features & NETIF_F_ALL_CSUM) { 5630 + dev->wanted_features |= NETIF_F_NOCACHE_COPY; 5631 + dev->features |= NETIF_F_NOCACHE_COPY; 5632 + } 5626 5633 } 5627 5634 5628 5635 /* Make NETIF_F_HIGHDMA inheritable to VLAN devices. ··· 6368 6373 6369 6374 all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask; 6370 6375 all &= one | ~NETIF_F_ALL_FOR_ALL; 6371 - 6372 - /* If device needs checksumming, downgrade to it. */ 6373 - if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM)) 6374 - all &= ~NETIF_F_NO_CSUM; 6375 6376 6376 6377 /* If one device supports hw checksumming, set for all. */ 6377 6378 if (all & NETIF_F_GEN_CSUM)
-1
net/core/ethtool.c
··· 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",