Skip to content

Commit 2d65393

Browse files
iuliana-prodanherbertx
authored andcommitted
crypto: caam - enable crypto-engine retry mechanism
Use the new crypto_engine_alloc_init_and_set() function to initialize crypto-engine and enable retry mechanism. Set the maximum size for crypto-engine software queue based on Job Ring size (JOBR_DEPTH) and a threshold (reserved for the non-crypto-API requests that are not passed through crypto-engine). The callback for do_batch_requests is NULL, since CAAM doesn't support linked requests. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reviewed-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 09a5ef9 commit 2d65393

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎drivers/crypto/caam/intern.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
/* Currently comes from Kconfig param as a ^2 (driver-required) */
1717
#define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE)
1818

19+
/*
20+
* Maximum size for crypto-engine software queue based on Job Ring
21+
* size (JOBR_DEPTH) and a THRESHOLD (reserved for the non-crypto-API
22+
* requests that are not passed through crypto-engine)
23+
*/
24+
#define THRESHOLD 15
25+
#define CRYPTO_ENGINE_MAX_QLEN (JOBR_DEPTH - THRESHOLD)
26+
1927
/* Kconfig params for interrupt coalescing if selected (else zero) */
2028
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC
2129
#define JOBR_INTC JRCFG_ICEN

‎drivers/crypto/caam/jr.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,9 @@ static int caam_jr_probe(struct platform_device *pdev)
550550
}
551551

552552
/* Initialize crypto engine */
553-
jrpriv->engine = crypto_engine_alloc_init(jrdev, false);
553+
jrpriv->engine = crypto_engine_alloc_init_and_set(jrdev, true, NULL,
554+
false,
555+
CRYPTO_ENGINE_MAX_QLEN);
554556
if (!jrpriv->engine) {
555557
dev_err(jrdev, "Could not init crypto-engine\n");
556558
return -ENOMEM;

0 commit comments

Comments
 (0)