Skip to content

tls: rx: avoid skb_cow_data()

Jakub Kicinski netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 4 repliesApplied 11/11
  2. v111 patches 0 repliesSuperseded

Patches in v2 All 11 applied

#Subject and filesSizeRepliesApplied
1/11tls: rx: allow only one reader at a timeinclude/net/tls.h net/tls/tls_sw.c+57 -74 repliesApplied
2/11tls: rx: don't try to keep the skbs always on the listnet/tls/tls_sw.c+12 -110 repliesApplied
3/11tls: rx: don't keep decrypted skbs on ctx->recv_pktnet/tls/tls_sw.c+28 -210 repliesApplied
4/11tls: rx: remove the message decrypted trackinginclude/net/strparser.h net/tls/tls_sw.c+0 -110 repliesApplied
5/11tls: rx: factor out device darg updatenet/tls/tls_sw.c+41 -190 repliesApplied
6/11tls: rx: read the input skb from ctx->recv_pktnet/tls/tls.h net/tls/tls_device.c net/tls/tls_sw.c+42 -340 repliesApplied
7/11tls: rx: return the decrypted skb via dargnet/tls/tls_sw.c+39 -100 repliesApplied
8/11tls: rx: async: adjust record geometry immediatelynet/tls/tls_sw.c+10 -390 repliesApplied
9/11tls: rx: async: hold onto the input skbinclude/net/tls.h net/tls/Makefile net/tls/tls.h +2 more+39 -100 repliesApplied
10/11tls: rx: async: don't put async zc on the listnet/tls/tls_sw.c+19 -210 repliesApplied
11/11tls: rx: decrypt into a fresh skbnet/tls/tls.h net/tls/tls_sw.c+72 -370 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net-next v2 00/11] tls: rx: avoid skb_cow_data()

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.

v2: rebase after 3d8c51b25a23 ("net/tls: Check for errors in tls_device_init")

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
Signature · 1 line
2.36.1