X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-crypto-perf%2Fmain.c;h=9ec2a4b43bfd8875aa9d5fcb2e5c8ca44e2f5172;hb=95908f52393da36c47905a777f64c0650585c12b;hp=634ea5f849eec50d0050f621356ac395ec482053;hpb=0ef3f0e04c3ec01e12b7a6a187098da9fdb6bfdc;p=dpdk.git diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 634ea5f849..9ec2a4b43b 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -9,11 +9,12 @@ #include "cperf_test_vector_parsing.h" #include "cperf_test_throughput.h" #include "cperf_test_latency.h" +#include "cperf_test_verify.h" const char *cperf_test_type_strs[] = { [CPERF_TEST_TYPE_THROUGHPUT] = "throughput", - [CPERF_TEST_TYPE_CYCLECOUNT] = "cycle-count", - [CPERF_TEST_TYPE_LATENCY] = "latency" + [CPERF_TEST_TYPE_LATENCY] = "latency", + [CPERF_TEST_TYPE_VERIFY] = "verify" }; const char *cperf_op_type_strs[] = { @@ -30,11 +31,15 @@ const struct cperf_test cperf_testmap[] = { cperf_throughput_test_runner, cperf_throughput_test_destructor }, - [CPERF_TEST_TYPE_CYCLECOUNT] = { NULL }, [CPERF_TEST_TYPE_LATENCY] = { cperf_latency_test_constructor, cperf_latency_test_runner, cperf_latency_test_destructor + }, + [CPERF_TEST_TYPE_VERIFY] = { + cperf_verify_test_constructor, + cperf_verify_test_runner, + cperf_verify_test_destructor } }; @@ -45,7 +50,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs) int ret; enabled_cdev_count = rte_cryptodev_devices_get(opts->device_type, - enabled_cdevs, RTE_DIM(enabled_cdevs)); + enabled_cdevs, RTE_CRYPTO_MAX_DEVS); if (enabled_cdev_count == 0) { printf("No crypto devices type %s available\n", opts->device_type); @@ -118,7 +123,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, if (opts->op_type == CPERF_AUTH_ONLY || opts->op_type == CPERF_CIPHER_THEN_AUTH || - opts->op_type == CPERF_AUTH_THEN_CIPHER) { + opts->op_type == CPERF_AUTH_THEN_CIPHER || + opts->op_type == CPERF_AEAD) { cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; cap_idx.algo.auth = opts->auth_algo; @@ -139,7 +145,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, if (opts->op_type == CPERF_CIPHER_ONLY || opts->op_type == CPERF_CIPHER_THEN_AUTH || - opts->op_type == CPERF_AUTH_THEN_CIPHER) { + opts->op_type == CPERF_AUTH_THEN_CIPHER || + opts->op_type == CPERF_AEAD) { cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; cap_idx.algo.cipher = opts->cipher_algo; @@ -172,11 +179,11 @@ cperf_check_test_vector(struct cperf_options *opts, } else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { if (test_vec->plaintext.data == NULL) return -1; - if (test_vec->plaintext.length != opts->buffer_sz) + if (test_vec->plaintext.length < opts->max_buffer_size) return -1; if (test_vec->ciphertext.data == NULL) return -1; - if (test_vec->ciphertext.length != opts->buffer_sz) + if (test_vec->ciphertext.length < opts->max_buffer_size) return -1; if (test_vec->iv.data == NULL) return -1; @@ -191,7 +198,7 @@ cperf_check_test_vector(struct cperf_options *opts, if (opts->auth_algo != RTE_CRYPTO_AUTH_NULL) { if (test_vec->plaintext.data == NULL) return -1; - if (test_vec->plaintext.length != opts->buffer_sz) + if (test_vec->plaintext.length < opts->max_buffer_size) return -1; if (test_vec->auth_key.data == NULL) return -1; @@ -199,7 +206,7 @@ cperf_check_test_vector(struct cperf_options *opts, return -1; if (test_vec->digest.data == NULL) return -1; - if (test_vec->digest.length != opts->auth_digest_sz) + if (test_vec->digest.length < opts->auth_digest_sz) return -1; } @@ -208,16 +215,16 @@ cperf_check_test_vector(struct cperf_options *opts, if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) { if (test_vec->plaintext.data == NULL) return -1; - if (test_vec->plaintext.length != opts->buffer_sz) + if (test_vec->plaintext.length < opts->max_buffer_size) return -1; } else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { if (test_vec->plaintext.data == NULL) return -1; - if (test_vec->plaintext.length != opts->buffer_sz) + if (test_vec->plaintext.length < opts->max_buffer_size) return -1; if (test_vec->ciphertext.data == NULL) return -1; - if (test_vec->ciphertext.length != opts->buffer_sz) + if (test_vec->ciphertext.length < opts->max_buffer_size) return -1; if (test_vec->iv.data == NULL) return -1; @@ -235,13 +242,17 @@ cperf_check_test_vector(struct cperf_options *opts, return -1; if (test_vec->digest.data == NULL) return -1; - if (test_vec->digest.length != opts->auth_digest_sz) + if (test_vec->digest.length < opts->auth_digest_sz) return -1; } } else if (opts->op_type == CPERF_AEAD) { if (test_vec->plaintext.data == NULL) return -1; - if (test_vec->plaintext.length != opts->buffer_sz) + if (test_vec->plaintext.length < opts->max_buffer_size) + return -1; + if (test_vec->ciphertext.data == NULL) + return -1; + if (test_vec->ciphertext.length < opts->max_buffer_size) return -1; if (test_vec->aad.data == NULL) return -1; @@ -249,7 +260,7 @@ cperf_check_test_vector(struct cperf_options *opts, return -1; if (test_vec->digest.data == NULL) return -1; - if (test_vec->digest.length != opts->auth_digest_sz) + if (test_vec->digest.length < opts->auth_digest_sz) return -1; } return 0; @@ -264,10 +275,12 @@ main(int argc, char **argv) void *ctx[RTE_MAX_LCORE] = { }; - int nb_cryptodevs; + int nb_cryptodevs = 0; uint8_t cdev_id, i; uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = { 0 }; + uint8_t buffer_size_idx = 0; + int ret; uint32_t lcore_id; @@ -300,6 +313,7 @@ main(int argc, char **argv) if (nb_cryptodevs < 1) { RTE_LOG(ERR, USER1, "Failed to initialise requested crypto " "device type\n"); + nb_cryptodevs = 0; goto err; } @@ -362,21 +376,37 @@ main(int argc, char **argv) i++; } - i = 0; - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + /* Get first size from range or list */ + if (opts.inc_buffer_size != 0) + opts.test_buffer_size = opts.min_buffer_size; + else + opts.test_buffer_size = opts.buffer_size_list[0]; - if (i == nb_cryptodevs) - break; + while (opts.test_buffer_size <= opts.max_buffer_size) { + i = 0; + RTE_LCORE_FOREACH_SLAVE(lcore_id) { - cdev_id = enabled_cdevs[i]; + if (i == nb_cryptodevs) + break; + + cdev_id = enabled_cdevs[i]; - rte_eal_remote_launch(cperf_testmap[opts.test].runner, + rte_eal_remote_launch(cperf_testmap[opts.test].runner, ctx[cdev_id], lcore_id); - i++; + i++; + } + rte_eal_mp_wait_lcore(); + + /* Get next size from range or list */ + if (opts.inc_buffer_size != 0) + opts.test_buffer_size += opts.inc_buffer_size; + else { + if (++buffer_size_idx == opts.buffer_size_count) + break; + opts.test_buffer_size = opts.buffer_size_list[buffer_size_idx]; + } } - rte_eal_mp_wait_lcore(); - i = 0; RTE_LCORE_FOREACH_SLAVE(lcore_id) { @@ -397,7 +427,6 @@ main(int argc, char **argv) err: i = 0; RTE_LCORE_FOREACH_SLAVE(lcore_id) { - if (i == nb_cryptodevs) break;