diff mbox series

[v3] crypto: tcrypt - add skcipher speed for given alg

Message ID 20240607143128.2740633-1-sergey.portnoy@intel.com (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show
Series [v3] crypto: tcrypt - add skcipher speed for given alg | expand

Commit Message

Sergey Portnoy June 7, 2024, 2:30 p.m. UTC
Allow to run skcipher speed for given algorithm.
Case 600 is modified to cover ENCRYPT and DECRYPT
directions.

Example:
   modprobe tcrypt mode=600 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>
---

v2->v3

- modifying case 600, instead of using separate cases for
  encrypt/decrypt

 crypto/tcrypt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Herbert Xu June 16, 2024, 5:36 a.m. UTC | #1
On Fri, Jun 07, 2024 at 03:30:48PM +0100, Sergey Portnoy wrote:
>
> diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
> index 8aea416f6480..880d427bdb3f 100644
> --- a/crypto/tcrypt.c
> +++ b/crypto/tcrypt.c
> @@ -1454,6 +1454,8 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
>  	int i;
>  	int ret = 0;
>  
> +	u8 speed_template[2] = {klen, 0};

Please move this inside the if block in case 600.

>  	switch (m) {
>  	case 0:
>  		if (alg) {
> @@ -2613,6 +2615,14 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
>  		break;
>  
>  	case 600:
> +		if (alg) {

It should go here.

> +			test_mb_skcipher_speed(alg, ENCRYPT, sec, NULL, 0,
> +					       speed_template, num_mb);
> +			test_mb_skcipher_speed(alg, DECRYPT, sec, NULL, 0,
> +					       speed_template, num_mb);
> +			break;
> +		}
> +

Thanks,
diff mbox series

Patch

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 8aea416f6480..880d427bdb3f 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1454,6 +1454,8 @@  static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
 	int i;
 	int ret = 0;
 
+	u8 speed_template[2] = {klen, 0};
+
 	switch (m) {
 	case 0:
 		if (alg) {
@@ -2613,6 +2615,14 @@  static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
 		break;
 
 	case 600:
+		if (alg) {
+			test_mb_skcipher_speed(alg, ENCRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+			test_mb_skcipher_speed(alg, DECRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+			break;
+		}
+
 		test_mb_skcipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
 				       speed_template_16_24_32, num_mb);
 		test_mb_skcipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0,