aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorGilad Ben-Yossef <gilad@benyossef.com>2017-12-17 03:29:00 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2017-12-28 01:56:39 -0500
commit7c3f13238992884abf3782dcc8e97e0862e5c23e (patch)
treeb81b21d7d9a3687cdbbf04b5a337c11a81bd6215 /crypto/tcrypt.c
parent0e4b52942b1c76f89e0dcb829f72e123d0678f54 (diff)
crypto: tcrypt - use multi buf for ahash mb test
The multi buffer ahash speed test was allocating multiple buffers for use with the multiple outstanding requests it was starting but never actually using them (except to free them), instead using a different single statically allocated buffer for all requests. Fix this by actually using the allocated buffers for the test. It is noted that it may seem tempting to instead remove the allocation and free of the multiple buffers and leave things as they are since this is a hash test where the input is read only. However, after consideration I believe that multiple buffers better reflect real life scenario with regard to data cache and TLB behaviours etc. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 28b4882f1944..a0c4e0dbffa4 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -385,7 +385,7 @@ static inline int do_one_ahash_op(struct ahash_request *req, int ret)
385} 385}
386 386
387struct test_mb_ahash_data { 387struct test_mb_ahash_data {
388 struct scatterlist sg[TVMEMSIZE]; 388 struct scatterlist sg[XBUFSIZE];
389 char result[64]; 389 char result[64];
390 struct ahash_request *req; 390 struct ahash_request *req;
391 struct crypto_wait wait; 391 struct crypto_wait wait;
@@ -428,7 +428,12 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
428 428
429 ahash_request_set_callback(data[i].req, 0, crypto_req_done, 429 ahash_request_set_callback(data[i].req, 0, crypto_req_done,
430 &data[i].wait); 430 &data[i].wait);
431 test_hash_sg_init(data[i].sg); 431
432 sg_init_table(data[i].sg, XBUFSIZE);
433 for (j = 0; j < XBUFSIZE; j++) {
434 sg_set_buf(data[i].sg + j, data[i].xbuf[j], PAGE_SIZE);
435 memset(data[i].xbuf[j], 0xff, PAGE_SIZE);
436 }
432 } 437 }
433 438
434 pr_info("\ntesting speed of multibuffer %s (%s)\n", algo, 439 pr_info("\ntesting speed of multibuffer %s (%s)\n", algo,
@@ -439,9 +444,9 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec,
439 if (speed[i].blen != speed[i].plen) 444 if (speed[i].blen != speed[i].plen)
440 continue; 445 continue;
441 446
442 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { 447 if (speed[i].blen > XBUFSIZE * PAGE_SIZE) {
443 pr_err("template (%u) too big for tvmem (%lu)\n", 448 pr_err("template (%u) too big for tvmem (%lu)\n",
444 speed[i].blen, TVMEMSIZE * PAGE_SIZE); 449 speed[i].blen, XBUFSIZE * PAGE_SIZE);
445 goto out; 450 goto out;
446 } 451 }
447 452