Skip to content

Commit

Permalink
crypto: caam - enable crypto-engine retry mechanism
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Horia Geantă <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
iuliana-prodan authored and herbertx committed Nov 6, 2020
1 parent 09a5ef9 commit 2d65393
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions drivers/crypto/caam/intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
/* Currently comes from Kconfig param as a ^2 (driver-required) */
#define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE)

/*
* 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)
*/
#define THRESHOLD 15
#define CRYPTO_ENGINE_MAX_QLEN (JOBR_DEPTH - THRESHOLD)

/* Kconfig params for interrupt coalescing if selected (else zero) */
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC
#define JOBR_INTC JRCFG_ICEN
Expand Down
4 changes: 3 additions & 1 deletion drivers/crypto/caam/jr.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ static int caam_jr_probe(struct platform_device *pdev)
}

/* Initialize crypto engine */
jrpriv->engine = crypto_engine_alloc_init(jrdev, false);
jrpriv->engine = crypto_engine_alloc_init_and_set(jrdev, true, NULL,
false,
CRYPTO_ENGINE_MAX_QLEN);
if (!jrpriv->engine) {
dev_err(jrdev, "Could not init crypto-engine\n");
return -ENOMEM;
Expand Down

0 comments on commit 2d65393

Please sign in to comment.