Skip to content

net/crypto: Introduce crypto_pool

Dmitry Safonov linux-crypto lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6crypto: Introduce crypto_poolcrypto/Kconfig crypto/Makefile crypto/crypto_pool.c +1 more+328 -00 replies
2/6crypto_pool: Add crypto_pool_reserve_scratch()crypto/Kconfig crypto/crypto_pool.c include/crypto/pool.h+54 -200 replies
3/6net/tcp: Separate tcp_md5sig_info allocation into tcp_md5sig_info_add()net/ipv4/tcp_ipv4.c+21 -90 replies
4/6net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destructioninclude/net/tcp.h net/ipv4/tcp.c net/ipv4/tcp_ipv4.c +3 more+55 -280 replies
5/6net/tcp: Use crypto_pool for TCP-MD5include/net/tcp.h net/ipv4/Kconfig net/ipv4/tcp.c +3 more+127 -1610 replies
6/6net/ipv6: sr: Switch to using crypto_poolinclude/net/seg6_hmac.h net/ipv6/Kconfig net/ipv6/seg6.c +1 more+80 -1363 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] net/crypto: Introduce crypto_pool

Add crypto_pool - an API for allocating per-CPU array of crypto requests on slow-path (in sleep'able context) and to use them on a fast-path, which is RX/TX for net/ users (or in any other bh-disabled users). The design is based on the current implementations of md5sig_pool.

Previously, I've suggested to add such API on TCP-AO patch submission [1], where Herbert kindly suggested to help with introducing new crypto API.

New API will allow:
- to reuse per-CPU ahash_request(s) for different users
- to allocate only one per-CPU scratch buffer rather than a new one for each user
- to have a common API for net/ users that need ahash on RX/TX fast path

In this version I've wired up TCP-MD5 and IPv6-SR-HMAC as users. Potentially, xfrm_ipcomp and xfrm_ah can be converted as well. The initial reason for patches would be to have TCP-AO as a user, which would let it share per-CPU crypto_request for any supported hashing algorithm.

While at it, I've also made TCP-MD5 static key dynamically switchable. This means that after TCP-MD5 was used and the last key got destroyed, the static branch is disabled and any potential penalty for checking tcp_md5sig_info is gone, and the system's tcp performance should be as if it never had TCP-MD5 key defined.

[1]: http://lkml.kernel.org/r/[email protected]

Cc Andy Lutomirski <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc David Ahern <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Francesco Ruggeri <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Hideaki YOSHIFUJI <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Leonard Crestez <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Salam Noureddine <[email protected]>

Dmitry Safonov (6):
crypto: Introduce crypto_pool
crypto_pool: Add crypto_pool_reserve_scratch() net/tcp: Separate tcp_md5sig_info allocation into

    tcp_md5sig_info_add()

net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction net/tcp: Use crypto_pool for TCP-MD5
net/ipv6: sr: Switch to using crypto_pool

 crypto/Kconfig           |  12 ++
 crypto/Makefile          |   1 +
 crypto/crypto_pool.c     | 316 +++++++++++++++++++++++++++++++++++++++
 include/crypto/pool.h    |  33 ++++
 include/net/seg6_hmac.h  |   7 -
 include/net/tcp.h        |  32 ++--
 net/ipv4/Kconfig         |   2 +-
 net/ipv4/tcp.c           | 102 ++++---------
 net/ipv4/tcp_ipv4.c      | 153 ++++++++++++-------
 net/ipv4/tcp_minisocks.c |  23 ++-
 net/ipv4/tcp_output.c    |   4 +-
 net/ipv6/Kconfig         |   2 +-
 net/ipv6/seg6.c          |   3 -
 net/ipv6/seg6_hmac.c     | 204 ++++++++++---------------
 net/ipv6/tcp_ipv6.c      |  63 ++++----
 15 files changed, 634 insertions(+), 323 deletions(-)
 create mode 100644 crypto/crypto_pool.c
 create mode 100644 include/crypto/pool.h

base-commit: 058affafc65a74cf54499fb578b66ad0b18f939b

Signature · 1 line
2.36.1