linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	linux-crypto@vger.kernel.org, wens@csie.org,
	jernej.skrabec@gmail.com, samuel@sholland.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] crypto: sun8i-ce-cipher - use IS_ENABLED() checks for debugfs stats
Date: Fri, 25 Apr 2025 15:30:28 +0200	[thread overview]
Message-ID: <aAuOdDhpnLE5bM_y@Red> (raw)
In-Reply-To: <20250425124517.2225963-3-ovidiu.panait.oss@gmail.com>

Le Fri, Apr 25, 2025 at 03:45:16PM +0300, Ovidiu Panait a écrit :
> Add IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG) checks before the
> fallback counter updates to make sure the code is not included when
> debugfs statistics support is not enabled.
> 
> Also, drop the existing ifdef guards, since 'struct sun8i_ce_alg_template'
> is always defined, even with CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG disabled.
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
> ---
>  .../allwinner/sun8i-ce/sun8i-ce-cipher.c      | 46 ++++++++++++-------
>  1 file changed, 30 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> index f03a8fa7bfa2..433cd18f0b5b 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> @@ -34,22 +34,30 @@ static int sun8i_ce_cipher_need_fallback(struct skcipher_request *areq)
>  
>  	if (sg_nents_for_len(areq->src, areq->cryptlen) > MAX_SG ||
>  	    sg_nents_for_len(areq->dst, areq->cryptlen) > MAX_SG) {
> -		algt->stat_fb_maxsg++;
> +		if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +			algt->stat_fb_maxsg++;
> +
>  		return true;
>  	}
>  
>  	if (areq->cryptlen < crypto_skcipher_ivsize(tfm)) {
> -		algt->stat_fb_leniv++;
> +		if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +			algt->stat_fb_leniv++;
> +
>  		return true;
>  	}
>  
>  	if (areq->cryptlen == 0) {
> -		algt->stat_fb_len0++;
> +		if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +			algt->stat_fb_len0++;
> +
>  		return true;
>  	}
>  
>  	if (areq->cryptlen % 16) {
> -		algt->stat_fb_mod16++;
> +		if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +			algt->stat_fb_mod16++;
> +
>  		return true;
>  	}
>  
> @@ -57,12 +65,16 @@ static int sun8i_ce_cipher_need_fallback(struct skcipher_request *areq)
>  	sg = areq->src;
>  	while (sg) {
>  		if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
> -			algt->stat_fb_srcali++;
> +			if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +				algt->stat_fb_srcali++;
> +
>  			return true;
>  		}
>  		todo = min(len, sg->length);
>  		if (todo % 4) {
> -			algt->stat_fb_srclen++;
> +			if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +				algt->stat_fb_srclen++;
> +
>  			return true;
>  		}
>  		len -= todo;
> @@ -73,12 +85,16 @@ static int sun8i_ce_cipher_need_fallback(struct skcipher_request *areq)
>  	sg = areq->dst;
>  	while (sg) {
>  		if (!IS_ALIGNED(sg->offset, sizeof(u32))) {
> -			algt->stat_fb_dstali++;
> +			if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +				algt->stat_fb_dstali++;
> +
>  			return true;
>  		}
>  		todo = min(len, sg->length);
>  		if (todo % 4) {
> -			algt->stat_fb_dstlen++;
> +			if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG))
> +				algt->stat_fb_dstlen++;
> +
>  			return true;
>  		}
>  		len -= todo;
> @@ -101,9 +117,7 @@ static int sun8i_ce_cipher_fallback(struct skcipher_request *areq)
>  		algt = container_of(alg, struct sun8i_ce_alg_template,
>  				    alg.skcipher.base);
>  
> -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG
>  		algt->stat_fb++;
> -#endif

Hello

You put IS_ENABLED everywhere, but here you remove it, why ?
I think you forgot it.

Thanks
Regards


  reply	other threads:[~2025-04-25 13:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 12:45 [PATCH 1/4] crypto: sun8i-ce-cipher - fix error handling in sun8i_ce_cipher_prepare() Ovidiu Panait
2025-04-25 12:45 ` [PATCH 2/4] crypto: sun8i-ce-cipher - use crypto_skcipher_driver_name() Ovidiu Panait
2025-04-25 13:23   ` Corentin Labbe
2025-04-28 11:39   ` Herbert Xu
2025-04-25 12:45 ` [PATCH 3/4] crypto: sun8i-ce-cipher - use IS_ENABLED() checks for debugfs stats Ovidiu Panait
2025-04-25 13:30   ` Corentin Labbe [this message]
2025-04-25 13:47     ` Ovidiu Panait
2025-04-25 13:53       ` Corentin Labbe
2025-04-25 12:45 ` [PATCH 4/4] crypto: sun8i-ce-cipher - use pm_runtime_resume_and_get() Ovidiu Panait
2025-04-25 13:28   ` Corentin Labbe
2025-04-28 11:53 ` [PATCH 1/4] crypto: sun8i-ce-cipher - fix error handling in sun8i_ce_cipher_prepare() Herbert Xu

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=aAuOdDhpnLE5bM_y@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=ovidiu.panait.oss@gmail.com \
    --cc=samuel@sholland.org \
    --cc=wens@csie.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;
as well as URLs for NNTP newsgroup(s).