public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: "Herbert Xu" <herbert@gondor.apana.org.au>
To: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: [PATCH 1/10] crypto: algapi - Move stat reporting into algapi
Date: Wed, 15 Feb 2023 17:25:07 +0800	[thread overview]
Message-ID: <E1pSE2F-00BVkQ-4u@formenos.hmeau.com> (raw)
In-Reply-To: Y+ykvcAIAH5Rsn7C@gondor.apana.org.au

The stats code resurrected the unions from the early days of
kernel crypto.  This patch starts the process of moving them
out to the individual type structures as we do for everything
else.

In particular, add a report_stat function to cra_type and call
that from the stats code if available.  This allows us to move
the actual code over one-by-one.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 crypto/crypto_user_stat.c |    6 ++++++
 include/crypto/algapi.h   |    3 +++
 2 files changed, 9 insertions(+)

diff --git a/crypto/crypto_user_stat.c b/crypto/crypto_user_stat.c
index 154884bf9275..2369814029fa 100644
--- a/crypto/crypto_user_stat.c
+++ b/crypto/crypto_user_stat.c
@@ -204,6 +204,12 @@ static int crypto_reportstat_one(struct crypto_alg *alg,
 		goto out;
 	}
 
+	if (alg->cra_type && alg->cra_type->report_stat) {
+		if (alg->cra_type->report_stat(skb, alg))
+			goto nla_put_failure;
+		goto out;
+	}
+
 	switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {
 	case CRYPTO_ALG_TYPE_AEAD:
 		if (crypto_report_aead(skb, alg))
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index fede394ae2ab..dcc1fd4ef1b4 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -50,6 +50,9 @@ struct crypto_type {
 	void (*show)(struct seq_file *m, struct crypto_alg *alg);
 	int (*report)(struct sk_buff *skb, struct crypto_alg *alg);
 	void (*free)(struct crypto_instance *inst);
+#ifdef CONFIG_CRYPTO_STATS
+	int (*report_stat)(struct sk_buff *skb, struct crypto_alg *alg);
+#endif
 
 	unsigned int type;
 	unsigned int maskclear;

  reply	other threads:[~2023-02-15  9:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  9:24 [PATCH 0/10] crypto: api - Restructure stats code Herbert Xu
2023-02-15  9:25 ` Herbert Xu [this message]
2023-02-15  9:25 ` [PATCH 2/10] crypto: aead - Count error stats differently Herbert Xu
2023-02-16  5:35   ` Eric Biggers
2023-02-16  5:58     ` Herbert Xu
2023-02-16  5:45   ` Eric Biggers
2023-02-16  6:00     ` Herbert Xu
2023-02-16  6:31       ` Eric Biggers
2023-02-16  8:34         ` Herbert Xu
2023-02-15  9:25 ` [PATCH 3/10] crypto: akcipher " Herbert Xu
2023-02-15  9:25 ` [PATCH 4/10] crypto: hash " Herbert Xu
2023-02-16  5:58   ` Eric Biggers
2023-02-16  6:02     ` Herbert Xu
2023-02-16  6:14       ` Eric Biggers
2023-02-16  8:09         ` Herbert Xu
2023-02-15  9:25 ` [PATCH 5/10] crypto: acomp " Herbert Xu
2023-02-15  9:25 ` [PATCH 6/10] crypto: kpp " Herbert Xu
2023-02-15  9:25 ` [PATCH 7/10] crypto: skcipher " Herbert Xu
2023-02-15  9:25 ` [PATCH 8/10] crypto: rng " Herbert Xu
2023-02-16  5:46   ` Eric Biggers
2023-02-16  5:56     ` Herbert Xu
2023-02-16  6:01       ` Eric Biggers
2023-02-15  9:25 ` [PATCH 9/10] crypto: api - Move MODULE_ALIAS_CRYPTO to algapi.h Herbert Xu
2023-02-16  5:17   ` Eric Biggers
2023-02-16  5:18     ` Herbert Xu
2023-02-15  9:25 ` [PATCH 10/10] crypto: api - Check CRYPTO_USER instead of NET for report 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=E1pSE2F-00BVkQ-4u@formenos.hmeau.com \
    --to=herbert@gondor.apana.org.au \
    --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