net: Warning for protocol specific transmit checksum
Subsystems (3)
cover net: Warning for protocol specific transmit checksum
Apparently, not everyone got the message of "Less Is More" with regards to checksum offload (https://www.youtube.com/watch?v=6VgmazGwL_Y). Some vendors are still using the deprecated versions of checksum offload in new devices. As more complex protocol combinations are commonly used and supported, continued use of protocol specific checksum offloads is not sustainable-- it needs complex driver code, gives limited functionality, and is hard to make robust and to test all the edge cases for correctness. This is particularly true for protocol specific transmit checksum offload.
Consider for instance, that when a segment routing header is inserted in a packet after the IPv6 header and before the a TCP header, if the offloading device attempts to compute the checksum over the pseudo header then the calculated value would likely be incorrect since the IP destination address is not the same as the final address for termination of TCP. The upshot is that if a device supports protocol specific checksum offload then the driver has to ensure that the packet only contains protocol that the device will understand; in the worst case scenario of protocol specific transmit offloads this degenerates to the driver having to parse the TX packet just to see if the device will be able to handle it (i40 driver for example).
This patch set adds a warning message for using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. Documentation/networking/netdev-features.txt is also modified with more detail about converting legacy drivers to use NETIF_F_HW_CSUM (that is, use the protocol generic API even if the device only support protocol specific checksum offload). Once all drivers have been converted to NETIF_F_HW_CSUM then NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM can be removed.
Tom Herbert (2):
net: Documentation about deprecating NETIF_F_IP{V6}_CSUM
net: Warning about use of deprecated TX checksum offload
Documentation/networking/netdev-features.txt | 7 ++++++- net/core/dev.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH 1/2 net: Documentation about deprecating NETIF_F_IP{V6}_CSUM
Add text in netdev-features.txt documenting that NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are being deprecated in favor of NETIF_F_HW_CSUM. Suggest that legacy drivers can be fixed by advertising NETIF_F_HW_CSUM and checking skb->protocol.
--- Documentation/networking/netdev-features.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/networking/netdev-features.txt +6 -1
@@ -106,7 +106,12 @@ For complete description, see comments near the top of include/linux/skbuff.h. Note: NETIF_F_HW_CSUM is a superset of NETIF_F_IP_CSUM + NETIF_F_IPV6_CSUM. It means that device can fill TCP/UDP-like checksum anywhere in the packets -whatever headers there might be. +whatever headers there might be. NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are +deprecated in favor of NETIF_F_HW_CSUM. Legacy drivers can be converted +by advertising NETIF_F_HW_CSUM and checking skb->protocol for ETH_P_IP or +ETH_P_IPV6, if the device does not support checksum offload for the protocol +in skb->protocol then it can call skb_checksum_help to perform the checksum +on the host. * Transmit TCP segmentation offload
Signature · 1 line
2.7.4
PATCH 2/2 net: Warning about use of deprecated TX checksum offload
In reply to Tom HerbertAdd a warning in netdev_fix_features that NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are deprecated and that drivers should advertise NETIF_F_HW_CSUM instead.
--- net/core/dev.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/dev.c +4 -0
@@ -8835,6 +8835,10 @@ static void netdev_sync_lower_features(struct net_device *upper,static netdev_features_t netdev_fix_features (struct net_device *dev,netdev_features_t features) { +/* NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are deprecated */ +if (features & (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM )) +netdev_warn (dev,"NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are considered deprecated. Please fix driver to use NETIF_F_HW_CSUM.\n" ); +/* Fix illegal checksum combinations */ if ((features &NETIF_F_HW_CSUM ) && (features & (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM ))) {
Signature · 1 line
2.7.4
David Miller
maintainerRe: [PATCH net-next 2/2] net: Warning about use of deprecated TX checksum offload
From: Tom Herbert <[email protected]>
Date: Thu, 26 Dec 2019 13:34:59 -0800
net/core/dev.c static void netdev_sync_lower_features(struct net_device *upper, · line 8840
Quoted 3 lines
net/core/dev.c +3
-0+/* NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are deprecated */ +if (features & (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM )) +netdev_warn (dev,"NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are considered deprecated. Please fix driver to use NETIF_F_HW_CSUM.\n" );
So let's put useless messages in people's kernel logs because grep apparently doesn't work on your computer?
Fix drivers that use that flag that you care about.
No way I am applying this series, it is ill conceived.