Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	James Hsiao <jhsiao@amcc.com>, Rosen Penev <rosenp@gmail.com>,
	Christian Lamparter <chunkeey@gmail.com>
Subject: [PATCH 7/8] crypto: amcc - fix the inverted AEAD error ratelimit
Date: Thu, 26 Nov 2026 20:04:22 -0800	[thread overview]
Message-ID: <20261127040423.1023233-8-rosenp@gmail.com> (raw)
In-Reply-To: <20261127040423.1023233-1-rosenp@gmail.com>

crypto4xx_aead_done() prints the engine's error status only when
!__ratelimit() is true, but __ratelimit() returns non-zero when a
message may be printed. The errors are therefore dropped while the
rate is low and printed only once messages are being suppressed.

Report the status with one dev_err_ratelimited() call instead, which
also names the device, and drop the driver's own ratelimit state.

Fixes: a0aae821ba3d ("crypto: crypto4xx - prepare for AEAD support")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/crypto/amcc/crypto4xx_core.c | 20 +++++++-------------
 drivers/crypto/amcc/crypto4xx_core.h |  2 --
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 4c1b76f28de0..8b070b7edcb6 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -588,18 +588,13 @@ static void crypto4xx_aead_done(struct crypto4xx_device *dev,
 	crypto4xx_ret_sg_desc(dev, pd_uinfo);
 
 	if (pd->pd_ctl.bf.status & 0xff) {
-		if (!__ratelimit(&dev->aead_ratelimit)) {
-			if (pd->pd_ctl.bf.status & 2)
-				pr_err("pad fail error\n");
-			if (pd->pd_ctl.bf.status & 4)
-				pr_err("seqnum fail\n");
-			if (pd->pd_ctl.bf.status & 8)
-				pr_err("error _notify\n");
-			pr_err("aead return err status = 0x%02x\n",
-				pd->pd_ctl.bf.status & 0xff);
-			pr_err("pd pad_ctl = 0x%08x\n",
-				pd->pd_ctl.bf.pd_pad_ctl);
-		}
+		dev_err_ratelimited(dev->core_dev->device,
+				    "aead error status 0x%02x%s%s%s, pad_ctl 0x%08x\n",
+				    pd->pd_ctl.bf.status & 0xff,
+				    pd->pd_ctl.bf.status & 2 ? " (pad fail)" : "",
+				    pd->pd_ctl.bf.status & 4 ? " (seqnum fail)" : "",
+				    pd->pd_ctl.bf.status & 8 ? " (error notify)" : "",
+				    pd->pd_ctl.bf.pd_pad_ctl);
 		err = -EINVAL;
 	}
 
@@ -1352,7 +1347,6 @@ static int crypto4xx_probe(struct platform_device *ofdev)
 	core_dev->device = dev;
 	spin_lock_init(&core_dev->lock);
 	INIT_LIST_HEAD(&core_dev->dev->alg_list);
-	ratelimit_default_init(&core_dev->dev->aead_ratelimit);
 	rc = crypto4xx_build_sdr(core_dev->dev);
 	if (rc)
 		goto err_build_sdr;
diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc/crypto4xx_core.h
index cdd40bb7d254..a8da46f5a44f 100644
--- a/drivers/crypto/amcc/crypto4xx_core.h
+++ b/drivers/crypto/amcc/crypto4xx_core.h
@@ -13,7 +13,6 @@
 #ifndef __CRYPTO4XX_CORE_H__
 #define __CRYPTO4XX_CORE_H__
 
-#include <linux/ratelimit.h>
 #include <linux/scatterlist.h>
 #include <crypto/internal/aead.h>
 #include <crypto/internal/skcipher.h>
@@ -100,7 +99,6 @@ struct crypto4xx_device {
 	struct pd_uinfo *pdr_uinfo;
 	struct list_head alg_list;	/* List of algorithm supported
 					by this device */
-	struct ratelimit_state aead_ratelimit;
 	bool is_revb;
 };
 
-- 
2.56.1


  parent reply	other threads:[~2026-11-27  4:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  4:04 [PATCH 0/8] crypto: amcc - fixes for the crypto4xx driver Rosen Penev
2026-11-27  4:04 ` [PATCH 1/8] crypto: amcc - fix scatter ring full check Rosen Penev
2026-11-27  4:04 ` [PATCH 2/8] crypto: amcc - fix missing DMA memory barriers in descriptor handling Rosen Penev
2026-11-27  4:04 ` [PATCH 3/8] crypto: amcc - allocate all algorithm wrappers before registering Rosen Penev
2026-11-27  4:04 ` [PATCH 4/8] crypto: amcc - set up the TRNG before registering the algorithms Rosen Penev
2026-11-27  4:04 ` [PATCH 5/8] crypto: amcc - don't use memcpy() on the coherent SA and state record Rosen Penev
2026-11-27  4:04 ` [PATCH 6/8] crypto: amcc - fix the DMA mappings of the source and destination Rosen Penev
2026-11-27  4:04 ` Rosen Penev [this message]
2026-11-27  4:04 ` [PATCH 8/8] crypto: amcc - wipe the SA key material when freeing it Rosen Penev

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=20261127040423.1023233-8-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=chunkeey@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jhsiao@amcc.com \
    --cc=linux-crypto@vger.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