diff options
| author | David S. Miller <davem@davemloft.net> | 2022-07-18 13:24:11 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2022-07-18 13:24:11 +0300 |
| commit | fd18d5f132bfcdb67a82b477ea9ddc6df6e6ce73 (patch) | |
| tree | 9f364a6ce7ecb7b5b94daba90002b6cfee8dc4c8 /include | |
| parent | 3898f52cd4f92a007d71a52edf70aafc7c8ae193 (diff) | |
| parent | fd31f3996af2627106e22a9f8072764fede51161 (diff) | |
| download | linux-fd18d5f132bfcdb67a82b477ea9ddc6df6e6ce73.tar.xz | |
Merge branch 'tls-rx-avoid-skb_cow_data'
Jakub Kicinski says:
====================
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")
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/strparser.h | 1 | ||||
| -rw-r--r-- | include/net/tls.h | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/net/strparser.h b/include/net/strparser.h index 88900b05443e..41e2ce9e9e10 100644 --- a/include/net/strparser.h +++ b/include/net/strparser.h @@ -72,7 +72,6 @@ struct sk_skb_cb { /* strp users' data follows */ struct tls_msg { u8 control; - u8 decrypted; } tls; /* temp_reg is a temporary register used for bpf_convert_data_end_access * when dst_reg == src_reg. diff --git a/include/net/tls.h b/include/net/tls.h index 8742e13bc362..181c496b01b8 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -116,11 +116,15 @@ struct tls_sw_context_rx { void (*saved_data_ready)(struct sock *sk); struct sk_buff *recv_pkt; + u8 reader_present; u8 async_capable:1; u8 zc_capable:1; + u8 reader_contended:1; atomic_t decrypt_pending; /* protect crypto_wait with decrypt_pending*/ spinlock_t decrypt_compl_lock; + struct sk_buff_head async_hold; + struct wait_queue_head wq; }; struct tls_record_info { |
