Skip to content

crypto: scatterlist handling improvements

Eric Biggers linux-crypto linux-s390 linux-samsung-soc linuxppc-dev lkml netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/219 patches 7 repliesIn review
  2. v3 posting 1/28 patches 3 repliesSuperseded
  3. v229 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v129 patches9 repliesSuperseded

Changes in v3 from the cover letter

- Dropped patches that were upstreamed.
- Added a Reviewed-by and Tested-by.

Patches in v3 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19crypto: scatterwalk - move to next sg entry just in timeinclude/crypto/scatterwalk.h+10 -90 replies
2/19crypto: scatterwalk - add new functions for skipping datacrypto/scatterwalk.c include/crypto/scatterwalk.h+33 -00 replies
3/19crypto: scatterwalk - add new functions for iterating through datainclude/crypto/scatterwalk.h+63 -63 replies
4/19crypto: scatterwalk - add new functions for copying datacrypto/scatterwalk.c include/crypto/scatterwalk.h+72 -113 replies
5/19crypto: scatterwalk - add scatterwalk_get_sglist()include/crypto/scatterwalk.h+17 -00 replies
6/19crypto: skcipher - use scatterwalk_start_at_pos()crypto/skcipher.c+2 -80 replies
7/19crypto: aegis - use the new scatterwalk functionscrypto/aegis128-core.c+4 -60 replies
8/19crypto: arm/ghash - use the new scatterwalk functionsarch/arm/crypto/ghash-ce-glue.c+4 -110 replies
9/19crypto: arm64 - use the new scatterwalk functionsarch/arm64/crypto/aes-ce-ccm-glue.c arch/arm64/crypto/ghash-ce-glue.c arch/arm64/crypto/sm4-ce-ccm-glue.c +1 more+32 -590 replies
10/19crypto: nx - use the new scatterwalk functionsdrivers/crypto/nx/nx-aes-ccm.c drivers/crypto/nx/nx-aes-gcm.c drivers/crypto/nx/nx.c +1 more+17 -500 replies
11/19crypto: s390/aes-gcm - use the new scatterwalk functionsarch/s390/crypto/aes_s390.c+13 -200 replies
12/19crypto: s5p-sss - use the new scatterwalk functionsdrivers/crypto/s5p-sss.c+11 -270 replies
13/19crypto: stm32 - use the new scatterwalk functionsdrivers/crypto/stm32/stm32-cryp.c+17 -170 replies
14/19crypto: x86/aes-gcm - use the new scatterwalk functionsarch/x86/crypto/aesni-intel_glue.c+14 -140 replies
15/19crypto: x86/aegis - use the new scatterwalk functionsarch/x86/crypto/aegis128-aesni-glue.c+4 -60 replies
16/19net/tls: use the new scatterwalk functionsnet/tls/tls_device_fallback.c+6 -250 replies
17/19crypto: skcipher - use the new scatterwalk functionscrypto/skcipher.c+19 -320 replies
18/19crypto: scatterwalk - remove obsolete functionscrypto/scatterwalk.c include/crypto/scatterwalk.h+0 -620 replies
19/19crypto: scatterwalk - don't split at page boundaries when !HIGHMEMcrypto/skcipher.c include/crypto/scatterwalk.h+59 -240 replies

Reviews trailers per patch

1 of 19 patches has a Reviewed-by or Acked-by.

PatchHarald Freudenberger
1/19
2/19
3/19
4/19
5/19
6/19
7/19
8/19
9/19
10/19
11/19R-b T-b
12/19
13/19
14/19
15/19
16/19
17/19
18/19
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/19] crypto: scatterlist handling improvements

This series can also be retrieved from:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crypto-scatterlist-v3

This series cleans up and optimizes the code that translates between scatterlists (the input to the API) and virtual addresses (what software implementations operate on) for skcipher and aead algorithms.

This takes the form of cleanups and optimizations to the skcipher_walk functions and a rework of the underlying scatter_walk functions.

The unnecessary use of scatterlists still remains a huge pain point of many of the crypto APIs, with the exception of lib/crypto/, shash, and scomp which do it properly. But this series at least reduces (but not eliminates) the impact on performance that the scatterlists have.

An an example, this patchset improves IPsec throughput by about 5%, as measured using iperf3 bidirectional TCP between two c3d-standard-4 (AMD Genoa) instances in Google Compute Engine using transport mode IPsec with AES-256-GCM.

This series is organized as follows:

- Patch 1-5 improve scatter_walk, introducing easier-to-use functions and optimizing performance in some cases.
- Patch 6-17 convert users to use the new functions.
- Patch 18 removes functions that are no longer needed.
- Patch 19 optimizes the walker on !HIGHMEM platforms to start returning data segments that can cross a page boundary. This can significantly improve performance in cases where messages can cross pages, such as IPsec. Previously there was a large overhead caused by packets being unnecessarily divided into multiple parts by the walker, including hitting skcipher_next_slow() which uses a single-block bounce buffer.

Changed in v3:
- Dropped patches that were upstreamed.
- Added a Reviewed-by and Tested-by.

Changed in v2:
- Added comment to scatterwalk_done_dst().
- Added scatterwalk_get_sglist() and use it in net/tls/.
- Dropped the keywrap patch, as keywrap is being removed by
https://lore.kernel.org/r/[email protected]

Eric Biggers (19):
crypto: scatterwalk - move to next sg entry just in time
crypto: scatterwalk - add new functions for skipping data
crypto: scatterwalk - add new functions for iterating through data
crypto: scatterwalk - add new functions for copying data
crypto: scatterwalk - add scatterwalk_get_sglist()
crypto: skcipher - use scatterwalk_start_at_pos()
crypto: aegis - use the new scatterwalk functions
crypto: arm/ghash - use the new scatterwalk functions
crypto: arm64 - use the new scatterwalk functions
crypto: nx - use the new scatterwalk functions
crypto: s390/aes-gcm - use the new scatterwalk functions
crypto: s5p-sss - use the new scatterwalk functions
crypto: stm32 - use the new scatterwalk functions
crypto: x86/aes-gcm - use the new scatterwalk functions
crypto: x86/aegis - use the new scatterwalk functions net/tls: use the new scatterwalk functions
crypto: skcipher - use the new scatterwalk functions
crypto: scatterwalk - remove obsolete functions
crypto: scatterwalk - don't split at page boundaries when !HIGHMEM

 arch/arm/crypto/ghash-ce-glue.c       |  15 +-
 arch/arm64/crypto/aes-ce-ccm-glue.c   |  17 +--
 arch/arm64/crypto/ghash-ce-glue.c     |  16 +-
 arch/arm64/crypto/sm4-ce-ccm-glue.c   |  27 ++--
 arch/arm64/crypto/sm4-ce-gcm-glue.c   |  31 ++--
 arch/s390/crypto/aes_s390.c           |  33 ++---
 arch/x86/crypto/aegis128-aesni-glue.c |  10 +-
 arch/x86/crypto/aesni-intel_glue.c    |  28 ++--
 crypto/aegis128-core.c                |  10 +-
 crypto/scatterwalk.c                  |  91 +++++++-----
 crypto/skcipher.c                     |  65 +++------
 drivers/crypto/nx/nx-aes-ccm.c        |  16 +-
 drivers/crypto/nx/nx-aes-gcm.c        |  17 +--
 drivers/crypto/nx/nx.c                |  31 +---
 drivers/crypto/nx/nx.h                |   3 -
 drivers/crypto/s5p-sss.c              |  38 ++---
 drivers/crypto/stm32/stm32-cryp.c     |  34 ++---
 include/crypto/scatterwalk.h          | 203 +++++++++++++++++++++-----
 net/tls/tls_device_fallback.c         |  31 +---
 19 files changed, 363 insertions(+), 353 deletions(-)

base-commit: c346fef6fef53fa57ff323b701e7bad82290d0e7

Signature · 1 line
2.48.1