1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
8 #include <rte_cryptodev.h>
9 #include <rte_malloc.h>
11 #include "cperf_options.h"
13 #define AES_BLOCK_SIZE 16
14 #define DES_BLOCK_SIZE 8
24 printf("%s [EAL options] --\n"
25 " --silent: disable options dump\n"
26 " --ptest throughput / latency / verify / pmd-cycleount :"
28 " --pool_sz N: set the number of crypto ops/mbufs allocated\n"
29 " --total-ops N: set the number of total operations performed\n"
30 " --burst-sz N: set the number of packets per burst\n"
31 " --buffer-sz N: set the size of a single packet\n"
32 " --segment-sz N: set the size of the segment to use\n"
33 " --desc-nb N: set number of descriptors for each crypto device\n"
34 " --devtype TYPE: set crypto device type to use\n"
35 " --optype cipher-only / auth-only / cipher-then-auth /\n"
36 " auth-then-cipher / aead : set operation type\n"
37 " --sessionless: enable session-less crypto operations\n"
38 " --out-of-place: enable out-of-place crypto operations\n"
39 " --test-file NAME: set the test vector file path\n"
40 " --test-name NAME: set specific test name section in test file\n"
41 " --cipher-algo ALGO: set cipher algorithm\n"
42 " --cipher-op encrypt / decrypt: set the cipher operation\n"
43 " --cipher-key-sz N: set the cipher key size\n"
44 " --cipher-iv-sz N: set the cipher IV size\n"
45 " --auth-algo ALGO: set auth algorithm\n"
46 " --auth-op generate / verify: set the auth operation\n"
47 " --auth-key-sz N: set the auth key size\n"
48 " --auth-iv-sz N: set the auth IV size\n"
49 " --aead-algo ALGO: set AEAD algorithm\n"
50 " --aead-op encrypt / decrypt: set the AEAD operation\n"
51 " --aead-key-sz N: set the AEAD key size\n"
52 " --aead-iv-sz N: set the AEAD IV size\n"
53 " --aead-aad-sz N: set the AEAD AAD size\n"
54 " --digest-sz N: set the digest size\n"
55 " --pmd-cyclecount-delay-ms N: set delay between enqueue\n"
56 " and dequeue in pmd-cyclecount benchmarking mode\n"
57 " --csv-friendly: enable test result output CSV friendly\n"
58 " -h: prints this help\n",
63 get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
68 for (i = 0; i < map_len; i++) {
70 if (strcmp(str_key, map[i].name) == 0)
78 parse_cperf_test_type(struct cperf_options *opts, const char *arg)
80 struct name_id_map cperftest_namemap[] = {
82 cperf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT],
83 CPERF_TEST_TYPE_THROUGHPUT
86 cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
87 CPERF_TEST_TYPE_VERIFY
90 cperf_test_type_strs[CPERF_TEST_TYPE_LATENCY],
91 CPERF_TEST_TYPE_LATENCY
94 cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
99 int id = get_str_key_id_mapping(
100 (struct name_id_map *)cperftest_namemap,
101 RTE_DIM(cperftest_namemap), arg);
103 RTE_LOG(ERR, USER1, "failed to parse test type");
107 opts->test = (enum cperf_perf_test_type)id;
113 parse_uint32_t(uint32_t *value, const char *arg)
116 unsigned long n = strtoul(arg, &end, 10);
118 if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
124 *value = (uint32_t) n;
130 parse_uint16_t(uint16_t *value, const char *arg)
133 int ret = parse_uint32_t(&val, arg);
138 if (val > UINT16_MAX)
141 *value = (uint16_t) val;
147 parse_range(const char *arg, uint32_t *min, uint32_t *max, uint32_t *inc)
152 char *copy_arg = strdup(arg);
154 if (copy_arg == NULL)
158 token = strtok(copy_arg, ":");
160 /* Parse minimum value */
162 number = strtoul(token, NULL, 10);
164 if (errno == EINVAL || errno == ERANGE ||
172 token = strtok(NULL, ":");
174 /* Parse increment value */
176 number = strtoul(token, NULL, 10);
178 if (errno == EINVAL || errno == ERANGE ||
186 token = strtok(NULL, ":");
188 /* Parse maximum value */
190 number = strtoul(token, NULL, 10);
192 if (errno == EINVAL || errno == ERANGE ||
201 if (strtok(NULL, ":") != NULL)
213 parse_list(const char *arg, uint32_t *list, uint32_t *min, uint32_t *max)
219 char *copy_arg = strdup(arg);
221 if (copy_arg == NULL)
225 token = strtok(copy_arg, ",");
227 /* Parse first value */
229 number = strtoul(token, NULL, 10);
231 if (errno == EINVAL || errno == ERANGE ||
235 list[count++] = number;
241 token = strtok(NULL, ",");
243 while (token != NULL) {
244 if (count == MAX_LIST) {
245 RTE_LOG(WARNING, USER1, "Using only the first %u sizes\n",
250 number = strtoul(token, NULL, 10);
252 if (errno == EINVAL || errno == ERANGE ||
256 list[count++] = number;
263 token = strtok(NULL, ",");
275 parse_total_ops(struct cperf_options *opts, const char *arg)
277 int ret = parse_uint32_t(&opts->total_ops, arg);
280 RTE_LOG(ERR, USER1, "failed to parse total operations count\n");
282 if (opts->total_ops == 0) {
284 "invalid total operations count number specified\n");
292 parse_pool_sz(struct cperf_options *opts, const char *arg)
294 int ret = parse_uint32_t(&opts->pool_sz, arg);
297 RTE_LOG(ERR, USER1, "failed to parse pool size");
302 parse_burst_sz(struct cperf_options *opts, const char *arg)
306 /* Try parsing the argument as a range, if it fails, parse it as a list */
307 if (parse_range(arg, &opts->min_burst_size, &opts->max_burst_size,
308 &opts->inc_burst_size) < 0) {
309 ret = parse_list(arg, opts->burst_size_list,
310 &opts->min_burst_size,
311 &opts->max_burst_size);
313 RTE_LOG(ERR, USER1, "failed to parse burst size/s\n");
316 opts->burst_size_count = ret;
323 parse_buffer_sz(struct cperf_options *opts, const char *arg)
327 /* Try parsing the argument as a range, if it fails, parse it as a list */
328 if (parse_range(arg, &opts->min_buffer_size, &opts->max_buffer_size,
329 &opts->inc_buffer_size) < 0) {
330 ret = parse_list(arg, opts->buffer_size_list,
331 &opts->min_buffer_size,
332 &opts->max_buffer_size);
334 RTE_LOG(ERR, USER1, "failed to parse buffer size/s\n");
337 opts->buffer_size_count = ret;
344 parse_segment_sz(struct cperf_options *opts, const char *arg)
346 int ret = parse_uint32_t(&opts->segment_sz, arg);
349 RTE_LOG(ERR, USER1, "failed to parse segment size\n");
353 if (opts->segment_sz == 0) {
354 RTE_LOG(ERR, USER1, "Segment size has to be bigger than 0\n");
362 parse_desc_nb(struct cperf_options *opts, const char *arg)
364 int ret = parse_uint32_t(&opts->nb_descriptors, arg);
367 RTE_LOG(ERR, USER1, "failed to parse descriptors number\n");
371 if (opts->nb_descriptors == 0) {
372 RTE_LOG(ERR, USER1, "invalid descriptors number specified\n");
380 parse_device_type(struct cperf_options *opts, const char *arg)
382 if (strlen(arg) > (sizeof(opts->device_type) - 1))
385 strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
386 *(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
392 parse_op_type(struct cperf_options *opts, const char *arg)
394 struct name_id_map optype_namemap[] = {
396 cperf_op_type_strs[CPERF_CIPHER_ONLY],
400 cperf_op_type_strs[CPERF_AUTH_ONLY],
404 cperf_op_type_strs[CPERF_CIPHER_THEN_AUTH],
405 CPERF_CIPHER_THEN_AUTH
408 cperf_op_type_strs[CPERF_AUTH_THEN_CIPHER],
409 CPERF_AUTH_THEN_CIPHER
412 cperf_op_type_strs[CPERF_AEAD],
417 int id = get_str_key_id_mapping(optype_namemap,
418 RTE_DIM(optype_namemap), arg);
420 RTE_LOG(ERR, USER1, "invalid opt type specified\n");
424 opts->op_type = (enum cperf_op_type)id;
430 parse_sessionless(struct cperf_options *opts,
431 const char *arg __rte_unused)
433 opts->sessionless = 1;
438 parse_out_of_place(struct cperf_options *opts,
439 const char *arg __rte_unused)
441 opts->out_of_place = 1;
446 parse_test_file(struct cperf_options *opts,
449 opts->test_file = strdup(arg);
450 if (access(opts->test_file, F_OK) != -1)
452 RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");
458 parse_test_name(struct cperf_options *opts,
461 char *test_name = (char *) rte_zmalloc(NULL,
462 sizeof(char) * (strlen(arg) + 3), 0);
463 snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
464 opts->test_name = test_name;
470 parse_silent(struct cperf_options *opts,
471 const char *arg __rte_unused)
479 parse_cipher_algo(struct cperf_options *opts, const char *arg)
482 enum rte_crypto_cipher_algorithm cipher_algo;
484 if (rte_cryptodev_get_cipher_algo_enum(&cipher_algo, arg) < 0) {
485 RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n");
489 opts->cipher_algo = cipher_algo;
495 parse_cipher_op(struct cperf_options *opts, const char *arg)
497 struct name_id_map cipher_op_namemap[] = {
499 rte_crypto_cipher_operation_strings
500 [RTE_CRYPTO_CIPHER_OP_ENCRYPT],
501 RTE_CRYPTO_CIPHER_OP_ENCRYPT },
503 rte_crypto_cipher_operation_strings
504 [RTE_CRYPTO_CIPHER_OP_DECRYPT],
505 RTE_CRYPTO_CIPHER_OP_DECRYPT
509 int id = get_str_key_id_mapping(cipher_op_namemap,
510 RTE_DIM(cipher_op_namemap), arg);
512 RTE_LOG(ERR, USER1, "Invalid cipher operation specified\n");
516 opts->cipher_op = (enum rte_crypto_cipher_operation)id;
522 parse_cipher_key_sz(struct cperf_options *opts, const char *arg)
524 return parse_uint16_t(&opts->cipher_key_sz, arg);
528 parse_cipher_iv_sz(struct cperf_options *opts, const char *arg)
530 return parse_uint16_t(&opts->cipher_iv_sz, arg);
534 parse_auth_algo(struct cperf_options *opts, const char *arg)
536 enum rte_crypto_auth_algorithm auth_algo;
538 if (rte_cryptodev_get_auth_algo_enum(&auth_algo, arg) < 0) {
539 RTE_LOG(ERR, USER1, "Invalid authentication algorithm specified\n");
543 opts->auth_algo = auth_algo;
549 parse_auth_op(struct cperf_options *opts, const char *arg)
551 struct name_id_map auth_op_namemap[] = {
553 rte_crypto_auth_operation_strings
554 [RTE_CRYPTO_AUTH_OP_GENERATE],
555 RTE_CRYPTO_AUTH_OP_GENERATE },
557 rte_crypto_auth_operation_strings
558 [RTE_CRYPTO_AUTH_OP_VERIFY],
559 RTE_CRYPTO_AUTH_OP_VERIFY
563 int id = get_str_key_id_mapping(auth_op_namemap,
564 RTE_DIM(auth_op_namemap), arg);
566 RTE_LOG(ERR, USER1, "invalid authentication operation specified"
571 opts->auth_op = (enum rte_crypto_auth_operation)id;
577 parse_auth_key_sz(struct cperf_options *opts, const char *arg)
579 return parse_uint16_t(&opts->auth_key_sz, arg);
583 parse_digest_sz(struct cperf_options *opts, const char *arg)
585 return parse_uint16_t(&opts->digest_sz, arg);
589 parse_auth_iv_sz(struct cperf_options *opts, const char *arg)
591 return parse_uint16_t(&opts->auth_iv_sz, arg);
595 parse_aead_algo(struct cperf_options *opts, const char *arg)
597 enum rte_crypto_aead_algorithm aead_algo;
599 if (rte_cryptodev_get_aead_algo_enum(&aead_algo, arg) < 0) {
600 RTE_LOG(ERR, USER1, "Invalid AEAD algorithm specified\n");
604 opts->aead_algo = aead_algo;
610 parse_aead_op(struct cperf_options *opts, const char *arg)
612 struct name_id_map aead_op_namemap[] = {
614 rte_crypto_aead_operation_strings
615 [RTE_CRYPTO_AEAD_OP_ENCRYPT],
616 RTE_CRYPTO_AEAD_OP_ENCRYPT },
618 rte_crypto_aead_operation_strings
619 [RTE_CRYPTO_AEAD_OP_DECRYPT],
620 RTE_CRYPTO_AEAD_OP_DECRYPT
624 int id = get_str_key_id_mapping(aead_op_namemap,
625 RTE_DIM(aead_op_namemap), arg);
627 RTE_LOG(ERR, USER1, "invalid AEAD operation specified"
632 opts->aead_op = (enum rte_crypto_aead_operation)id;
638 parse_aead_key_sz(struct cperf_options *opts, const char *arg)
640 return parse_uint16_t(&opts->aead_key_sz, arg);
644 parse_aead_iv_sz(struct cperf_options *opts, const char *arg)
646 return parse_uint16_t(&opts->aead_iv_sz, arg);
650 parse_aead_aad_sz(struct cperf_options *opts, const char *arg)
652 return parse_uint16_t(&opts->aead_aad_sz, arg);
656 parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused)
664 parse_pmd_cyclecount_delay_ms(struct cperf_options *opts,
667 int ret = parse_uint32_t(&opts->pmdcc_delay, arg);
670 RTE_LOG(ERR, USER1, "failed to parse pmd-cyclecount delay\n");
677 typedef int (*option_parser_t)(struct cperf_options *opts,
680 struct long_opt_parser {
681 const char *lgopt_name;
682 option_parser_t parser_fn;
686 static struct option lgopts[] = {
688 { CPERF_PTEST_TYPE, required_argument, 0, 0 },
690 { CPERF_POOL_SIZE, required_argument, 0, 0 },
691 { CPERF_TOTAL_OPS, required_argument, 0, 0 },
692 { CPERF_BURST_SIZE, required_argument, 0, 0 },
693 { CPERF_BUFFER_SIZE, required_argument, 0, 0 },
694 { CPERF_SEGMENT_SIZE, required_argument, 0, 0 },
695 { CPERF_DESC_NB, required_argument, 0, 0 },
697 { CPERF_DEVTYPE, required_argument, 0, 0 },
698 { CPERF_OPTYPE, required_argument, 0, 0 },
700 { CPERF_SILENT, no_argument, 0, 0 },
701 { CPERF_SESSIONLESS, no_argument, 0, 0 },
702 { CPERF_OUT_OF_PLACE, no_argument, 0, 0 },
703 { CPERF_TEST_FILE, required_argument, 0, 0 },
704 { CPERF_TEST_NAME, required_argument, 0, 0 },
706 { CPERF_CIPHER_ALGO, required_argument, 0, 0 },
707 { CPERF_CIPHER_OP, required_argument, 0, 0 },
709 { CPERF_CIPHER_KEY_SZ, required_argument, 0, 0 },
710 { CPERF_CIPHER_IV_SZ, required_argument, 0, 0 },
712 { CPERF_AUTH_ALGO, required_argument, 0, 0 },
713 { CPERF_AUTH_OP, required_argument, 0, 0 },
715 { CPERF_AUTH_KEY_SZ, required_argument, 0, 0 },
716 { CPERF_AUTH_IV_SZ, required_argument, 0, 0 },
718 { CPERF_AEAD_ALGO, required_argument, 0, 0 },
719 { CPERF_AEAD_OP, required_argument, 0, 0 },
721 { CPERF_AEAD_KEY_SZ, required_argument, 0, 0 },
722 { CPERF_AEAD_AAD_SZ, required_argument, 0, 0 },
723 { CPERF_AEAD_IV_SZ, required_argument, 0, 0 },
725 { CPERF_DIGEST_SZ, required_argument, 0, 0 },
727 { CPERF_CSV, no_argument, 0, 0},
729 { CPERF_PMDCC_DELAY_MS, required_argument, 0, 0 },
735 cperf_options_default(struct cperf_options *opts)
737 opts->test = CPERF_TEST_TYPE_THROUGHPUT;
739 opts->pool_sz = 8192;
740 opts->total_ops = 10000000;
741 opts->nb_descriptors = 2048;
743 opts->buffer_size_list[0] = 64;
744 opts->buffer_size_count = 1;
745 opts->max_buffer_size = 64;
746 opts->min_buffer_size = 64;
747 opts->inc_buffer_size = 0;
749 opts->burst_size_list[0] = 32;
750 opts->burst_size_count = 1;
751 opts->max_burst_size = 32;
752 opts->min_burst_size = 32;
753 opts->inc_burst_size = 0;
756 * Will be parsed from command line or set to
757 * maximum buffer size + digest, later
759 opts->segment_sz = 0;
761 strncpy(opts->device_type, "crypto_aesni_mb",
762 sizeof(opts->device_type));
765 opts->op_type = CPERF_CIPHER_THEN_AUTH;
768 opts->test_file = NULL;
769 opts->test_name = NULL;
770 opts->sessionless = 0;
771 opts->out_of_place = 0;
774 opts->cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC;
775 opts->cipher_op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
776 opts->cipher_key_sz = 16;
777 opts->cipher_iv_sz = 16;
779 opts->auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
780 opts->auth_op = RTE_CRYPTO_AUTH_OP_GENERATE;
782 opts->auth_key_sz = 64;
783 opts->auth_iv_sz = 0;
785 opts->aead_key_sz = 0;
786 opts->aead_iv_sz = 0;
787 opts->aead_aad_sz = 0;
789 opts->digest_sz = 12;
791 opts->pmdcc_delay = 0;
795 cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
797 struct long_opt_parser parsermap[] = {
798 { CPERF_PTEST_TYPE, parse_cperf_test_type },
799 { CPERF_SILENT, parse_silent },
800 { CPERF_POOL_SIZE, parse_pool_sz },
801 { CPERF_TOTAL_OPS, parse_total_ops },
802 { CPERF_BURST_SIZE, parse_burst_sz },
803 { CPERF_BUFFER_SIZE, parse_buffer_sz },
804 { CPERF_SEGMENT_SIZE, parse_segment_sz },
805 { CPERF_DESC_NB, parse_desc_nb },
806 { CPERF_DEVTYPE, parse_device_type },
807 { CPERF_OPTYPE, parse_op_type },
808 { CPERF_SESSIONLESS, parse_sessionless },
809 { CPERF_OUT_OF_PLACE, parse_out_of_place },
810 { CPERF_TEST_FILE, parse_test_file },
811 { CPERF_TEST_NAME, parse_test_name },
812 { CPERF_CIPHER_ALGO, parse_cipher_algo },
813 { CPERF_CIPHER_OP, parse_cipher_op },
814 { CPERF_CIPHER_KEY_SZ, parse_cipher_key_sz },
815 { CPERF_CIPHER_IV_SZ, parse_cipher_iv_sz },
816 { CPERF_AUTH_ALGO, parse_auth_algo },
817 { CPERF_AUTH_OP, parse_auth_op },
818 { CPERF_AUTH_KEY_SZ, parse_auth_key_sz },
819 { CPERF_AUTH_IV_SZ, parse_auth_iv_sz },
820 { CPERF_AEAD_ALGO, parse_aead_algo },
821 { CPERF_AEAD_OP, parse_aead_op },
822 { CPERF_AEAD_KEY_SZ, parse_aead_key_sz },
823 { CPERF_AEAD_IV_SZ, parse_aead_iv_sz },
824 { CPERF_AEAD_AAD_SZ, parse_aead_aad_sz },
825 { CPERF_DIGEST_SZ, parse_digest_sz },
826 { CPERF_CSV, parse_csv_friendly},
827 { CPERF_PMDCC_DELAY_MS, parse_pmd_cyclecount_delay_ms},
831 for (i = 0; i < RTE_DIM(parsermap); i++) {
832 if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name,
833 strlen(lgopts[opt_idx].name)) == 0)
834 return parsermap[i].parser_fn(opts, optarg);
841 cperf_options_parse(struct cperf_options *options, int argc, char **argv)
843 int opt, retval, opt_idx;
845 while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) {
849 rte_exit(EXIT_SUCCESS, "Displayed help\n");
853 retval = cperf_opts_parse_long(opt_idx, options);
869 check_cipher_buffer_length(struct cperf_options *options)
871 uint32_t buffer_size, buffer_size_idx = 0;
873 if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC ||
874 options->cipher_algo == RTE_CRYPTO_CIPHER_AES_ECB) {
875 if (options->inc_buffer_size != 0)
876 buffer_size = options->min_buffer_size;
878 buffer_size = options->buffer_size_list[0];
880 while (buffer_size <= options->max_buffer_size) {
881 if ((buffer_size % AES_BLOCK_SIZE) != 0) {
882 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
883 "not suitable for the algorithm selected\n");
887 if (options->inc_buffer_size != 0)
888 buffer_size += options->inc_buffer_size;
890 if (++buffer_size_idx == options->buffer_size_count)
892 buffer_size = options->buffer_size_list[buffer_size_idx];
898 if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC ||
899 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC ||
900 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) {
901 if (options->inc_buffer_size != 0)
902 buffer_size = options->min_buffer_size;
904 buffer_size = options->buffer_size_list[0];
906 while (buffer_size <= options->max_buffer_size) {
907 if ((buffer_size % DES_BLOCK_SIZE) != 0) {
908 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
909 "not suitable for the algorithm selected\n");
913 if (options->inc_buffer_size != 0)
914 buffer_size += options->inc_buffer_size;
916 if (++buffer_size_idx == options->buffer_size_count)
918 buffer_size = options->buffer_size_list[buffer_size_idx];
928 cperf_options_check(struct cperf_options *options)
930 if (options->op_type == CPERF_CIPHER_ONLY)
931 options->digest_sz = 0;
934 * If segment size is not set, assume only one segment,
935 * big enough to contain the largest buffer and the digest
937 if (options->segment_sz == 0)
938 options->segment_sz = options->max_buffer_size +
941 if (options->segment_sz < options->digest_sz) {
943 "Segment size should be at least "
944 "the size of the digest\n");
948 if (options->test == CPERF_TEST_TYPE_VERIFY &&
949 options->test_file == NULL) {
950 RTE_LOG(ERR, USER1, "Define path to the file with test"
955 if (options->test == CPERF_TEST_TYPE_VERIFY &&
956 options->op_type != CPERF_CIPHER_ONLY &&
957 options->test_name == NULL) {
958 RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
959 " from the test vectors.\n");
963 if (options->test_name != NULL && options->test_file == NULL) {
964 RTE_LOG(ERR, USER1, "Define path to the file with test"
969 if (options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY &&
970 options->test_file == NULL) {
971 RTE_LOG(ERR, USER1, "Define path to the file with test"
976 if (options->test == CPERF_TEST_TYPE_VERIFY &&
977 (options->inc_buffer_size != 0 ||
978 options->buffer_size_count > 1)) {
979 RTE_LOG(ERR, USER1, "Only one buffer size is allowed when "
980 "using the verify test.\n");
984 if (options->test == CPERF_TEST_TYPE_VERIFY &&
985 (options->inc_burst_size != 0 ||
986 options->burst_size_count > 1)) {
987 RTE_LOG(ERR, USER1, "Only one burst size is allowed when "
988 "using the verify test.\n");
992 if (options->test == CPERF_TEST_TYPE_PMDCC &&
993 options->pool_sz < options->nb_descriptors) {
994 RTE_LOG(ERR, USER1, "For pmd cyclecount benchmarks, pool size "
995 "must be equal or greater than the number of "
996 "cryptodev descriptors.\n");
1000 if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
1001 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
1003 RTE_CRYPTO_AUTH_OP_GENERATE) {
1004 RTE_LOG(ERR, USER1, "Option cipher then auth must use"
1005 " options: encrypt and generate.\n");
1008 } else if (options->op_type == CPERF_AUTH_THEN_CIPHER) {
1009 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT &&
1011 RTE_CRYPTO_AUTH_OP_VERIFY) {
1012 RTE_LOG(ERR, USER1, "Option auth then cipher must use"
1013 " options: decrypt and verify.\n");
1018 if (options->op_type == CPERF_CIPHER_ONLY ||
1019 options->op_type == CPERF_CIPHER_THEN_AUTH ||
1020 options->op_type == CPERF_AUTH_THEN_CIPHER) {
1021 if (check_cipher_buffer_length(options) < 0)
1029 cperf_options_dump(struct cperf_options *opts)
1033 printf("# Crypto Performance Application Options:\n");
1035 printf("# cperf test: %s\n", cperf_test_type_strs[opts->test]);
1037 printf("# size of crypto op / mbuf pool: %u\n", opts->pool_sz);
1038 printf("# total number of ops: %u\n", opts->total_ops);
1039 if (opts->inc_buffer_size != 0) {
1040 printf("# buffer size:\n");
1041 printf("#\t min: %u\n", opts->min_buffer_size);
1042 printf("#\t max: %u\n", opts->max_buffer_size);
1043 printf("#\t inc: %u\n", opts->inc_buffer_size);
1045 printf("# buffer sizes: ");
1046 for (size_idx = 0; size_idx < opts->buffer_size_count; size_idx++)
1047 printf("%u ", opts->buffer_size_list[size_idx]);
1050 if (opts->inc_burst_size != 0) {
1051 printf("# burst size:\n");
1052 printf("#\t min: %u\n", opts->min_burst_size);
1053 printf("#\t max: %u\n", opts->max_burst_size);
1054 printf("#\t inc: %u\n", opts->inc_burst_size);
1056 printf("# burst sizes: ");
1057 for (size_idx = 0; size_idx < opts->burst_size_count; size_idx++)
1058 printf("%u ", opts->burst_size_list[size_idx]);
1061 printf("\n# segment size: %u\n", opts->segment_sz);
1063 printf("# cryptodev type: %s\n", opts->device_type);
1065 printf("# number of queue pairs per device: %u\n", opts->nb_qps);
1066 printf("# crypto operation: %s\n", cperf_op_type_strs[opts->op_type]);
1067 printf("# sessionless: %s\n", opts->sessionless ? "yes" : "no");
1068 printf("# out of place: %s\n", opts->out_of_place ? "yes" : "no");
1069 if (opts->test == CPERF_TEST_TYPE_PMDCC)
1070 printf("# inter-burst delay: %u ms\n", opts->pmdcc_delay);
1074 if (opts->op_type == CPERF_AUTH_ONLY ||
1075 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1076 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1077 printf("# auth algorithm: %s\n",
1078 rte_crypto_auth_algorithm_strings[opts->auth_algo]);
1079 printf("# auth operation: %s\n",
1080 rte_crypto_auth_operation_strings[opts->auth_op]);
1081 printf("# auth key size: %u\n", opts->auth_key_sz);
1082 printf("# auth iv size: %u\n", opts->auth_iv_sz);
1083 printf("# auth digest size: %u\n", opts->digest_sz);
1087 if (opts->op_type == CPERF_CIPHER_ONLY ||
1088 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1089 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1090 printf("# cipher algorithm: %s\n",
1091 rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
1092 printf("# cipher operation: %s\n",
1093 rte_crypto_cipher_operation_strings[opts->cipher_op]);
1094 printf("# cipher key size: %u\n", opts->cipher_key_sz);
1095 printf("# cipher iv size: %u\n", opts->cipher_iv_sz);
1099 if (opts->op_type == CPERF_AEAD) {
1100 printf("# aead algorithm: %s\n",
1101 rte_crypto_aead_algorithm_strings[opts->aead_algo]);
1102 printf("# aead operation: %s\n",
1103 rte_crypto_aead_operation_strings[opts->aead_op]);
1104 printf("# aead key size: %u\n", opts->aead_key_sz);
1105 printf("# aead iv size: %u\n", opts->aead_iv_sz);
1106 printf("# aead digest size: %u\n", opts->digest_sz);
1107 printf("# aead aad size: %u\n", opts->aead_aad_sz);