From: Boris Pismenny <borisp@mellanox.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, davejwatson@fb.com, aviadye@mellanox.com,
borisp@mellanox.com, saeedm@mellanox.com
Subject: [PATCH v5 net-next 00/18] TLS offload rx, netdev & mlx5
Date: Fri, 13 Jul 2018 14:33:34 +0300 [thread overview]
Message-ID: <1531481632-12335-1-git-send-email-borisp@mellanox.com> (raw)
Hi,
The following series provides TLS RX inline crypto offload.
v5->v4:
- Remove the Kconfig to mutually exclude both IPsec and TLS
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 (17):
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
Ilya Lesokhin (1):
net: Add TLS RX offload feature
.../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 +++++---
25 files changed, 846 insertions(+), 191 deletions(-)
create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/accel/accel.h
--
1.8.3.1
next reply other threads:[~2018-07-13 11:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 11:33 Boris Pismenny [this message]
2018-07-13 11:33 ` [PATCH v5 net-next 01/18] net: Add decrypted field to skb Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 02/18] net: Add TLS RX offload feature Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 03/18] net: Add TLS rx resync NDO Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 04/18] tcp: Don't coalesce decrypted and encrypted SKBs Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 05/18] tls: Refactor tls_offload variable names Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 06/18] tls: Split decrypt_skb to two functions Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 07/18] tls: Split tls_sw_release_resources_rx Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 08/18] tls: Fill software context without allocation Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 09/18] tls: Add rx inline crypto offload Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 10/18] tls: Fix zerocopy_from_iter iov handling Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 11/18] net/mlx5e: TLS, refactor variable names Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 12/18] net/mlx5: Accel, add TLS rx offload routines Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 13/18] net/mlx5e: TLS, add innova rx support Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 14/18] net/mlx5e: TLS, add Innova TLS rx data path Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 15/18] net/mlx5e: TLS, add software statistics Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 16/18] net/mlx5e: TLS, build TLS netdev from capabilities Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 17/18] net/mlx5: Accel, add common metadata functions Boris Pismenny
2018-07-13 11:33 ` [PATCH v5 net-next 18/18] net/mlx5e: IPsec, fix byte count in CQE Boris Pismenny
2018-07-16 7:17 ` [PATCH v5 net-next 00/18] TLS offload rx, netdev & mlx5 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1531481632-12335-1-git-send-email-borisp@mellanox.com \
--to=borisp@mellanox.com \
--cc=aviadye@mellanox.com \
--cc=davejwatson@fb.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).