From c36432166982e745ee79cbb00e54522138922bc6 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 12 Sep 2017 10:36:25 +0100 Subject: [PATCH] app/crypto-perf: add nb-desc parameter This parameter makes number of cryptodev descriptors adjustable and defaults to earlier hardcoded default of 2048. Signed-off-by: Anatoly Burakov Reviewed-by: Pablo de Lara --- app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 21 ++++++++++++++++++++ app/test-crypto-perf/main.c | 2 +- doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h index 10cd2d8a3c..edd6b793d7 100644 --- a/app/test-crypto-perf/cperf_options.h +++ b/app/test-crypto-perf/cperf_options.h @@ -12,6 +12,7 @@ #define CPERF_BURST_SIZE ("burst-sz") #define CPERF_BUFFER_SIZE ("buffer-sz") #define CPERF_SEGMENTS_NB ("segments-nb") +#define CPERF_DESC_NB ("desc-nb") #define CPERF_DEVTYPE ("devtype") #define CPERF_OPTYPE ("optype") @@ -68,6 +69,7 @@ struct cperf_options { uint32_t total_ops; uint32_t segments_nb; uint32_t test_buffer_size; + uint32_t nb_descriptors; uint32_t sessionless:1; uint32_t out_of_place:1; diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 663f53fe26..142165670d 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -341,6 +341,24 @@ parse_segments_nb(struct cperf_options *opts, const char *arg) return 0; } +static int +parse_desc_nb(struct cperf_options *opts, const char *arg) +{ + int ret = parse_uint32_t(&opts->nb_descriptors, arg); + + if (ret) { + RTE_LOG(ERR, USER1, "failed to parse descriptors number\n"); + return -1; + } + + if (opts->nb_descriptors == 0) { + RTE_LOG(ERR, USER1, "invalid descriptors number specified\n"); + return -1; + } + + return 0; +} + static int parse_device_type(struct cperf_options *opts, const char *arg) { @@ -643,6 +661,7 @@ static struct option lgopts[] = { { CPERF_BURST_SIZE, required_argument, 0, 0 }, { CPERF_BUFFER_SIZE, required_argument, 0, 0 }, { CPERF_SEGMENTS_NB, required_argument, 0, 0 }, + { CPERF_DESC_NB, required_argument, 0, 0 }, { CPERF_DEVTYPE, required_argument, 0, 0 }, { CPERF_OPTYPE, required_argument, 0, 0 }, @@ -686,6 +705,7 @@ cperf_options_default(struct cperf_options *opts) opts->pool_sz = 8192; opts->total_ops = 10000000; + opts->nb_descriptors = 2048; opts->buffer_size_list[0] = 64; opts->buffer_size_count = 1; @@ -742,6 +762,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_BURST_SIZE, parse_burst_sz }, { CPERF_BUFFER_SIZE, parse_buffer_sz }, { CPERF_SEGMENTS_NB, parse_segments_nb }, + { CPERF_DESC_NB, parse_desc_nb }, { CPERF_DEVTYPE, parse_device_type }, { CPERF_OPTYPE, parse_op_type }, { CPERF_SESSIONLESS, parse_sessionless }, diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 99f5d3e0b0..7e6ca8e070 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -123,7 +123,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs, }; struct rte_cryptodev_qp_conf qp_conf = { - .nb_descriptors = 2048 + .nb_descriptors = opts->nb_descriptors }; diff --git a/doc/guides/tools/cryptoperf.rst b/doc/guides/tools/cryptoperf.rst index 457f817c02..d2a6f82c56 100644 --- a/doc/guides/tools/cryptoperf.rst +++ b/doc/guides/tools/cryptoperf.rst @@ -325,6 +325,10 @@ The following are the appication command-line options: Set the size of digest. +* ``--desc-nb `` + + Set number of descriptors for each crypto device. + * ``--csv-friendly`` Enable test result output CSV friendly rather than human friendly. -- 2.20.1