From: Dmitry Safonov <dima@arista.com>
To: linux-kernel@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>
Cc: Dmitry Safonov <dima@arista.com>,
Andy Lutomirski <luto@amacapital.net>,
Bob Gilligan <gilligan@arista.com>,
Dmitry Safonov <0x7f454c46@gmail.com>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Leonard Crestez <cdleonard@gmail.com>,
Paolo Abeni <pabeni@redhat.com>,
Salam Noureddine <noureddine@arista.com>,
netdev@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: [PATCH v2 0/5] net/crypto: Introduce crypto_pool
Date: Tue, 3 Jan 2023 18:42:52 +0000 [thread overview]
Message-ID: <20230103184257.118069-1-dima@arista.com> (raw)
Changes since v1 [1]:
- Patches went through 3 iterations inside bigger TCP-AO patch set [2],
now I'm splitting it apart and sending it once again as a stand-alone
patch set to help reviewing it and make it easier to merge.
It is second part of that big series, once it merges the next part
will be TCP changes to add Authentication Option support (RFC5925),
that use API provided by these patches.
- Corrected kerneldoc-style comment near crypto_pool_reserve_scratch()
(Reported-By: kernel test robot <lkp@intel.com>)
- Added short Documentation/ page for crypto_pool API
Add crypto_pool - an API for allocating per-CPU array of crypto requests
on slow-path (in sleep'able contexts) and for using them on a fast-path,
which is RX/TX for net/* users.
The design is based on the current implementations of md5sig_pool, which
this patch set makes generic by separating it from TCP core, moving it
to crypto/ and adding support for other hashing algorithms than MD5.
It makes a generic implementation for a common net/ pattern.
The initial motivation to have this API is TCP-AO, that's going to use
the very same pattern as TCP-MD5, but for multiple hashing algorithms.
Previously, I've suggested to add such API on TCP-AO patch submission [3],
where Herbert kindly suggested to help with introducing new crypto API.
See also discussion and motivation in crypto_pool-v1 [4].
The 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.
[1]: https://lore.kernel.org/all/20220726201600.1715505-1-dima@arista.com/
[2]: https://lore.kernel.org/all/20221027204347.529913-1-dima@arista.com/T/#u
[3]: http://lkml.kernel.org/r/20211106034334.GA18577@gondor.apana.org.au
[4]: https://lore.kernel.org/all/26d5955b-3807-a015-d259-ccc262f665c2@arista.com/T/#u
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Bob Gilligan <gilligan@arista.com>
Cc: David Ahern <dsahern@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Leonard Crestez <cdleonard@gmail.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Salam Noureddine <noureddine@arista.com>
Cc: netdev@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Dmitry Safonov (5):
crypto: Introduce crypto_pool
crypto/pool: Add crypto_pool_reserve_scratch()
crypto/net/tcp: Use crypto_pool for TCP-MD5
crypto/net/ipv6: sr: Switch to using crypto_pool
crypto/Documentation: Add crypto_pool kernel API
Documentation/crypto/crypto_pool.rst | 33 +++
crypto/Kconfig | 12 +
crypto/Makefile | 1 +
crypto/crypto_pool.c | 338 +++++++++++++++++++++++++++
include/crypto/pool.h | 33 +++
include/net/seg6_hmac.h | 7 -
include/net/tcp.h | 24 +-
net/ipv4/Kconfig | 2 +-
net/ipv4/tcp.c | 105 +++------
net/ipv4/tcp_ipv4.c | 92 +++++---
net/ipv4/tcp_minisocks.c | 21 +-
net/ipv6/Kconfig | 2 +-
net/ipv6/seg6.c | 3 -
net/ipv6/seg6_hmac.c | 204 +++++++---------
net/ipv6/tcp_ipv6.c | 53 ++---
15 files changed, 626 insertions(+), 304 deletions(-)
create mode 100644 Documentation/crypto/crypto_pool.rst
create mode 100644 crypto/crypto_pool.c
create mode 100644 include/crypto/pool.h
base-commit: 69b41ac87e4a664de78a395ff97166f0b2943210
--
2.39.0
next reply other threads:[~2023-01-03 18:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 18:42 Dmitry Safonov [this message]
2023-01-03 18:42 ` [PATCH v2 1/5] crypto: Introduce crypto_pool Dmitry Safonov
2023-01-07 1:53 ` Jakub Kicinski
2023-01-09 20:59 ` Dmitry Safonov
2023-01-09 21:11 ` Dmitry Safonov
2023-01-03 18:42 ` [PATCH v2 2/5] crypto/pool: Add crypto_pool_reserve_scratch() Dmitry Safonov
2023-01-07 2:04 ` Jakub Kicinski
2023-01-09 21:08 ` Dmitry Safonov
2023-01-03 18:42 ` [PATCH v2 3/5] crypto/net/tcp: Use crypto_pool for TCP-MD5 Dmitry Safonov
2023-01-07 2:05 ` Jakub Kicinski
2023-01-09 21:16 ` Dmitry Safonov
2023-01-03 18:42 ` [PATCH v2 4/5] crypto/net/ipv6: sr: Switch to using crypto_pool Dmitry Safonov
2023-01-03 18:42 ` [PATCH v2 5/5] crypto/Documentation: Add crypto_pool kernel API Dmitry Safonov
2023-01-04 13:17 ` kernel test robot
2023-01-07 2:06 ` Jakub Kicinski
2023-01-09 21:23 ` Dmitry Safonov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230103184257.118069-1-dima@arista.com \
--to=dima@arista.com \
--cc=0x7f454c46@gmail.com \
--cc=cdleonard@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gilligan@arista.com \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=netdev@vger.kernel.org \
--cc=noureddine@arista.com \
--cc=pabeni@redhat.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox