net: Allow NETIF_F_HW_TLS_TX if IP_CSUM && IPV6_CSUM
Subsystems (4)
PATCH 1/1 net: Allow NETIF_F_HW_TLS_TX if IP_CSUM && IPV6_CSUM
Cited patch below blocked the TLS TX device offload unless HW_CSUM is set. This broke devices that use IP_CSUM && IP6_CSUM. Here we fix it.
Note that the single HW_TLS_TX feature flag indicates support for both IPv4/6, hence it should still be disabled in case only one of (IP_CSUM | IPV6_CSUM) is set.
--- Documentation/networking/tls-offload.rst | 2 +- net/core/dev.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-)
Documentation/networking/tls-offload.rst +1 -1
@@ -530,7 +530,7 @@ TLS device feature flags only control adding of new TLS connection offloads, old connections will remain active after flags are cleared. TLS encryption cannot be offloaded to devices without checksum calculation -offload. Hence, TLS TX device feature flag requires NETIF_F_HW_CSUM being set. +offload. Hence, TLS TX device feature flag requires TX csum offload being set. Disabling the latter implies clearing the former. Disabling TX checksum offload should not affect old connections, and drivers should make sure checksum calculation does not break for them.
net/core/dev.c +9 -3
@@ -9661,9 +9661,15 @@ static netdev_features_t netdev_fix_features(struct net_device *dev, } } -if ((features &NETIF_F_HW_TLS_TX ) && !(features &NETIF_F_HW_CSUM )) { -netdev_dbg (dev,"Dropping TLS TX HW offload feature since no CSUM feature.\n" ); - features &= ~NETIF_F_HW_TLS_TX ; +if (features &NETIF_F_HW_TLS_TX ) { +bool ip_csum = (features & (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM )) == + (NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM ); +bool hw_csum = features &NETIF_F_HW_CSUM ; + +if (!ip_csum && !hw_csum) { +netdev_dbg (dev,"Dropping TLS TX HW offload feature since no CSUM feature.\n" ); + features &= ~NETIF_F_HW_TLS_TX ; + } }return features;
Signature · 1 line
2.21.0
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 9 lines · On Thu, 14 Jan 2021 17:12:15 +0200 you wrote:
Cited patch below blocked the TLS TX device offload unless
HW_CSUMis set. This broke devices that useIP_CSUM&&IP6_CSUM. Here we fix it.Note that the single
HW_TLS_TXfeature flag indicates support for both IPv4/6, hence it should still be disabled in case only one of (IP_CSUM|IPV6_CSUM) is set.[...]
Here is the summary with links:
- [net] net: Allow NETIF_F_HW_TLS_TX if IP_CSUM && IPV6_CSUM
https://git.kernel.org/netdev/net/c/25537d71e2d0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html