crypto: powerpc/p10-aes-gcm - Fix IPsec stall on bond failover
PATCH v2 1/1 crypto: powerpc/p10-aes-gcm - Fix IPsec stall on bond failover
The Power10 AES-GCM driver registers its gcm(aes) and rfc4106(gcm(aes)) algorithms through the crypto SIMD helper. When crypto_simd_usable() is false, for example in softirq context, the helper defers requests to cryptd and completes them asynchronously with -EINPROGRESS.
This breaks IPsec traffic during a bond failover. With the crypto offload device active, traffic is switched to a passive device that has only software encryption, and the ESP requests then go through aes_gcm_p10_crypto. Under heavy load, some or all of the TCP streams drop to zero throughput and do not recover. The stack is seen to drop the ACKs as invalid, which points to the cryptd queueing delaying or reordering the packets.
Fix this by registering the algorithms directly as aead_alg with CRYPTO_ALG_NEED_FALLBACK, and allocating a "gcm(aes)" or "rfc4106(gcm(aes))" fallback tfm in ->init(). When VSX cannot be used (!crypto_simd_usable()), the key was not set up for SIMD, or cryptlen < 64, the request is handed to the fallback and completed synchronously in the caller's context. The driver no longer defers work to cryptd.
Remove Kconfig option CRYPTO_SIMD and add CRYPTO_AES and CRYPTO_GCM.
---
Tested with tcrypt.ko (including the self-tests) and with IPsec traffic across a bond failover. TCP throughput no longer drops to zero.
arch/powerpc/crypto/Kconfig | 3 +- arch/powerpc/crypto/aes-gcm-p10-glue.c | 155 +++++++++++++++++++------ 2 files changed, 119 insertions(+), 39 deletions(-)
arch/powerpc/crypto/Kconfig +2 -1
@@ -31,7 +31,8 @@ config CRYPTO_AES_GCM_P10 select CRYPTO_ALGAPI select CRYPTO_AEAD select CRYPTO_SKCIPHER - select CRYPTO_SIMD + select CRYPTO_AES + select CRYPTO_GCM help AEAD cipher: AES cipher algorithms (FIPS-197) GCM (Galois/Counter Mode) authenticated encryption mode (NIST SP800-38D)
arch/powerpc/crypto/aes-gcm-p10-glue.c +117 -38
287 lines not on this page · raw message
Signature · 1 line
2.47.1
Quoted 22 lines · Danny Tsen
The Power10 AES-GCM driver registers its gcm(aes) and rfc4106(gcm(aes)) algorithms through the crypto SIMD helper. When
crypto_simd_usable()is false, for example in softirq context, the helper defers requests to cryptd and completes them asynchronously with-EINPROGRESS.This breaks IPsec traffic during a bond failover. With the crypto offload device active, traffic is switched to a passive device that has only software encryption, and the ESP requests then go through
aes_gcm_p10_crypto. Under heavy load, some or all of the TCP streams drop to zero throughput and do not recover. The stack is seen to drop the ACKs as invalid, which points to the cryptd queueing delaying or reordering the packets.Fix this by registering the algorithms directly as
aead_algwithCRYPTO_ALG_NEED_FALLBACK, and allocating a "gcm(aes)" or "rfc4106(gcm(aes))" fallback tfm in ->init(). When VSX cannot be used (!crypto_simd_usable()), the key was not set up for SIMD, or cryptlen < 64, the request is handed to the fallback and completed synchronously in the caller's context. The driver no longer defers work to cryptd.
Quoted 5 lines
Remove
KconfigoptionCRYPTO_SIMDand addCRYPTO_AESandCRYPTO_GCM.Fixes c954b252dee9 ("crypto: powerpc/p10-aes-gcm - Register modules as SIMD")Signed-off-by Danny Tsen <[email protected]>
Quoted 2 lines
- * Copyright 2022- IBM Inc. All rights reserved
+ * Copyright IBM Corp. 2022, 2023, 2024, 2025, 2026
Do we really want to change this in this "fix" commit?
Quoted 25 lines · Breno Leitao
Quoted 24 lines · Danny Tsen
The Power10 AES-GCM driver registers its gcm(aes) and rfc4106(gcm(aes)) algorithms through the crypto SIMD helper. When
crypto_simd_usable()is false, for example in softirq context, the helper defers requests to cryptd and completes them asynchronously with-EINPROGRESS.This breaks IPsec traffic during a bond failover. With the crypto offload device active, traffic is switched to a passive device that has only software encryption, and the ESP requests then go through
aes_gcm_p10_crypto. Under heavy load, some or all of the TCP streams drop to zero throughput and do not recover. The stack is seen to drop the ACKs as invalid, which points to the cryptd queueing delaying or reordering the packets.Fix this by registering the algorithms directly as
aead_algwithCRYPTO_ALG_NEED_FALLBACK, and allocating a "gcm(aes)" or "rfc4106(gcm(aes))" fallback tfm in ->init(). When VSX cannot be used (!crypto_simd_usable()), the key was not set up for SIMD, or cryptlen < 64, the request is handed to the fallback and completed synchronously in the caller's context. The driver no longer defers work to cryptd.Remove
KconfigoptionCRYPTO_SIMDand addCRYPTO_AESandCRYPTO_GCM.
Quoted 8 lines
Quoted 3 lines
Fixes c954b252dee9 ("crypto: powerpc/p10-aes-gcm - Register modules as SIMD")Signed-off-by Danny Tsen <[email protected]>Reviewed-by Breno Leitao <[email protected]>Quoted 2 lines
- * Copyright 2022- IBM Inc. All rights reserved
+ * Copyright IBM Corp. 2022, 2023, 2024, 2025, 2026Do we really want to change this in this "fix" commit?
This is following IBM's copyright style.
Thanks.
-Danny