Re: [v2 PATCH 3/9] crypto: aead - Add ctx helpers with DMA alignment

Catalin Marinas
2022-11-25T12:25:09Z

On Fri, Nov 25, 2022 at 12:36:33PM +0800, Herbert Xu wrote:
> diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
> index d482017f3e20..cd8cb1e921b7 100644
> --- a/include/crypto/internal/aead.h
> +++ b/include/crypto/internal/aead.h
> @@ -39,6 +39,11 @@ static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
> return crypto_tfm_ctx(&tfm->base);
> }
>
> +static inline void *crypto_aead_ctx_dma(struct crypto_aead *tfm)
> +{
> + return crypto_tfm_ctx_dma(&tfm->base);
> +}

I wonder, if drivers end up calling this, isn't it easier to do the
alignment in crypto_aead_ctx() directly? There are over 300 callers (not
sure about the padding though, it may need still driver changes unless
we can add it to something like crypto_tfm_alg_alignmask()). Or is the
expectation that not all drivers need a DMA alignment?

--
Catalin