crypto: tcrypt - add skcipher speed for given alg
PATCH 1/1 crypto: tcrypt - add skcipher speed for given alg
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)
--- crypto/tcrypt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
crypto/tcrypt.c +13 -0
@@ -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;
Signature · 1 line
2.44.0
Quoted 34 lines
-----Original Message-----
From: Sergey Portnoy <[email protected]>
Sent: Thursday, May 9, 2024 6:36 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH] crypto: tcrypt - add skcipher speed for given algAllow 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=32If succeed, the performance numbers will be printed in dmesg:
testing speed of multibufferqat_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 <[email protected]>--- crypto/tcrypt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)crypto/tcrypt.c +0
-0
crypto/tcrypt.c static int mode; · line 71
Quoted 4 lines
crypto/tcrypt.c +1
-0@@ -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 ];
u8 would better match the source:
static unsigned int klen;
module_param(klen, uint, 0);
MODULE_PARM_DESC(klen, "Key length (defaults to 0)");and use as the keysize argument in:
static void test_mb_skcipher_speed(const char *algo, int enc, int secs,
struct cipher_speed_template *template, unsigned int tcount, u8 *keysize, u32 num_mb)
and the other constant speed test arrays like:
static u8 speed_template_8[] = {8, 0};
static u8 speed_template_16[] = {16, 0};
static u8 speed_template_24[] = {24, 0};...
crypto/tcrypt.c static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) · line 2822
Quoted 12 lines
crypto/tcrypt.c +12
-0+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 ;
Since it's only two bytes, perhaps it should just be an on-stack variable inside each of those if blocks, not a file-scope variable.