]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Allow NETIF_F_HW_TLS_TX if IP_CSUM && IPV6_CSUM
authorTariq Toukan <tariqt@nvidia.com>
Thu, 14 Jan 2021 15:12:15 +0000 (17:12 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 14 Jan 2021 18:56:13 +0000 (10:56 -0800)
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.

Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reported-by: Rohit Maheshwari <rohitm@chelsio.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Link: https://lore.kernel.org/r/20210114151215.7061-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/networking/tls-offload.rst
net/core/dev.c

index 0f55c6d540f9794097d96e65c8d319210c02fbd8..9af3334d9ad080c1aaef9dca67f709a2fa8ef343 100644 (file)
@@ -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.
index 0071a11a6dc3cb36087b1afc2c4d1ddc1191fe6f..c360bb5367e240c228efadacf0e2c2ba4250e13a 100644 (file)
@@ -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;