All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 net-next 00/19] TLS offload rx, netdev & mlx5
@ 2018-07-12 19:25 Boris Pismenny
  2018-07-12 19:25 ` [PATCH v4 net-next 01/19] net: Add decrypted field to skb Boris Pismenny
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: Boris Pismenny @ 2018-07-12 19:25 UTC (permalink / raw)
  To: davem; +Cc: netdev, davejwatson, aviadye, borisp, saeedm

Hi,

The following series provides TLS RX inline crypto offload.

v4->v3:
    - Remove the iov revert for zero copy send flow 

v2->v3:
    - Fix typo
    - Adjust cover letter
    - Fix bug in zero copy flows
    - Use network byte order for the record number in resync
    - Adjust the sequence provided in resync

v1->v2:
    - Fix bisectability problems due to variable name changes
    - Fix potential uninitialized return value

This series completes the generic infrastructure to offload TLS crypto to
a network devices. It enables the kernel TLS socket to skip decryption and
authentication operations for SKBs marked as decrypted on the receive
side of the data path. Leaving those computationally expensive operations
to the NIC.

This infrastructure doesn't require a TCP offload engine. Instead, the
NIC decrypts a packet's payload if the packet contains the expected TCP
sequence number. The TLS record authentication tag remains unmodified
regardless of decryption. If the packet is decrypted successfully and it
contains an authentication tag, then the authentication check has passed.
Otherwise, if the authentication fails, then the packet is provided
unmodified and the KTLS layer is responsible for handling it.
Out-Of-Order TCP packets are provided unmodified. As a result,
in the slow path some of the SKBs are decrypted while others remain as
ciphertext.

The GRO and TCP layers must not coalesce decrypted and non-decrypted SKBs. 
At the worst case a received TLS record consists of both plaintext
and ciphertext packets. These partially decrypted records must be
reencrypted, only to be decrypted.

The notable differences between SW KTLS and NIC offloaded TLS
implementations are as follows:
1. Partial decryption - Software must handle the case of a TLS record
that was only partially decrypted by HW. This can happen due to packet
reordering.
2. Resynchronization - tls_read_size calls the device driver to
resynchronize HW whenever it lost track of the TLS record framing in
the TCP stream.

The infrastructure should be extendable to support various NIC offload
implementations.  However it is currently written with the
implementation below in mind:
The NIC identifies packets that should be offloaded according to
the 5-tuple and the TCP sequence number. If these match and the
packet is decrypted and authenticated successfully, then a syndrome
is provided to software. Otherwise, the packet is unmodified.
Decrypted and non-decrypted packets aren't coalesced by the network stack,
and the KTLS layer decrypts and authenticates partially decrypted records.
The NIC provides an indication whenever a resync is required. The resync
operation is triggered by the KTLS layer while parsing TLS record headers.

Finally, we measure the performance obtained by running single stream
iperf with two Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz machines connected
back-to-back with Innova TLS (40Gbps) NICs. We compare TCP (upper bound)
and KTLS-Offload running both in Tx and Rx. The results show that the
performance of offload is comparable to TCP.

                          | Bandwidth (Gbps) | CPU Tx (%) | CPU rx (%)
TCP                       | 28.8             | 5          | 12
KTLS-Offload-Tx-Rx 	  | 28.6	     | 7          | 14

Paper: https://netdevconf.org/2.2/papers/pismenny-tlscrypto-talk.pdf

Boris Pismenny (18):
  net: Add decrypted field to skb
  net: Add TLS rx resync NDO
  tcp: Don't coalesce decrypted and encrypted SKBs
  tls: Refactor tls_offload variable names
  tls: Split decrypt_skb to two functions
  tls: Split tls_sw_release_resources_rx
  tls: Fill software context without allocation
  tls: Add rx inline crypto offload
  tls: Fix zerocopy_from_iter iov handling
  net/mlx5e: TLS, refactor variable names
  net/mlx5: Accel, add TLS rx offload routines
  net/mlx5e: TLS, add innova rx support
  net/mlx5e: TLS, add Innova TLS rx data path
  net/mlx5e: TLS, add software statistics
  net/mlx5e: TLS, build TLS netdev from capabilities
  net/mlx5: Accel, add common metadata functions
  net/mlx5e: IPsec, fix byte count in CQE
  net/mlx5e: Kconfig, mutually exclude compilation of TLS and IPsec
    accel

Ilya Lesokhin (1):
  net: Add TLS RX offload feature

 drivers/net/ethernet/mellanox/mlx5/core/Kconfig    |   1 +
 .../net/ethernet/mellanox/mlx5/core/accel/accel.h  |  37 +++
 .../net/ethernet/mellanox/mlx5/core/accel/tls.c    |  23 +-
 .../net/ethernet/mellanox/mlx5/core/accel/tls.h    |  26 +-
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c       |  20 +-
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h       |   2 +-
 .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c |  69 +++--
 .../net/ethernet/mellanox/mlx5/core/en_accel/tls.h |  33 ++-
 .../mellanox/mlx5/core/en_accel/tls_rxtx.c         | 117 +++++++-
 .../mellanox/mlx5/core/en_accel/tls_rxtx.h         |   3 +
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |   8 +-
 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c | 113 ++++++--
 drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.h |  18 +-
 include/linux/mlx5/mlx5_ifc_fpga.h                 |   1 +
 include/linux/netdev_features.h                    |   2 +
 include/linux/netdevice.h                          |   2 +
 include/linux/skbuff.h                             |   7 +-
 include/net/tls.h                                  |  82 +++++-
 net/core/ethtool.c                                 |   1 +
 net/core/skbuff.c                                  |   6 +
 net/ipv4/tcp_input.c                               |  12 +
 net/ipv4/tcp_offload.c                             |   3 +
 net/tls/tls_device.c                               | 301 ++++++++++++++++++---
 net/tls/tls_device_fallback.c                      |   9 +-
 net/tls/tls_main.c                                 |  32 ++-
 net/tls/tls_sw.c                                   | 110 +++++---
 26 files changed, 847 insertions(+), 191 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h

-- 
1.8.3.1

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

end of thread, other threads:[~2018-07-13 22:01 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 19:25 [PATCH v4 net-next 00/19] TLS offload rx, netdev & mlx5 Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 01/19] net: Add decrypted field to skb Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 02/19] net: Add TLS RX offload feature Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 03/19] net: Add TLS rx resync NDO Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 04/19] tcp: Don't coalesce decrypted and encrypted SKBs Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 05/19] tls: Refactor tls_offload variable names Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 06/19] tls: Split decrypt_skb to two functions Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 07/19] tls: Split tls_sw_release_resources_rx Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 08/19] tls: Fill software context without allocation Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 09/19] tls: Add rx inline crypto offload Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 10/19] tls: Fix zerocopy_from_iter iov handling Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 11/19] net/mlx5e: TLS, refactor variable names Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 12/19] net/mlx5: Accel, add TLS rx offload routines Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 13/19] net/mlx5e: TLS, add innova rx support Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 14/19] net/mlx5e: TLS, add Innova TLS rx data path Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 15/19] net/mlx5e: TLS, add software statistics Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 16/19] net/mlx5e: TLS, build TLS netdev from capabilities Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 17/19] net/mlx5: Accel, add common metadata functions Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 18/19] net/mlx5e: IPsec, fix byte count in CQE Boris Pismenny
2018-07-12 19:25 ` [PATCH v4 net-next 19/19] net/mlx5e: Kconfig, mutually exclude compilation of TLS and IPsec accel Boris Pismenny
2018-07-13  0:44   ` David Miller
2018-07-13 20:03     ` Boris Pismenny
2018-07-13 21:44       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.