Linux-Crypto Archive mirror
 help / color / mirror / Atom feed
From: Sergey Portnoy <sergey.portnoy@intel.com>
To: herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com
Subject: [PATCH] crypto: tcrypt - add skcipher speed for given alg
Date: Thu,  9 May 2024 12:36:11 +0100	[thread overview]
Message-ID: <20240509113703.578583-1-sergey.portnoy@intel.com> (raw)

Allow to run skcipher speed for given algorithm.
Two separate cases are added to cover ENCRYPT and DECRYPT
directions.

Example:
   modprobe tcrypt mode=611 alg="qat_aes_xts" klen=32

If succeed, the performance numbers will be printed in dmesg:
   testing speed of multibuffer qat_aes_xts (qat_aes_xts) encryption
   test 0 (256 bit key, 16 byte blocks): 1 operation in 14596 cycles (16 bytes)
   ...
   test 6 (256 bit key, 4096 byte blocks): 1 operation in 8053 cycles (4096 bytes)

Signed-off-by: Sergey Portnoy <sergey.portnoy@intel.com>
---
 crypto/tcrypt.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 8aea416f6480..73bea38c8112 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -68,6 +68,7 @@ static int mode;
 static u32 num_mb = 8;
 static unsigned int klen;
 static char *tvmem[TVMEMSIZE];
+static char speed_template[2];
 
 static const int block_sizes[] = { 16, 64, 128, 256, 1024, 1420, 4096, 0 };
 static const int aead_sizes[] = { 16, 64, 256, 512, 1024, 1420, 4096, 8192, 0 };
@@ -2807,6 +2808,18 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
 				       speed_template_16_32, num_mb);
 		break;
 
+	case 611:
+		speed_template[0] = klen;
+		if (alg)
+			test_mb_skcipher_speed(alg, ENCRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+		break;
+	case 612:
+		speed_template[0] = klen;
+		if (alg)
+			test_mb_skcipher_speed(alg, DECRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+		break;
 	}
 
 	return ret;
-- 
2.44.0


             reply	other threads:[~2024-05-09 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 11:36 Sergey Portnoy [this message]
2024-05-09 19:58 ` [PATCH] crypto: tcrypt - add skcipher speed for given alg Elliott, Robert (Servers)

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=20240509113703.578583-1-sergey.portnoy@intel.com \
    --to=sergey.portnoy@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).