Devicetree
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	Ruud.Derwig@synopsys.com, rbannerm@synopsys.com,
	manjunath.hadli@vayavyalabs.com, adityak@vayavyalabs.com,
	navami.telsang@vayavyalabs.com, bhoomikak@vayavyalabs.com
Subject: Re: [PATCH v13 2/4] crypto: spacc - Add SPAcc ahash support
Date: Thu, 11 Jun 2026 13:49:07 +0800	[thread overview]
Message-ID: <aipMU4eFuNDsXDvt@gondor.apana.org.au> (raw)
In-Reply-To: <20260604165210.1141842-3-pavitrakumarm@vayavyalabs.com>

On Thu, Jun 04, 2026 at 10:22:08PM +0530, Pavitrakumar Managutte wrote:
>
> +static int spacc_hash_do_one_request(struct crypto_engine *engine, void *areq)
> +{
> +	struct ahash_request *req = ahash_request_cast(areq);
> +	struct crypto_ahash *reqtfm = crypto_ahash_reqtfm(req);
> +	struct spacc_crypto_ctx *tctx = crypto_ahash_ctx(reqtfm);
> +	struct spacc_crypto_reqctx *ctx = ahash_request_ctx(req);
> +	struct spacc_priv *priv = dev_get_drvdata(tctx->dev);
> +	const struct spacc_alg *salg = spacc_tfm_ahash(&reqtfm->base);
> +	int rc = 0;
> +
> +	ctx->single_shot = 1;
> +	ctx->total_nents = sg_nents(req->src);
> +
> +	tctx->tmp_sgl = kmalloc_array(2, sizeof(*tctx->tmp_sgl), GFP_KERNEL);
> +
> +	if (!tctx->tmp_sgl)
> +		goto fallback;
> +
> +	sg_init_table(tctx->tmp_sgl, 2);
> +	tctx->tmp_sgl[0].length = 0;
> +
> +	if (tctx->handle < 0 || !tctx->ctx_valid) {
> +		priv = dev_get_drvdata(salg->dev);
> +		tctx->dev = get_device(salg->dev);
> +
> +		rc = spacc_is_mode_keysize_supported(&priv->spacc,
> +				salg->mode->id, tctx->keylen, 1);

This check could've been done before going through the crypto
engine.  If we're just going to use the fallback, there is no
point going all the way through the engine just to drop out right
at the end.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  parent reply	other threads:[~2026-06-11  5:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 16:52 [PATCH v13 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-06-04 16:52 ` [PATCH v13 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-06-04 16:52 ` [PATCH v13 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-06-04 17:12   ` sashiko-bot
2026-06-11  5:49   ` Herbert Xu [this message]
2026-06-11  5:50   ` Herbert Xu
2026-06-04 16:52 ` [PATCH v13 3/4] crypto: spacc - Add SPAcc AUTODETECT Support Pavitrakumar Managutte
2026-06-04 17:12   ` sashiko-bot
2026-06-04 16:52 ` [PATCH v13 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2026-06-04 17:06   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aipMU4eFuNDsXDvt@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=Ruud.Derwig@synopsys.com \
    --cc=adityak@vayavyalabs.com \
    --cc=bhoomikak@vayavyalabs.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manjunath.hadli@vayavyalabs.com \
    --cc=navami.telsang@vayavyalabs.com \
    --cc=pavitrakumarm@vayavyalabs.com \
    --cc=rbannerm@synopsys.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox