Skip to content

RFC net/mlx5e: kTLS TX fixes for WQEs in flight

Tariq Toukan linux-doc linux-rdma lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7net/mlx5e: kTLS, Hold a dropped skb until its posted WQEs completedrivers/net/ethernet/mellanox/mlx5/core/en/txrx.h drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+39 -90 replies
2/7net/mlx5e: kTLS, Resync TX fully after its WQEs were lostdrivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+83 -120 replies
3/7net/mlx5e: kTLS, Post TX context params only for skbs that use themdrivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c+18 -220 replies
4/7net/mlx5e: Drain old TX SQs before activating new channelsdrivers/net/ethernet/mellanox/mlx5/core/en/txrx.h drivers/net/ethernet/mellanox/mlx5/core/en_main.c drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+118 -122 replies
5/7net: tls: keep the TX queue of a device-offloaded socket stableDocumentation/admin-guide/sysctl/net.rst Documentation/networking/tls-offload.rst include/net/sock.h +5 more+78 -60 replies
6/7net/mlx5e: kTLS, Keep the TX queue of an offloaded socket stabledrivers/net/ethernet/mellanox/mlx5/core/en/selq.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c+81 -120 replies
7/7net/mlx5e: kTLS, Keep a TX connection on one SQ at a timeDocumentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst drivers/net/ethernet/mellanox/mlx5/core/en/selq.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +3 more+100 -62 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC net-next 0/7] [Cover Letter] net/mlx5e: kTLS TX fixes for WQEs in flight

Hi,

This series fixes kTLS TX offload cases where WQEs that a connection posted are still in flight while its device state is released, changed from another SQ, or assumed to be in sync. Records then go out wrongly encrypted, or the TIS and DEK are released while still in use.

kTLS TX WQEs update the TIS crypto and record tracking state of a connection as they execute, and the device orders WQEs only within an SQ. The series makes sure that:

- An skb dropped after WQEs were posted for it is held until they complete, and a connection whose WQEs were lost is resynced fully (patches 1-2).
- The context params are posted only for an skb that uses them, on the SQ of the connection's data (patch 3).
- The old and new SQs never execute together across a channels switch (patch 4).
- The TX queue of an offloaded socket does not change while it has packets in flight, in the stack and in the mlx5e queue selection (patches 5-6). An skb that still reaches another SQ meanwhile, e.g. after tc skbedit queue_mapping, is dropped before anything is posted (patch 7).

Patches 1-6 are fixes, for net. Patch 7 is for net-next, on top of them. TLS 1.3 rekey support for device offload builds on this series.

Tested on ConnectX-6 Dx, with a software kTLS receiver that checks every byte. The commit messages describe the reproduction and the results of each fix.

Regards,
Tariq

Tariq Toukan (7):
net/mlx5e: kTLS, Hold a dropped skb until its posted WQEs complete net/mlx5e: kTLS, Resync TX fully after its WQEs were lost net/mlx5e: kTLS, Post TX context params only for skbs that use them net/mlx5e: Drain old TX SQs before activating new channels
net: tls: keep the TX queue of a device-offloaded socket stable net/mlx5e: kTLS, Keep the TX queue of an offloaded socket stable net/mlx5e: kTLS, Keep a TX connection on one SQ at a time

 Documentation/admin-guide/sysctl/net.rst      |   3 +
 .../ethernet/mellanox/mlx5/counters.rst       |   7 +
 Documentation/networking/tls-offload.rst      |  20 +++
 .../net/ethernet/mellanox/mlx5/core/en/selq.c |  96 ++++++++--
 .../net/ethernet/mellanox/mlx5/core/en/txrx.h |   2 +
 .../mellanox/mlx5/core/en_accel/ktls.c        |   1 +
 .../mellanox/mlx5/core/en_accel/ktls_tx.c     | 165 +++++++++++++++---
 .../mellanox/mlx5/core/en_accel/ktls_txrx.h   |  21 +++
 .../net/ethernet/mellanox/mlx5/core/en_main.c |  88 +++++++++-
 .../ethernet/mellanox/mlx5/core/en_stats.c    |   4 +
 .../ethernet/mellanox/mlx5/core/en_stats.h    |   2 +
 .../net/ethernet/mellanox/mlx5/core/en_tx.c   |  98 +++++++++--
 include/net/sock.h                            |  33 +++-
 include/net/tls.h                             |  13 ++
 net/core/dev.c                                |   3 +-
 net/core/sock.c                               |   2 +-
 net/ipv4/tcp_output.c                         |   7 +-
 net/tls/tls_device.c                          |   3 +
 18 files changed, 503 insertions(+), 65 deletions(-)

base-commit: fa5196392691051963726787944db872420dfa75

Signature · 1 line
2.44.0