HomeFreeBSD

MFC r342024 (by mmacy): Generalize AES iov optimization

Description

MFC r342024 (by mmacy): Generalize AES iov optimization

Right now, aesni_cipher_alloc does a bit of special-casing
for CRYPTO_F_IOV, to not do any allocation if the first uio
is large enough for the requested size. While working on ZFS
crypto port, I ran into horrible performance because the code
uses scatter-gather, and many of the times the data to encrypt
was in the second entry. This code looks through the list, and
tries to see if there is a single uio that can contain the
requested data, and, if so, uses that.

This has a slight impact on the current consumers, in that the
check is a little more complicated for the ones that use
CRYPTO_F_IOV -- but none of them meet the criteria for testing
more than one.

Details

Provenance
mavAuthored on
Parents
rS352233: buf: Add B_INVALONERR flag to discard data
Branches
Unknown
Tags
Unknown