mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ralf Lici <ralf@mandelbit.com>
Cc: linux-crypto@vger.kernel.org, Antoine Tenart <atenart@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH crypto 2/2] crypto: safexcel - Map AEAD buffers with accurate DMA directions
Date: Wed, 23 Sep 2026 15:30:13 +1000	[thread overview]
Message-ID: <arNj5SOwXf_TV6eK@gondor.apana.org.au> (raw)
In-Reply-To: <7bd0c89dd32e9712d7d08393842498698148064b.1789469436.git.ralf@mandelbit.com>

On Tue, Sep 15, 2026 at 01:32:12PM +0200, Ralf Lici wrote:
>
> +static int safexcel_map_aead(struct device *dev, struct scatterlist *sgl,
> +			     int nents, unsigned int output_offset,
> +			     unsigned int output_len, bool inplace)
> +{
> +	struct scatterlist *sg;
> +	unsigned int offset = 0;
> +	int i;
> +
> +	for_each_sg(sgl, sg, nents, i) {
> +		enum dma_data_direction dir;
> +
> +		dir = safexcel_aead_dma_dir(offset, sg->length, output_offset,
> +					    output_len, inplace);
> +		sg_dma_address(sg) = dma_map_page(dev, sg_page(sg), sg->offset,
> +						  sg->length, dir);
> +		if (dma_mapping_error(dev, sg_dma_address(sg)))
> +			goto err_unmap;
> +		sg_dma_len(sg) = sg->length;
> +		offset += sg->length;
> +	}
> +
> +	return nents;
> +
> +err_unmap:
> +	safexcel_unmap_aead(dev, sgl, i, output_offset, output_len, inplace);
> +	return 0;
> +}

Is this assuming that the SG list actually contains one entry for
each type of data? What if the input is completely linear, i.e.,
the AD, cipher and tag are all described by a single SG entry?

In IPsec this is often the case.

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

  reply	other threads:[~2026-09-23  5:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 11:32 [PATCH crypto 0/2] crypto: safexcel: fix AEAD DMA mapping and cleanup Ralf Lici
2026-09-15 11:32 ` [PATCH crypto 1/2] crypto: safexcel - Avoid unmapping failed DMA mappings Ralf Lici
2026-09-15 11:32 ` [PATCH crypto 2/2] crypto: safexcel - Map AEAD buffers with accurate DMA directions Ralf Lici
2026-09-23  5:30   ` Herbert Xu [this message]
2026-09-23  7:26     ` Ralf Lici
2026-09-23  8:32       ` Herbert Xu
2026-09-23  9:13         ` Ralf Lici

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=arNj5SOwXf_TV6eK@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@mandelbit.com \
    /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

all inboxes | Powered by JetHome®