Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Iuliana Prodan and committed by
Herbert Xu
2d653936 09a5ef96

+11 -1
+8
drivers/crypto/caam/intern.h
··· 16 16 /* Currently comes from Kconfig param as a ^2 (driver-required) */ 17 17 #define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE) 18 18 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 + 19 27 /* Kconfig params for interrupt coalescing if selected (else zero) */ 20 28 #ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC 21 29 #define JOBR_INTC JRCFG_ICEN
+3 -1
drivers/crypto/caam/jr.c
··· 550 550 } 551 551 552 552 /* 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); 554 556 if (!jrpriv->engine) { 555 557 dev_err(jrdev, "Could not init crypto-engine\n"); 556 558 return -ENOMEM;