]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit37c2526e223d3b608b55bf336dcd3437715caf60
treed3c53a4093eb61d366bb5b796e4f829cd8768e06
parent73b3e51af94cbfd40f65b972eccea77eed661b1f
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