diff options
author | John Baldwin <jhb@FreeBSD.org> | 2021-05-25 23:59:18 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2021-05-25 23:59:18 +0000 |
commit | 883a0196b629a07e52562b4103cc0f6391083080 (patch) | |
tree | 86857200a26874cab76cb3e620c598fa253efded /sys/opencrypto/cryptodev.h | |
parent | 6663f8a23e7cb60d798c5ffbd9c716b62b204f2a (diff) | |
download | src-883a0196b629a07e52562b4103cc0f6391083080.tar.gz src-883a0196b629a07e52562b4103cc0f6391083080.zip |
crypto: Add a new type of crypto buffer for a single mbuf.
This is intended for use in KTLS transmit where each TLS record is
described by a single mbuf that is itself queued in the socket buffer.
Using the existing CRYPTO_BUF_MBUF would result in
bus_dmamap_load_crp() walking additional mbufs in the socket buffer
that are not relevant, but generating a S/G list that potentially
exceeds the limit of the tag (while also wasting CPU cycles).
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30136
Diffstat (limited to 'sys/opencrypto/cryptodev.h')
-rw-r--r-- | sys/opencrypto/cryptodev.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 862ad1d4f6e5..1adc81f2e4d3 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -354,7 +354,8 @@ enum crypto_buffer_type { CRYPTO_BUF_UIO, CRYPTO_BUF_MBUF, CRYPTO_BUF_VMPAGE, - CRYPTO_BUF_LAST = CRYPTO_BUF_VMPAGE + CRYPTO_BUF_SINGLE_MBUF, + CRYPTO_BUF_LAST = CRYPTO_BUF_SINGLE_MBUF }; /* @@ -481,6 +482,13 @@ _crypto_use_mbuf(struct crypto_buffer *cb, struct mbuf *m) } static __inline void +_crypto_use_single_mbuf(struct crypto_buffer *cb, struct mbuf *m) +{ + cb->cb_mbuf = m; + cb->cb_type = CRYPTO_BUF_SINGLE_MBUF; +} + +static __inline void _crypto_use_vmpage(struct crypto_buffer *cb, vm_page_t *pages, int len, int offset) { @@ -510,6 +518,12 @@ crypto_use_mbuf(struct cryptop *crp, struct mbuf *m) } static __inline void +crypto_use_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_buf, m); +} + +static __inline void crypto_use_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) { _crypto_use_vmpage(&crp->crp_buf, pages, len, offset); @@ -534,6 +548,12 @@ crypto_use_output_mbuf(struct cryptop *crp, struct mbuf *m) } static __inline void +crypto_use_output_single_mbuf(struct cryptop *crp, struct mbuf *m) +{ + _crypto_use_single_mbuf(&crp->crp_obuf, m); +} + +static __inline void crypto_use_output_vmpage(struct cryptop *crp, vm_page_t *pages, int len, int offset) { |