diff mbox series

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

Message ID 20240510154405.664598-1-sergey.portnoy@intel.com
State New
Headers show
Series [v2] crypto: tcrypt - add skcipher speed for given alg | expand

Commit Message

Sergey Portnoy May 10, 2024, 3:33 p.m. UTC
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>
---
v1 -> v2

- speed_template is moved to be on-stack and type was corrected to u8

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

Comments

Herbert Xu May 31, 2024, 4:56 a.m. UTC | #1
On Fri, May 10, 2024 at 04:33:15PM +0100, Sergey Portnoy wrote:
>
> @@ -2807,6 +2809,16 @@ 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:

This should be case 600 and it should do both encryption and
decryption.  See the existing case 400.

Thanks,
diff mbox series

Patch

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 8aea416f6480..ffd94a0972ca 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) {
@@ -2807,6 +2809,16 @@  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:
+		if (alg)
+			test_mb_skcipher_speed(alg, ENCRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+		break;
+	case 612:
+		if (alg)
+			test_mb_skcipher_speed(alg, DECRYPT, sec, NULL, 0,
+					       speed_template, num_mb);
+		break;
 	}
 
 	return ret;