Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto API scatterwalk copy #58

Open
djwatson opened this issue Jul 5, 2016 · 2 comments
Open

Crypto API scatterwalk copy #58

djwatson opened this issue Jul 5, 2016 · 2 comments

Comments

@djwatson
Copy link
Member

djwatson commented Jul 5, 2016

The crypto API expects data to be contiguous in memory. This means that even though it supports a scatter/gather buffer interface, under the covers it does a copy to make everything contiguous. This makes sense in some ways: the AESNI routines need data aligned on certain byte boundaries to be most efficient.

For af_ktls however, the header aad data and hash are currently never contiguous. We should either make all the af_ktls data contiguous if possible, or modify the crypto API to accept portions of data that aren't contiguous where it doesn't matter.

Attached was my work in progress diff to modify the crypto API to avoid the copies if possible.

nocopy_crypto.txt

@fridex
Copy link
Member

fridex commented Jul 6, 2016

Thank you for the patch. In my opinion it should worth to support both:

  • make rfc4106 copyless since it affects performance when sending records that are bigger than PAGE_SIZE - this is reasonable especially for TLS
  • avoid preallocation of pages in AF_KTLS and allocate them lazily (with space for header, tag or seq nums), since we want to pass them to kernel_sendpage() - this would cause that the header, AAD, tag would be continuous.

@djwatson
Copy link
Member Author

djwatson commented Oct 5, 2016

Feedback from netdev1.2:

Should update gcm/aes crypto to support full scatter/gather, and support routines to copy directly to/from userspace. This would make mmap + send() just as fast as sendfile, while supporting more applications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants