freebsd-nq/sys/opencrypto
John Baldwin 470e851c4b ktls: Support asynchronous dispatch of AEAD ciphers.
KTLS OCF support was originally targeted at software backends that
used host CPU cycles to encrypt TLS records.  As a result, each KTLS
worker thread queued a single TLS record at a time and waited for it
to be encrypted before processing another TLS record.  This works well
for software backends but limits throughput on OCF drivers for
coprocessors that support asynchronous operation such as qat(4) or
ccr(4).  This change uses an alternate function (ktls_encrypt_async)
when encrypt TLS records via a coprocessor.  This function queues TLS
records for encryption and returns.  It defers the work done after a
TLS record has been encrypted (such as marking the mbufs ready) to a
callback invoked asynchronously by the coprocessor driver when a
record has been encrypted.

- Add a struct ktls_ocf_state that holds the per-request state stored
  on the stack for synchronous requests.  Asynchronous requests malloc
  this structure while synchronous requests continue to allocate this
  structure on the stack.

- Add a ktls_encrypt_async() variant of ktls_encrypt() which does not
  perform request completion after dispatching a request to OCF.
  Instead, the ktls_ocf backends invoke ktls_encrypt_cb() when a TLS
  record request completes for an asynchronous request.

- Flag AEAD software TLS sessions as async if the backend driver
  selected by OCF is an async driver.

- Pull code to create and dispatch an OCF request out of
  ktls_encrypt() into a new ktls_encrypt_one() function used by both
  ktls_encrypt() and ktls_encrypt_async().

- Pull code to "finish" the VM page shuffling for a file-backed TLS
  record into a helper function ktls_finish_noanon() used by both
  ktls_encrypt() and ktls_encrypt_cb().

Reviewed by:	markj
Tested on:	ccr(4) (jhb), qat(4) (markj)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D31665
2021-08-30 13:11:52 -07:00
..
_cryptodev.h
cbc_mac.c
cbc_mac.h
criov.c crypto: Remove now-unused crypto_cursor_seg{base,len}. 2021-06-16 15:23:16 -07:00
crypto.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
cryptodeflate.c Replace some K&R function definitions with ANSI C. 2020-11-03 22:32:30 +00:00
cryptodev_if.m OCF: Remove support for asymmetric cryptographic operations. 2021-04-12 14:28:43 -07:00
cryptodev.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
cryptodev.h crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
cryptosoft.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
deflate.h Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
gfmult.c Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
gfmult.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
gmac.c Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
gmac.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
ktls_ocf.c ktls: Support asynchronous dispatch of AEAD ciphers. 2021-08-30 13:11:52 -07:00
ktls.h ktls: Support asynchronous dispatch of AEAD ciphers. 2021-08-30 13:11:52 -07:00
rmd160.c Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
rmd160.h Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
xform_aes_icm.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_aes_xts.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_auth.h crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_cbc_mac.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_chacha20_poly1305.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_cml.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_comp.h crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_deflate.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_enc.h crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_gmac.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_null.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_poly1305.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_rijndael.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_rmd160.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_sha1.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform_sha2.c crypto: Constify all transform descriptors 2021-07-26 16:41:05 -04:00
xform.c
xform.h