Skip to content

Commit

Permalink
net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled
Browse files Browse the repository at this point in the history
With NETIF_F_HW_TLS_TX packets are encrypted in HW. This cannot be
logically done when HW_CSUM offload is off.

Fixes: 2342a85 ("net: Add TLS TX offload features")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Boris Pismenny <borisp@nvidia.com>
Link: https://lore.kernel.org/r/20201213143929.26253-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Tariq Toukan authored and Jakub Kicinski committed Dec 15, 2020
1 parent c31b70c commit ae0b04b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Documentation/networking/tls-offload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,13 @@ on TCP retransmissions to handle corner cases is not acceptable.
TLS device features
-------------------

Drivers should ignore the changes to TLS the device feature flags.
Drivers should ignore the changes to the TLS device feature flags.
These flags will be acted upon accordingly by the core ``ktls`` code.
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.
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.
5 changes: 5 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -9643,6 +9643,11 @@ 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;
}

return features;
}

Expand Down

0 comments on commit ae0b04b

Please sign in to comment.