diff options
author | Andrew Gallatin <gallatin@FreeBSD.org> | 2021-07-06 14:17:33 +0000 |
---|---|---|
committer | Andrew Gallatin <gallatin@FreeBSD.org> | 2021-07-06 14:28:32 +0000 |
commit | 28d0a740dd9a67e4a4fa9fda5bb39b5963316f35 (patch) | |
tree | 20f30d10ba70a01a4a37a50617d92a8570062394 /sys/sys | |
parent | c9144ec14d2a5a53cfe91ada1b3b9c06b78dc999 (diff) | |
download | src-28d0a740dd9a67e4a4fa9fda5bb39b5963316f35.tar.gz src-28d0a740dd9a67e4a4fa9fda5bb39b5963316f35.zip |
ktls: auto-disable ifnet (inline hw) kTLS
Ifnet (inline) hw kTLS NICs typically keep state within
a TLS record, so that when transmitting in-order,
they can continue encryption on each segment sent without
DMA'ing extra state from the host.
This breaks down when transmits are out of order (eg,
TCP retransmits). In this case, the NIC must re-DMA
the entire TLS record up to and including the segment
being retransmitted. This means that when re-transmitting
the last 1448 byte segment of a TLS record, the NIC will
have to re-DMA the entire 16KB TLS record. This can lead
to the NIC running out of PCIe bus bandwidth well before
it saturates the network link if a lot of TCP connections have
a high retransmoit rate.
This change introduces a new sysctl (kern.ipc.tls.ifnet_max_rexmit_pct),
where TCP connections with higher retransmit rate will be
switched to SW kTLS so as to conserve PCIe bandwidth.
Reviewed by: hselasky, markj, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30908
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/ktls.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index b28c94965c97..7fd8831878b4 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -189,10 +189,12 @@ struct ktls_session { u_int wq_index; volatile u_int refcount; int mode; - bool reset_pending; struct task reset_tag_task; + struct task disable_ifnet_task; struct inpcb *inp; + bool reset_pending; + bool disable_ifnet_pending; } __aligned(CACHE_LINE_SIZE); void ktls_check_rx(struct sockbuf *sb); @@ -231,5 +233,16 @@ ktls_free(struct ktls_session *tls) ktls_destroy(tls); } +#ifdef KERN_TLS +extern unsigned int ktls_ifnet_max_rexmit_pct; +void ktls_disable_ifnet(void *arg); +#else +#define ktls_ifnet_max_rexmit_pct 1 +inline void +ktls_disable_ifnet(void *arg __unused) +{ +} +#endif + #endif /* !_KERNEL */ #endif /* !_SYS_KTLS_H_ */ |