From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
borisp@nvidia.com, john.fastabend@gmail.com, maximmi@nvidia.com,
tariqt@nvidia.com, vfedorenko@novek.ru,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 00/11] tls: rx: avoid skb_cow_data()
Date: Wed, 13 Jul 2022 20:32:59 -0700 [thread overview]
Message-ID: <20220714033310.1273288-1-kuba@kernel.org> (raw)
TLS calls skb_cow_data() on the skb it received from strparser
whenever it needs to hold onto the skb with the decrypted data.
(The alternative being decrypting directly to a user space buffer
in whic case the input skb doesn't get modified or used after.)
TLS needs the decrypted skb:
- almost always with TLS 1.3 (unless the new NoPad is enabled);
- when user space buffer is too small to fit the record;
- when BPF sockmap is enabled.
Most of the time the skb we get out of strparser is a clone of
a 64kB data unit coalsced by GRO. To make things worse skb_cow_data()
tries to output a linear skb and allocates it with GFP_ATOMIC.
This occasionally fails even under moderate memory pressure.
This patch set rejigs the TLS Rx so that we don't expect decryption
in place. The decryption handlers return an skb which may or may not
be the skb from strparser. For TLS 1.3 this results in a 20-30%
performance improvement without NoPad enabled.
Jakub Kicinski (11):
tls: rx: allow only one reader at a time
tls: rx: don't try to keep the skbs always on the list
tls: rx: don't keep decrypted skbs on ctx->recv_pkt
tls: rx: remove the message decrypted tracking
tls: rx: factor out device darg update
tls: rx: read the input skb from ctx->recv_pkt
tls: rx: return the decrypted skb via darg
tls: rx: async: adjust record geometry immediately
tls: rx: async: hold onto the input skb
tls: rx: async: don't put async zc on the list
tls: rx: decrypt into a fresh skb
include/net/strparser.h | 1 -
include/net/tls.h | 4 +
net/tls/Makefile | 2 +-
net/tls/tls.h | 20 +-
net/tls/tls_device.c | 25 ++-
net/tls/tls_strp.c | 17 ++
net/tls/tls_sw.c | 458 ++++++++++++++++++++++++----------------
7 files changed, 333 insertions(+), 194 deletions(-)
create mode 100644 net/tls/tls_strp.c
--
2.36.1
next reply other threads:[~2022-07-14 3:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 3:32 Jakub Kicinski [this message]
2022-07-14 3:33 ` [PATCH net-next 01/11] tls: rx: allow only one reader at a time Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 02/11] tls: rx: don't try to keep the skbs always on the list Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 03/11] tls: rx: don't keep decrypted skbs on ctx->recv_pkt Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 04/11] tls: rx: remove the message decrypted tracking Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 05/11] tls: rx: factor out device darg update Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 06/11] tls: rx: read the input skb from ctx->recv_pkt Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 07/11] tls: rx: return the decrypted skb via darg Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 08/11] tls: rx: async: adjust record geometry immediately Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 09/11] tls: rx: async: hold onto the input skb Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 10/11] tls: rx: async: don't put async zc on the list Jakub Kicinski
2022-07-14 3:33 ` [PATCH net-next 11/11] tls: rx: decrypt into a fresh skb Jakub Kicinski
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=20220714033310.1273288-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john.fastabend@gmail.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tariqt@nvidia.com \
--cc=vfedorenko@novek.ru \
/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).