[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0402MB348532182CBA23131430DAA9984E0@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Date: Thu, 21 Nov 2019 11:53:28 +0000
From: Horia Geanta <horia.geanta@....com>
To: Iuliana Prodan <iuliana.prodan@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Aymen Sghaier <aymen.sghaier@....com>,
Baolin Wang <baolin.wang@...aro.org>
CC: "David S. Miller" <davem@...emloft.net>,
Tom Lendacky <thomas.lendacky@....com>,
Gary Hook <gary.hook@....com>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH 09/12] crypto: caam - bypass crypto-engine sw queue, if
empty
On 11/18/2019 12:31 AM, Iuliana Prodan wrote:
> Bypass crypto-engine software queue, if empty, and send the request
> directly to hardware. If this returns -ENOSPC, transfer the request to
> crypto-engine and let it handle it.
>
Could this optimization be added directly into the crypto engine?
> Signed-off-by: Iuliana Prodan <iuliana.prodan@....com>
> ---
> drivers/crypto/caam/jr.c | 29 ++++++++++++++++++++++++++---
> 1 file changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
> index 5c55d3d..ddf3d39 100644
> --- a/drivers/crypto/caam/jr.c
> +++ b/drivers/crypto/caam/jr.c
> @@ -476,10 +476,33 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
> struct caam_drv_private_jr *jrpriv = dev_get_drvdata(dev);
> struct caam_jr_request_entry *jrentry = areq;
> struct crypto_async_request *req = jrentry->base;
> + int ret;
>
> - if (req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)
> - return transfer_request_to_engine(jrpriv->engine, req);
> -
> + if (req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG) {
> + if (crypto_queue_len(&jrpriv->engine->queue) == 0) {
> + /*
> + * send the request to CAAM, if crypto-engine queue
> + * is empty
> + */
> + ret = caam_jr_enqueue_no_bklog(dev, desc, cbk, jrentry);
> + if (ret == -ENOSPC)
> + /*
> + * CAAM has no space, so transfer the request
> + * to crypto-engine
> + */
> + return transfer_request_to_engine(jrpriv->engine,
> + req);
> + else
> + return ret;
> + } else {
> + /*
> + * crypto-engine queue is not empty, so transfer the
> + * request to crypto-engine, to keep the order
> + * of requests
> + */
> + return transfer_request_to_engine(jrpriv->engine, req);
> + }
> + }
> return caam_jr_enqueue_no_bklog(dev, desc, cbk, jrentry);
> }
> EXPORT_SYMBOL(caam_jr_enqueue);
>
Powered by blists - more mailing lists