tls: rx: do not use the standard strparser
authorJakub Kicinski <kuba@kernel.org>
Fri, 22 Jul 2022 23:50:33 +0000 (16:50 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 26 Jul 2022 21:38:51 +0000 (14:38 -0700)
commit84c61fe1a75b4255df1e1e7c054c9e6d048da417
treed3c53a4093eb61d366bb5b796e4f829cd8768e06
parent8b3c59a7a0bed6fe365755ac211dcf94fdac81b4
tls: rx: do not use the standard strparser

TLS is a relatively poor fit for strparser. We pause the input
every time a message is received, wait for a read which will
decrypt the message, start the parser, repeat. strparser is
built to delineate the messages, wrap them in individual skbs
and let them float off into the stack or a different socket.
TLS wants the data pages and nothing else. There's no need
for TLS to keep cloning (and occasionally skb_unclone()'ing)
the TCP rx queue.

This patch uses a pre-allocated skb and attaches the skbs
from the TCP rx queue to it as frags. TLS is careful never
to modify the input skb without CoW'ing / detaching it first.

Since we call TCP rx queue cleanup directly we also get back
the benefit of skb deferred free.

Overall this results in a 6% gain in my benchmarks.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/tls.h
net/tls/tls.h
net/tls/tls_main.c
net/tls/tls_strp.c
net/tls/tls_sw.c