netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: Disable NETIF_F_HW_TLS_RX when RXCSUM is disabled
@ 2021-01-17 15:15 Tariq Toukan
  2021-01-20  0:00 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2021-01-17 15:15 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh, Tariq Toukan

With NETIF_F_HW_TLS_RX packets are decrypted in HW. This cannot be
logically done when RXCSUM offload is off.

Fixes: 14136564c8ee ("net: Add TLS RX offload feature")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Boris Pismenny <borisp@nvidia.com>
---
 Documentation/networking/tls-offload.rst | 3 +++
 net/core/dev.c                           | 5 +++++
 2 files changed, 8 insertions(+)

Hi,

Please queue to -stable >= v4.19.

Thanks,
Tariq

diff --git a/Documentation/networking/tls-offload.rst b/Documentation/networking/tls-offload.rst
index 9af3334d9ad0..5f0dea3d571e 100644
--- a/Documentation/networking/tls-offload.rst
+++ b/Documentation/networking/tls-offload.rst
@@ -534,3 +534,6 @@ 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.
+Similarly, device-offloaded TLS decryption implies doing RXCSUM. If the user
+does not want to enable RX csum offload, TLS RX device feature is disabled
+as well.
diff --git a/net/core/dev.c b/net/core/dev.c
index c360bb5367e2..a979b86dbacd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9672,6 +9672,11 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
 		}
 	}
 
+	if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) {
+		netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n");
+		features &= ~NETIF_F_HW_TLS_RX;
+	}
+
 	return features;
 }
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: Disable NETIF_F_HW_TLS_RX when RXCSUM is disabled
  2021-01-17 15:15 [PATCH net] net: Disable NETIF_F_HW_TLS_RX when RXCSUM is disabled Tariq Toukan
@ 2021-01-20  0:00 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-01-20  0:00 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: David S. Miller, Boris Pismenny, netdev, Tariq Toukan, Moshe Shemesh

On Sun, 17 Jan 2021 17:15:38 +0200 Tariq Toukan wrote:
> With NETIF_F_HW_TLS_RX packets are decrypted in HW. This cannot be
> logically done when RXCSUM offload is off.
> 
> Fixes: 14136564c8ee ("net: Add TLS RX offload feature")
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> Reviewed-by: Boris Pismenny <borisp@nvidia.com>

Applied, but it's not 100% equivalent to Tx. For Rx we _can_
efficiently fall back to SW.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-20  0:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 15:15 [PATCH net] net: Disable NETIF_F_HW_TLS_RX when RXCSUM is disabled Tariq Toukan
2021-01-20  0:00 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).