]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cxgbe: Enable TOE TLS RX when an RX key is provided via setsockopt().
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 15 Nov 2022 20:08:51 +0000 (12:08 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 15 Nov 2022 20:08:51 +0000 (12:08 -0800)
commit2ff447ee3b6c94a664d7604fb7b5334a702fb79e
treef851224ef1633c08bdbfdcbc3a681545892dad8a
parent21186bdb2d6a14dbfff7b4366425285b8612cc22
cxgbe: Enable TOE TLS RX when an RX key is provided via setsockopt().

Rather than requiring a socket to be created as a TLS socket from the
get go, switch a TOE socket from "plain" TOE to TLS mode when a
receive key is added to the socket.

The firmware is only able to switch a "plain" TOE connection to TLS
mode if the head of the pending socket data is the start of a TLS
record, so the connection is migrated to TLS mode as a multi-step
process.

When TOE TLS RX is enabled, the associated connection's receive side
is frozen via a flag in the TCB.  The state of the socket buffer is
then examined to determine if the pending data in the socket buffer
ends on a TLS record boundary.  If so, the connection is migrated to
TLS mode and unfrozen.  Otherwise, the connection is unfrozen
temporarily until more data arrives.  Once more data arrives, the
receive queue is frozen again and rechecked.  This continues until the
connection is paused at a record boundary.  Any records received
before TLS mode is enabled are decrypted as software records.

Note that this removes the 'rx_tls_ports' sysctl.  TOE TLS offload for
receive is now enabled automatically on existing TOE connections when
using a KTLS-aware SSL library just as it was previously enabled
automatically for TLS transmit.  This also enables TLS offload for TOE
connections which enable TLS after passing initial data in the clear
(e.g. STARTTLS with SMTP).

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37351
sys/dev/cxgbe/offload.h
sys/dev/cxgbe/t4_main.c
sys/dev/cxgbe/tom/t4_cpl_io.c
sys/dev/cxgbe/tom/t4_tls.c
sys/dev/cxgbe/tom/t4_tls.h
sys/dev/cxgbe/tom/t4_tom.c
sys/dev/cxgbe/tom/t4_tom.h