4 * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <rte_cryptodev.h>
37 #include <rte_malloc.h>
39 #include "cperf_options.h"
41 #define AES_BLOCK_SIZE 16
42 #define DES_BLOCK_SIZE 8
50 get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
55 for (i = 0; i < map_len; i++) {
57 if (strcmp(str_key, map[i].name) == 0)
65 parse_cperf_test_type(struct cperf_options *opts, const char *arg)
67 struct name_id_map cperftest_namemap[] = {
69 cperf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT],
70 CPERF_TEST_TYPE_THROUGHPUT
73 cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY],
74 CPERF_TEST_TYPE_VERIFY
77 cperf_test_type_strs[CPERF_TEST_TYPE_LATENCY],
78 CPERF_TEST_TYPE_LATENCY
82 int id = get_str_key_id_mapping(
83 (struct name_id_map *)cperftest_namemap,
84 RTE_DIM(cperftest_namemap), arg);
86 RTE_LOG(ERR, USER1, "failed to parse test type");
90 opts->test = (enum cperf_perf_test_type)id;
96 parse_uint32_t(uint32_t *value, const char *arg)
99 unsigned long n = strtoul(arg, &end, 10);
101 if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
107 *value = (uint32_t) n;
113 parse_uint16_t(uint16_t *value, const char *arg)
116 int ret = parse_uint32_t(&val, arg);
121 if (val > UINT16_MAX)
124 *value = (uint16_t) val;
130 parse_range(const char *arg, uint32_t *min, uint32_t *max, uint32_t *inc)
135 char *copy_arg = strdup(arg);
137 if (copy_arg == NULL)
141 token = strtok(copy_arg, ":");
143 /* Parse minimum value */
145 number = strtoul(token, NULL, 10);
147 if (errno == EINVAL || errno == ERANGE ||
155 token = strtok(NULL, ":");
157 /* Parse increment value */
159 number = strtoul(token, NULL, 10);
161 if (errno == EINVAL || errno == ERANGE ||
169 token = strtok(NULL, ":");
171 /* Parse maximum value */
173 number = strtoul(token, NULL, 10);
175 if (errno == EINVAL || errno == ERANGE ||
184 if (strtok(NULL, ":") != NULL)
196 parse_list(const char *arg, uint32_t *list, uint32_t *min, uint32_t *max)
202 char *copy_arg = strdup(arg);
204 if (copy_arg == NULL)
208 token = strtok(copy_arg, ",");
210 /* Parse first value */
212 number = strtoul(token, NULL, 10);
214 if (errno == EINVAL || errno == ERANGE ||
218 list[count++] = number;
224 token = strtok(NULL, ",");
226 while (token != NULL) {
227 if (count == MAX_LIST) {
228 RTE_LOG(WARNING, USER1, "Using only the first %u sizes\n",
233 number = strtoul(token, NULL, 10);
235 if (errno == EINVAL || errno == ERANGE ||
239 list[count++] = number;
246 token = strtok(NULL, ",");
258 parse_total_ops(struct cperf_options *opts, const char *arg)
260 int ret = parse_uint32_t(&opts->total_ops, arg);
263 RTE_LOG(ERR, USER1, "failed to parse total operations count\n");
265 if (opts->total_ops == 0) {
267 "invalid total operations count number specified\n");
275 parse_pool_sz(struct cperf_options *opts, const char *arg)
277 int ret = parse_uint32_t(&opts->pool_sz, arg);
280 RTE_LOG(ERR, USER1, "failed to parse pool size");
285 parse_burst_sz(struct cperf_options *opts, const char *arg)
289 /* Try parsing the argument as a range, if it fails, parse it as a list */
290 if (parse_range(arg, &opts->min_burst_size, &opts->max_burst_size,
291 &opts->inc_burst_size) < 0) {
292 ret = parse_list(arg, opts->burst_size_list,
293 &opts->min_burst_size,
294 &opts->max_burst_size);
296 RTE_LOG(ERR, USER1, "failed to parse burst size/s\n");
299 opts->burst_size_count = ret;
306 parse_buffer_sz(struct cperf_options *opts, const char *arg)
310 /* Try parsing the argument as a range, if it fails, parse it as a list */
311 if (parse_range(arg, &opts->min_buffer_size, &opts->max_buffer_size,
312 &opts->inc_buffer_size) < 0) {
313 ret = parse_list(arg, opts->buffer_size_list,
314 &opts->min_buffer_size,
315 &opts->max_buffer_size);
317 RTE_LOG(ERR, USER1, "failed to parse buffer size/s\n");
320 opts->buffer_size_count = ret;
327 parse_segments_nb(struct cperf_options *opts, const char *arg)
329 int ret = parse_uint32_t(&opts->segments_nb, arg);
332 RTE_LOG(ERR, USER1, "failed to parse segments number\n");
336 if ((opts->segments_nb == 0) || (opts->segments_nb > 255)) {
337 RTE_LOG(ERR, USER1, "invalid segments number specified\n");
345 parse_desc_nb(struct cperf_options *opts, const char *arg)
347 int ret = parse_uint32_t(&opts->nb_descriptors, arg);
350 RTE_LOG(ERR, USER1, "failed to parse descriptors number\n");
354 if (opts->nb_descriptors == 0) {
355 RTE_LOG(ERR, USER1, "invalid descriptors number specified\n");
363 parse_device_type(struct cperf_options *opts, const char *arg)
365 if (strlen(arg) > (sizeof(opts->device_type) - 1))
368 strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
369 *(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
375 parse_op_type(struct cperf_options *opts, const char *arg)
377 struct name_id_map optype_namemap[] = {
379 cperf_op_type_strs[CPERF_CIPHER_ONLY],
383 cperf_op_type_strs[CPERF_AUTH_ONLY],
387 cperf_op_type_strs[CPERF_CIPHER_THEN_AUTH],
388 CPERF_CIPHER_THEN_AUTH
391 cperf_op_type_strs[CPERF_AUTH_THEN_CIPHER],
392 CPERF_AUTH_THEN_CIPHER
395 cperf_op_type_strs[CPERF_AEAD],
400 int id = get_str_key_id_mapping(optype_namemap,
401 RTE_DIM(optype_namemap), arg);
403 RTE_LOG(ERR, USER1, "invalid opt type specified\n");
407 opts->op_type = (enum cperf_op_type)id;
413 parse_sessionless(struct cperf_options *opts,
414 const char *arg __rte_unused)
416 opts->sessionless = 1;
421 parse_out_of_place(struct cperf_options *opts,
422 const char *arg __rte_unused)
424 opts->out_of_place = 1;
429 parse_test_file(struct cperf_options *opts,
432 opts->test_file = strdup(arg);
433 if (access(opts->test_file, F_OK) != -1)
435 RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");
441 parse_test_name(struct cperf_options *opts,
444 char *test_name = (char *) rte_zmalloc(NULL,
445 sizeof(char) * (strlen(arg) + 3), 0);
446 snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
447 opts->test_name = test_name;
453 parse_silent(struct cperf_options *opts,
454 const char *arg __rte_unused)
462 parse_cipher_algo(struct cperf_options *opts, const char *arg)
465 enum rte_crypto_cipher_algorithm cipher_algo;
467 if (rte_cryptodev_get_cipher_algo_enum(&cipher_algo, arg) < 0) {
468 RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n");
472 opts->cipher_algo = cipher_algo;
478 parse_cipher_op(struct cperf_options *opts, const char *arg)
480 struct name_id_map cipher_op_namemap[] = {
482 rte_crypto_cipher_operation_strings
483 [RTE_CRYPTO_CIPHER_OP_ENCRYPT],
484 RTE_CRYPTO_CIPHER_OP_ENCRYPT },
486 rte_crypto_cipher_operation_strings
487 [RTE_CRYPTO_CIPHER_OP_DECRYPT],
488 RTE_CRYPTO_CIPHER_OP_DECRYPT
492 int id = get_str_key_id_mapping(cipher_op_namemap,
493 RTE_DIM(cipher_op_namemap), arg);
495 RTE_LOG(ERR, USER1, "Invalid cipher operation specified\n");
499 opts->cipher_op = (enum rte_crypto_cipher_operation)id;
505 parse_cipher_key_sz(struct cperf_options *opts, const char *arg)
507 return parse_uint16_t(&opts->cipher_key_sz, arg);
511 parse_cipher_iv_sz(struct cperf_options *opts, const char *arg)
513 return parse_uint16_t(&opts->cipher_iv_sz, arg);
517 parse_auth_algo(struct cperf_options *opts, const char *arg)
519 enum rte_crypto_auth_algorithm auth_algo;
521 if (rte_cryptodev_get_auth_algo_enum(&auth_algo, arg) < 0) {
522 RTE_LOG(ERR, USER1, "Invalid authentication algorithm specified\n");
526 opts->auth_algo = auth_algo;
532 parse_auth_op(struct cperf_options *opts, const char *arg)
534 struct name_id_map auth_op_namemap[] = {
536 rte_crypto_auth_operation_strings
537 [RTE_CRYPTO_AUTH_OP_GENERATE],
538 RTE_CRYPTO_AUTH_OP_GENERATE },
540 rte_crypto_auth_operation_strings
541 [RTE_CRYPTO_AUTH_OP_VERIFY],
542 RTE_CRYPTO_AUTH_OP_VERIFY
546 int id = get_str_key_id_mapping(auth_op_namemap,
547 RTE_DIM(auth_op_namemap), arg);
549 RTE_LOG(ERR, USER1, "invalid authentication operation specified"
554 opts->auth_op = (enum rte_crypto_auth_operation)id;
560 parse_auth_key_sz(struct cperf_options *opts, const char *arg)
562 return parse_uint16_t(&opts->auth_key_sz, arg);
566 parse_digest_sz(struct cperf_options *opts, const char *arg)
568 return parse_uint16_t(&opts->digest_sz, arg);
572 parse_auth_iv_sz(struct cperf_options *opts, const char *arg)
574 return parse_uint16_t(&opts->auth_iv_sz, arg);
578 parse_aead_algo(struct cperf_options *opts, const char *arg)
580 enum rte_crypto_aead_algorithm aead_algo;
582 if (rte_cryptodev_get_aead_algo_enum(&aead_algo, arg) < 0) {
583 RTE_LOG(ERR, USER1, "Invalid AEAD algorithm specified\n");
587 opts->aead_algo = aead_algo;
593 parse_aead_op(struct cperf_options *opts, const char *arg)
595 struct name_id_map aead_op_namemap[] = {
597 rte_crypto_aead_operation_strings
598 [RTE_CRYPTO_AEAD_OP_ENCRYPT],
599 RTE_CRYPTO_AEAD_OP_ENCRYPT },
601 rte_crypto_aead_operation_strings
602 [RTE_CRYPTO_AEAD_OP_DECRYPT],
603 RTE_CRYPTO_AEAD_OP_DECRYPT
607 int id = get_str_key_id_mapping(aead_op_namemap,
608 RTE_DIM(aead_op_namemap), arg);
610 RTE_LOG(ERR, USER1, "invalid AEAD operation specified"
615 opts->aead_op = (enum rte_crypto_aead_operation)id;
621 parse_aead_key_sz(struct cperf_options *opts, const char *arg)
623 return parse_uint16_t(&opts->aead_key_sz, arg);
627 parse_aead_iv_sz(struct cperf_options *opts, const char *arg)
629 return parse_uint16_t(&opts->aead_iv_sz, arg);
633 parse_aead_aad_sz(struct cperf_options *opts, const char *arg)
635 return parse_uint16_t(&opts->aead_aad_sz, arg);
639 parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused)
646 typedef int (*option_parser_t)(struct cperf_options *opts,
649 struct long_opt_parser {
650 const char *lgopt_name;
651 option_parser_t parser_fn;
655 static struct option lgopts[] = {
657 { CPERF_PTEST_TYPE, required_argument, 0, 0 },
659 { CPERF_POOL_SIZE, required_argument, 0, 0 },
660 { CPERF_TOTAL_OPS, required_argument, 0, 0 },
661 { CPERF_BURST_SIZE, required_argument, 0, 0 },
662 { CPERF_BUFFER_SIZE, required_argument, 0, 0 },
663 { CPERF_SEGMENTS_NB, required_argument, 0, 0 },
664 { CPERF_DESC_NB, required_argument, 0, 0 },
666 { CPERF_DEVTYPE, required_argument, 0, 0 },
667 { CPERF_OPTYPE, required_argument, 0, 0 },
669 { CPERF_SILENT, no_argument, 0, 0 },
670 { CPERF_SESSIONLESS, no_argument, 0, 0 },
671 { CPERF_OUT_OF_PLACE, no_argument, 0, 0 },
672 { CPERF_TEST_FILE, required_argument, 0, 0 },
673 { CPERF_TEST_NAME, required_argument, 0, 0 },
675 { CPERF_CIPHER_ALGO, required_argument, 0, 0 },
676 { CPERF_CIPHER_OP, required_argument, 0, 0 },
678 { CPERF_CIPHER_KEY_SZ, required_argument, 0, 0 },
679 { CPERF_CIPHER_IV_SZ, required_argument, 0, 0 },
681 { CPERF_AUTH_ALGO, required_argument, 0, 0 },
682 { CPERF_AUTH_OP, required_argument, 0, 0 },
684 { CPERF_AUTH_KEY_SZ, required_argument, 0, 0 },
685 { CPERF_AUTH_IV_SZ, required_argument, 0, 0 },
687 { CPERF_AEAD_ALGO, required_argument, 0, 0 },
688 { CPERF_AEAD_OP, required_argument, 0, 0 },
690 { CPERF_AEAD_KEY_SZ, required_argument, 0, 0 },
691 { CPERF_AEAD_AAD_SZ, required_argument, 0, 0 },
692 { CPERF_AEAD_IV_SZ, required_argument, 0, 0 },
694 { CPERF_DIGEST_SZ, required_argument, 0, 0 },
696 { CPERF_CSV, no_argument, 0, 0},
702 cperf_options_default(struct cperf_options *opts)
704 opts->test = CPERF_TEST_TYPE_THROUGHPUT;
706 opts->pool_sz = 8192;
707 opts->total_ops = 10000000;
708 opts->nb_descriptors = 2048;
710 opts->buffer_size_list[0] = 64;
711 opts->buffer_size_count = 1;
712 opts->max_buffer_size = 64;
713 opts->min_buffer_size = 64;
714 opts->inc_buffer_size = 0;
716 opts->burst_size_list[0] = 32;
717 opts->burst_size_count = 1;
718 opts->max_burst_size = 32;
719 opts->min_burst_size = 32;
720 opts->inc_burst_size = 0;
722 opts->segments_nb = 1;
724 strncpy(opts->device_type, "crypto_aesni_mb",
725 sizeof(opts->device_type));
727 opts->op_type = CPERF_CIPHER_THEN_AUTH;
730 opts->test_file = NULL;
731 opts->test_name = NULL;
732 opts->sessionless = 0;
733 opts->out_of_place = 0;
736 opts->cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC;
737 opts->cipher_op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
738 opts->cipher_key_sz = 16;
739 opts->cipher_iv_sz = 16;
741 opts->auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
742 opts->auth_op = RTE_CRYPTO_AUTH_OP_GENERATE;
744 opts->auth_key_sz = 64;
745 opts->auth_iv_sz = 0;
747 opts->aead_key_sz = 0;
748 opts->aead_iv_sz = 0;
749 opts->aead_aad_sz = 0;
751 opts->digest_sz = 12;
755 cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
757 struct long_opt_parser parsermap[] = {
758 { CPERF_PTEST_TYPE, parse_cperf_test_type },
759 { CPERF_SILENT, parse_silent },
760 { CPERF_POOL_SIZE, parse_pool_sz },
761 { CPERF_TOTAL_OPS, parse_total_ops },
762 { CPERF_BURST_SIZE, parse_burst_sz },
763 { CPERF_BUFFER_SIZE, parse_buffer_sz },
764 { CPERF_SEGMENTS_NB, parse_segments_nb },
765 { CPERF_DESC_NB, parse_desc_nb },
766 { CPERF_DEVTYPE, parse_device_type },
767 { CPERF_OPTYPE, parse_op_type },
768 { CPERF_SESSIONLESS, parse_sessionless },
769 { CPERF_OUT_OF_PLACE, parse_out_of_place },
770 { CPERF_TEST_FILE, parse_test_file },
771 { CPERF_TEST_NAME, parse_test_name },
772 { CPERF_CIPHER_ALGO, parse_cipher_algo },
773 { CPERF_CIPHER_OP, parse_cipher_op },
774 { CPERF_CIPHER_KEY_SZ, parse_cipher_key_sz },
775 { CPERF_CIPHER_IV_SZ, parse_cipher_iv_sz },
776 { CPERF_AUTH_ALGO, parse_auth_algo },
777 { CPERF_AUTH_OP, parse_auth_op },
778 { CPERF_AUTH_KEY_SZ, parse_auth_key_sz },
779 { CPERF_AUTH_IV_SZ, parse_auth_iv_sz },
780 { CPERF_AEAD_ALGO, parse_aead_algo },
781 { CPERF_AEAD_OP, parse_aead_op },
782 { CPERF_AEAD_KEY_SZ, parse_aead_key_sz },
783 { CPERF_AEAD_IV_SZ, parse_aead_iv_sz },
784 { CPERF_AEAD_AAD_SZ, parse_aead_aad_sz },
785 { CPERF_DIGEST_SZ, parse_digest_sz },
786 { CPERF_CSV, parse_csv_friendly},
790 for (i = 0; i < RTE_DIM(parsermap); i++) {
791 if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name,
792 strlen(lgopts[opt_idx].name)) == 0)
793 return parsermap[i].parser_fn(opts, optarg);
800 cperf_options_parse(struct cperf_options *options, int argc, char **argv)
802 int opt, retval, opt_idx;
804 while ((opt = getopt_long(argc, argv, "", lgopts, &opt_idx)) != EOF) {
809 retval = cperf_opts_parse_long(opt_idx, options);
824 check_cipher_buffer_length(struct cperf_options *options)
826 uint32_t buffer_size, buffer_size_idx = 0;
828 if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC ||
829 options->cipher_algo == RTE_CRYPTO_CIPHER_AES_ECB) {
830 if (options->inc_buffer_size != 0)
831 buffer_size = options->min_buffer_size;
833 buffer_size = options->buffer_size_list[0];
835 while (buffer_size <= options->max_buffer_size) {
836 if ((buffer_size % AES_BLOCK_SIZE) != 0) {
837 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
838 "not suitable for the algorithm selected\n");
842 if (options->inc_buffer_size != 0)
843 buffer_size += options->inc_buffer_size;
845 if (++buffer_size_idx == options->buffer_size_count)
847 buffer_size = options->buffer_size_list[buffer_size_idx];
853 if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC ||
854 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC ||
855 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) {
856 for (buffer_size = options->min_buffer_size;
857 buffer_size < options->max_buffer_size;
858 buffer_size += options->inc_buffer_size) {
859 if ((buffer_size % DES_BLOCK_SIZE) != 0) {
860 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
861 "not suitable for the algorithm selected\n");
871 cperf_options_check(struct cperf_options *options)
873 if (options->segments_nb > options->min_buffer_size) {
875 "Segments number greater than buffer size.\n");
879 if (options->test == CPERF_TEST_TYPE_VERIFY &&
880 options->test_file == NULL) {
881 RTE_LOG(ERR, USER1, "Define path to the file with test"
886 if (options->test == CPERF_TEST_TYPE_VERIFY &&
887 options->op_type != CPERF_CIPHER_ONLY &&
888 options->test_name == NULL) {
889 RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
890 " from the test vectors.\n");
894 if (options->test_name != NULL && options->test_file == NULL) {
895 RTE_LOG(ERR, USER1, "Define path to the file with test"
900 if (options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY &&
901 options->test_file == NULL) {
902 RTE_LOG(ERR, USER1, "Define path to the file with test"
907 if (options->test == CPERF_TEST_TYPE_VERIFY &&
908 options->total_ops > options->pool_sz) {
909 RTE_LOG(ERR, USER1, "Total number of ops must be less than or"
910 " equal to the pool size.\n");
914 if (options->test == CPERF_TEST_TYPE_VERIFY &&
915 (options->inc_buffer_size != 0 ||
916 options->buffer_size_count > 1)) {
917 RTE_LOG(ERR, USER1, "Only one buffer size is allowed when "
918 "using the verify test.\n");
922 if (options->test == CPERF_TEST_TYPE_VERIFY &&
923 (options->inc_burst_size != 0 ||
924 options->burst_size_count > 1)) {
925 RTE_LOG(ERR, USER1, "Only one burst size is allowed when "
926 "using the verify test.\n");
930 if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
931 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
933 RTE_CRYPTO_AUTH_OP_GENERATE) {
934 RTE_LOG(ERR, USER1, "Option cipher then auth must use"
935 " options: encrypt and generate.\n");
938 } else if (options->op_type == CPERF_AUTH_THEN_CIPHER) {
939 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT &&
941 RTE_CRYPTO_AUTH_OP_VERIFY) {
942 RTE_LOG(ERR, USER1, "Option auth then cipher must use"
943 " options: decrypt and verify.\n");
948 if (options->op_type == CPERF_CIPHER_ONLY ||
949 options->op_type == CPERF_CIPHER_THEN_AUTH ||
950 options->op_type == CPERF_AUTH_THEN_CIPHER) {
951 if (check_cipher_buffer_length(options) < 0)
959 cperf_options_dump(struct cperf_options *opts)
963 printf("# Crypto Performance Application Options:\n");
965 printf("# cperf test: %s\n", cperf_test_type_strs[opts->test]);
967 printf("# size of crypto op / mbuf pool: %u\n", opts->pool_sz);
968 printf("# total number of ops: %u\n", opts->total_ops);
969 if (opts->inc_buffer_size != 0) {
970 printf("# buffer size:\n");
971 printf("#\t min: %u\n", opts->min_buffer_size);
972 printf("#\t max: %u\n", opts->max_buffer_size);
973 printf("#\t inc: %u\n", opts->inc_buffer_size);
975 printf("# buffer sizes: ");
976 for (size_idx = 0; size_idx < opts->buffer_size_count; size_idx++)
977 printf("%u ", opts->buffer_size_list[size_idx]);
980 if (opts->inc_burst_size != 0) {
981 printf("# burst size:\n");
982 printf("#\t min: %u\n", opts->min_burst_size);
983 printf("#\t max: %u\n", opts->max_burst_size);
984 printf("#\t inc: %u\n", opts->inc_burst_size);
986 printf("# burst sizes: ");
987 for (size_idx = 0; size_idx < opts->burst_size_count; size_idx++)
988 printf("%u ", opts->burst_size_list[size_idx]);
991 printf("\n# segments per buffer: %u\n", opts->segments_nb);
993 printf("# cryptodev type: %s\n", opts->device_type);
995 printf("# crypto operation: %s\n", cperf_op_type_strs[opts->op_type]);
996 printf("# sessionless: %s\n", opts->sessionless ? "yes" : "no");
997 printf("# out of place: %s\n", opts->out_of_place ? "yes" : "no");
1001 if (opts->op_type == CPERF_AUTH_ONLY ||
1002 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1003 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1004 printf("# auth algorithm: %s\n",
1005 rte_crypto_auth_algorithm_strings[opts->auth_algo]);
1006 printf("# auth operation: %s\n",
1007 rte_crypto_auth_operation_strings[opts->auth_op]);
1008 printf("# auth key size: %u\n", opts->auth_key_sz);
1009 printf("# auth iv size: %u\n", opts->auth_iv_sz);
1010 printf("# auth digest size: %u\n", opts->digest_sz);
1014 if (opts->op_type == CPERF_CIPHER_ONLY ||
1015 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1016 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1017 printf("# cipher algorithm: %s\n",
1018 rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
1019 printf("# cipher operation: %s\n",
1020 rte_crypto_cipher_operation_strings[opts->cipher_op]);
1021 printf("# cipher key size: %u\n", opts->cipher_key_sz);
1022 printf("# cipher iv size: %u\n", opts->cipher_iv_sz);
1026 if (opts->op_type == CPERF_AEAD) {
1027 printf("# aead algorithm: %s\n",
1028 rte_crypto_aead_algorithm_strings[opts->aead_algo]);
1029 printf("# aead operation: %s\n",
1030 rte_crypto_aead_operation_strings[opts->aead_op]);
1031 printf("# aead key size: %u\n", opts->aead_key_sz);
1032 printf("# aead iv size: %u\n", opts->aead_iv_sz);
1033 printf("# aead digest size: %u\n", opts->digest_sz);
1034 printf("# aead aad size: %u\n", opts->aead_aad_sz);