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
81 cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC],
86 int id = get_str_key_id_mapping(
87 (struct name_id_map *)cperftest_namemap,
88 RTE_DIM(cperftest_namemap), arg);
90 RTE_LOG(ERR, USER1, "failed to parse test type");
94 opts->test = (enum cperf_perf_test_type)id;
100 parse_uint32_t(uint32_t *value, const char *arg)
103 unsigned long n = strtoul(arg, &end, 10);
105 if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
111 *value = (uint32_t) n;
117 parse_uint16_t(uint16_t *value, const char *arg)
120 int ret = parse_uint32_t(&val, arg);
125 if (val > UINT16_MAX)
128 *value = (uint16_t) val;
134 parse_range(const char *arg, uint32_t *min, uint32_t *max, uint32_t *inc)
139 char *copy_arg = strdup(arg);
141 if (copy_arg == NULL)
145 token = strtok(copy_arg, ":");
147 /* Parse minimum value */
149 number = strtoul(token, NULL, 10);
151 if (errno == EINVAL || errno == ERANGE ||
159 token = strtok(NULL, ":");
161 /* Parse increment value */
163 number = strtoul(token, NULL, 10);
165 if (errno == EINVAL || errno == ERANGE ||
173 token = strtok(NULL, ":");
175 /* Parse maximum value */
177 number = strtoul(token, NULL, 10);
179 if (errno == EINVAL || errno == ERANGE ||
188 if (strtok(NULL, ":") != NULL)
200 parse_list(const char *arg, uint32_t *list, uint32_t *min, uint32_t *max)
206 char *copy_arg = strdup(arg);
208 if (copy_arg == NULL)
212 token = strtok(copy_arg, ",");
214 /* Parse first value */
216 number = strtoul(token, NULL, 10);
218 if (errno == EINVAL || errno == ERANGE ||
222 list[count++] = number;
228 token = strtok(NULL, ",");
230 while (token != NULL) {
231 if (count == MAX_LIST) {
232 RTE_LOG(WARNING, USER1, "Using only the first %u sizes\n",
237 number = strtoul(token, NULL, 10);
239 if (errno == EINVAL || errno == ERANGE ||
243 list[count++] = number;
250 token = strtok(NULL, ",");
262 parse_total_ops(struct cperf_options *opts, const char *arg)
264 int ret = parse_uint32_t(&opts->total_ops, arg);
267 RTE_LOG(ERR, USER1, "failed to parse total operations count\n");
269 if (opts->total_ops == 0) {
271 "invalid total operations count number specified\n");
279 parse_pool_sz(struct cperf_options *opts, const char *arg)
281 int ret = parse_uint32_t(&opts->pool_sz, arg);
284 RTE_LOG(ERR, USER1, "failed to parse pool size");
289 parse_burst_sz(struct cperf_options *opts, const char *arg)
293 /* Try parsing the argument as a range, if it fails, parse it as a list */
294 if (parse_range(arg, &opts->min_burst_size, &opts->max_burst_size,
295 &opts->inc_burst_size) < 0) {
296 ret = parse_list(arg, opts->burst_size_list,
297 &opts->min_burst_size,
298 &opts->max_burst_size);
300 RTE_LOG(ERR, USER1, "failed to parse burst size/s\n");
303 opts->burst_size_count = ret;
310 parse_buffer_sz(struct cperf_options *opts, const char *arg)
314 /* Try parsing the argument as a range, if it fails, parse it as a list */
315 if (parse_range(arg, &opts->min_buffer_size, &opts->max_buffer_size,
316 &opts->inc_buffer_size) < 0) {
317 ret = parse_list(arg, opts->buffer_size_list,
318 &opts->min_buffer_size,
319 &opts->max_buffer_size);
321 RTE_LOG(ERR, USER1, "failed to parse buffer size/s\n");
324 opts->buffer_size_count = ret;
331 parse_segment_sz(struct cperf_options *opts, const char *arg)
333 int ret = parse_uint32_t(&opts->segment_sz, arg);
336 RTE_LOG(ERR, USER1, "failed to parse segment size\n");
340 if (opts->segment_sz == 0) {
341 RTE_LOG(ERR, USER1, "Segment size has to be bigger than 0\n");
349 parse_desc_nb(struct cperf_options *opts, const char *arg)
351 int ret = parse_uint32_t(&opts->nb_descriptors, arg);
354 RTE_LOG(ERR, USER1, "failed to parse descriptors number\n");
358 if (opts->nb_descriptors == 0) {
359 RTE_LOG(ERR, USER1, "invalid descriptors number specified\n");
367 parse_device_type(struct cperf_options *opts, const char *arg)
369 if (strlen(arg) > (sizeof(opts->device_type) - 1))
372 strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
373 *(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
379 parse_op_type(struct cperf_options *opts, const char *arg)
381 struct name_id_map optype_namemap[] = {
383 cperf_op_type_strs[CPERF_CIPHER_ONLY],
387 cperf_op_type_strs[CPERF_AUTH_ONLY],
391 cperf_op_type_strs[CPERF_CIPHER_THEN_AUTH],
392 CPERF_CIPHER_THEN_AUTH
395 cperf_op_type_strs[CPERF_AUTH_THEN_CIPHER],
396 CPERF_AUTH_THEN_CIPHER
399 cperf_op_type_strs[CPERF_AEAD],
404 int id = get_str_key_id_mapping(optype_namemap,
405 RTE_DIM(optype_namemap), arg);
407 RTE_LOG(ERR, USER1, "invalid opt type specified\n");
411 opts->op_type = (enum cperf_op_type)id;
417 parse_sessionless(struct cperf_options *opts,
418 const char *arg __rte_unused)
420 opts->sessionless = 1;
425 parse_out_of_place(struct cperf_options *opts,
426 const char *arg __rte_unused)
428 opts->out_of_place = 1;
433 parse_test_file(struct cperf_options *opts,
436 opts->test_file = strdup(arg);
437 if (access(opts->test_file, F_OK) != -1)
439 RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");
445 parse_test_name(struct cperf_options *opts,
448 char *test_name = (char *) rte_zmalloc(NULL,
449 sizeof(char) * (strlen(arg) + 3), 0);
450 snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
451 opts->test_name = test_name;
457 parse_silent(struct cperf_options *opts,
458 const char *arg __rte_unused)
466 parse_cipher_algo(struct cperf_options *opts, const char *arg)
469 enum rte_crypto_cipher_algorithm cipher_algo;
471 if (rte_cryptodev_get_cipher_algo_enum(&cipher_algo, arg) < 0) {
472 RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n");
476 opts->cipher_algo = cipher_algo;
482 parse_cipher_op(struct cperf_options *opts, const char *arg)
484 struct name_id_map cipher_op_namemap[] = {
486 rte_crypto_cipher_operation_strings
487 [RTE_CRYPTO_CIPHER_OP_ENCRYPT],
488 RTE_CRYPTO_CIPHER_OP_ENCRYPT },
490 rte_crypto_cipher_operation_strings
491 [RTE_CRYPTO_CIPHER_OP_DECRYPT],
492 RTE_CRYPTO_CIPHER_OP_DECRYPT
496 int id = get_str_key_id_mapping(cipher_op_namemap,
497 RTE_DIM(cipher_op_namemap), arg);
499 RTE_LOG(ERR, USER1, "Invalid cipher operation specified\n");
503 opts->cipher_op = (enum rte_crypto_cipher_operation)id;
509 parse_cipher_key_sz(struct cperf_options *opts, const char *arg)
511 return parse_uint16_t(&opts->cipher_key_sz, arg);
515 parse_cipher_iv_sz(struct cperf_options *opts, const char *arg)
517 return parse_uint16_t(&opts->cipher_iv_sz, arg);
521 parse_auth_algo(struct cperf_options *opts, const char *arg)
523 enum rte_crypto_auth_algorithm auth_algo;
525 if (rte_cryptodev_get_auth_algo_enum(&auth_algo, arg) < 0) {
526 RTE_LOG(ERR, USER1, "Invalid authentication algorithm specified\n");
530 opts->auth_algo = auth_algo;
536 parse_auth_op(struct cperf_options *opts, const char *arg)
538 struct name_id_map auth_op_namemap[] = {
540 rte_crypto_auth_operation_strings
541 [RTE_CRYPTO_AUTH_OP_GENERATE],
542 RTE_CRYPTO_AUTH_OP_GENERATE },
544 rte_crypto_auth_operation_strings
545 [RTE_CRYPTO_AUTH_OP_VERIFY],
546 RTE_CRYPTO_AUTH_OP_VERIFY
550 int id = get_str_key_id_mapping(auth_op_namemap,
551 RTE_DIM(auth_op_namemap), arg);
553 RTE_LOG(ERR, USER1, "invalid authentication operation specified"
558 opts->auth_op = (enum rte_crypto_auth_operation)id;
564 parse_auth_key_sz(struct cperf_options *opts, const char *arg)
566 return parse_uint16_t(&opts->auth_key_sz, arg);
570 parse_digest_sz(struct cperf_options *opts, const char *arg)
572 return parse_uint16_t(&opts->digest_sz, arg);
576 parse_auth_iv_sz(struct cperf_options *opts, const char *arg)
578 return parse_uint16_t(&opts->auth_iv_sz, arg);
582 parse_aead_algo(struct cperf_options *opts, const char *arg)
584 enum rte_crypto_aead_algorithm aead_algo;
586 if (rte_cryptodev_get_aead_algo_enum(&aead_algo, arg) < 0) {
587 RTE_LOG(ERR, USER1, "Invalid AEAD algorithm specified\n");
591 opts->aead_algo = aead_algo;
597 parse_aead_op(struct cperf_options *opts, const char *arg)
599 struct name_id_map aead_op_namemap[] = {
601 rte_crypto_aead_operation_strings
602 [RTE_CRYPTO_AEAD_OP_ENCRYPT],
603 RTE_CRYPTO_AEAD_OP_ENCRYPT },
605 rte_crypto_aead_operation_strings
606 [RTE_CRYPTO_AEAD_OP_DECRYPT],
607 RTE_CRYPTO_AEAD_OP_DECRYPT
611 int id = get_str_key_id_mapping(aead_op_namemap,
612 RTE_DIM(aead_op_namemap), arg);
614 RTE_LOG(ERR, USER1, "invalid AEAD operation specified"
619 opts->aead_op = (enum rte_crypto_aead_operation)id;
625 parse_aead_key_sz(struct cperf_options *opts, const char *arg)
627 return parse_uint16_t(&opts->aead_key_sz, arg);
631 parse_aead_iv_sz(struct cperf_options *opts, const char *arg)
633 return parse_uint16_t(&opts->aead_iv_sz, arg);
637 parse_aead_aad_sz(struct cperf_options *opts, const char *arg)
639 return parse_uint16_t(&opts->aead_aad_sz, arg);
643 parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused)
651 parse_pmd_cyclecount_delay_ms(struct cperf_options *opts,
654 int ret = parse_uint32_t(&opts->pmdcc_delay, arg);
657 RTE_LOG(ERR, USER1, "failed to parse pmd-cyclecount delay\n");
664 typedef int (*option_parser_t)(struct cperf_options *opts,
667 struct long_opt_parser {
668 const char *lgopt_name;
669 option_parser_t parser_fn;
673 static struct option lgopts[] = {
675 { CPERF_PTEST_TYPE, required_argument, 0, 0 },
677 { CPERF_POOL_SIZE, required_argument, 0, 0 },
678 { CPERF_TOTAL_OPS, required_argument, 0, 0 },
679 { CPERF_BURST_SIZE, required_argument, 0, 0 },
680 { CPERF_BUFFER_SIZE, required_argument, 0, 0 },
681 { CPERF_SEGMENT_SIZE, required_argument, 0, 0 },
682 { CPERF_DESC_NB, required_argument, 0, 0 },
684 { CPERF_DEVTYPE, required_argument, 0, 0 },
685 { CPERF_OPTYPE, required_argument, 0, 0 },
687 { CPERF_SILENT, no_argument, 0, 0 },
688 { CPERF_SESSIONLESS, no_argument, 0, 0 },
689 { CPERF_OUT_OF_PLACE, no_argument, 0, 0 },
690 { CPERF_TEST_FILE, required_argument, 0, 0 },
691 { CPERF_TEST_NAME, required_argument, 0, 0 },
693 { CPERF_CIPHER_ALGO, required_argument, 0, 0 },
694 { CPERF_CIPHER_OP, required_argument, 0, 0 },
696 { CPERF_CIPHER_KEY_SZ, required_argument, 0, 0 },
697 { CPERF_CIPHER_IV_SZ, required_argument, 0, 0 },
699 { CPERF_AUTH_ALGO, required_argument, 0, 0 },
700 { CPERF_AUTH_OP, required_argument, 0, 0 },
702 { CPERF_AUTH_KEY_SZ, required_argument, 0, 0 },
703 { CPERF_AUTH_IV_SZ, required_argument, 0, 0 },
705 { CPERF_AEAD_ALGO, required_argument, 0, 0 },
706 { CPERF_AEAD_OP, required_argument, 0, 0 },
708 { CPERF_AEAD_KEY_SZ, required_argument, 0, 0 },
709 { CPERF_AEAD_AAD_SZ, required_argument, 0, 0 },
710 { CPERF_AEAD_IV_SZ, required_argument, 0, 0 },
712 { CPERF_DIGEST_SZ, required_argument, 0, 0 },
714 { CPERF_CSV, no_argument, 0, 0},
716 { CPERF_PMDCC_DELAY_MS, required_argument, 0, 0 },
722 cperf_options_default(struct cperf_options *opts)
724 opts->test = CPERF_TEST_TYPE_THROUGHPUT;
726 opts->pool_sz = 8192;
727 opts->total_ops = 10000000;
728 opts->nb_descriptors = 2048;
730 opts->buffer_size_list[0] = 64;
731 opts->buffer_size_count = 1;
732 opts->max_buffer_size = 64;
733 opts->min_buffer_size = 64;
734 opts->inc_buffer_size = 0;
736 opts->burst_size_list[0] = 32;
737 opts->burst_size_count = 1;
738 opts->max_burst_size = 32;
739 opts->min_burst_size = 32;
740 opts->inc_burst_size = 0;
743 * Will be parsed from command line or set to
744 * maximum buffer size + digest, later
746 opts->segment_sz = 0;
748 strncpy(opts->device_type, "crypto_aesni_mb",
749 sizeof(opts->device_type));
752 opts->op_type = CPERF_CIPHER_THEN_AUTH;
755 opts->test_file = NULL;
756 opts->test_name = NULL;
757 opts->sessionless = 0;
758 opts->out_of_place = 0;
761 opts->cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC;
762 opts->cipher_op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
763 opts->cipher_key_sz = 16;
764 opts->cipher_iv_sz = 16;
766 opts->auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
767 opts->auth_op = RTE_CRYPTO_AUTH_OP_GENERATE;
769 opts->auth_key_sz = 64;
770 opts->auth_iv_sz = 0;
772 opts->aead_key_sz = 0;
773 opts->aead_iv_sz = 0;
774 opts->aead_aad_sz = 0;
776 opts->digest_sz = 12;
778 opts->pmdcc_delay = 0;
782 cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
784 struct long_opt_parser parsermap[] = {
785 { CPERF_PTEST_TYPE, parse_cperf_test_type },
786 { CPERF_SILENT, parse_silent },
787 { CPERF_POOL_SIZE, parse_pool_sz },
788 { CPERF_TOTAL_OPS, parse_total_ops },
789 { CPERF_BURST_SIZE, parse_burst_sz },
790 { CPERF_BUFFER_SIZE, parse_buffer_sz },
791 { CPERF_SEGMENT_SIZE, parse_segment_sz },
792 { CPERF_DESC_NB, parse_desc_nb },
793 { CPERF_DEVTYPE, parse_device_type },
794 { CPERF_OPTYPE, parse_op_type },
795 { CPERF_SESSIONLESS, parse_sessionless },
796 { CPERF_OUT_OF_PLACE, parse_out_of_place },
797 { CPERF_TEST_FILE, parse_test_file },
798 { CPERF_TEST_NAME, parse_test_name },
799 { CPERF_CIPHER_ALGO, parse_cipher_algo },
800 { CPERF_CIPHER_OP, parse_cipher_op },
801 { CPERF_CIPHER_KEY_SZ, parse_cipher_key_sz },
802 { CPERF_CIPHER_IV_SZ, parse_cipher_iv_sz },
803 { CPERF_AUTH_ALGO, parse_auth_algo },
804 { CPERF_AUTH_OP, parse_auth_op },
805 { CPERF_AUTH_KEY_SZ, parse_auth_key_sz },
806 { CPERF_AUTH_IV_SZ, parse_auth_iv_sz },
807 { CPERF_AEAD_ALGO, parse_aead_algo },
808 { CPERF_AEAD_OP, parse_aead_op },
809 { CPERF_AEAD_KEY_SZ, parse_aead_key_sz },
810 { CPERF_AEAD_IV_SZ, parse_aead_iv_sz },
811 { CPERF_AEAD_AAD_SZ, parse_aead_aad_sz },
812 { CPERF_DIGEST_SZ, parse_digest_sz },
813 { CPERF_CSV, parse_csv_friendly},
814 { CPERF_PMDCC_DELAY_MS, parse_pmd_cyclecount_delay_ms},
818 for (i = 0; i < RTE_DIM(parsermap); i++) {
819 if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name,
820 strlen(lgopts[opt_idx].name)) == 0)
821 return parsermap[i].parser_fn(opts, optarg);
828 cperf_options_parse(struct cperf_options *options, int argc, char **argv)
830 int opt, retval, opt_idx;
832 while ((opt = getopt_long(argc, argv, "", lgopts, &opt_idx)) != EOF) {
837 retval = cperf_opts_parse_long(opt_idx, options);
852 check_cipher_buffer_length(struct cperf_options *options)
854 uint32_t buffer_size, buffer_size_idx = 0;
856 if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC ||
857 options->cipher_algo == RTE_CRYPTO_CIPHER_AES_ECB) {
858 if (options->inc_buffer_size != 0)
859 buffer_size = options->min_buffer_size;
861 buffer_size = options->buffer_size_list[0];
863 while (buffer_size <= options->max_buffer_size) {
864 if ((buffer_size % AES_BLOCK_SIZE) != 0) {
865 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
866 "not suitable for the algorithm selected\n");
870 if (options->inc_buffer_size != 0)
871 buffer_size += options->inc_buffer_size;
873 if (++buffer_size_idx == options->buffer_size_count)
875 buffer_size = options->buffer_size_list[buffer_size_idx];
881 if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC ||
882 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC ||
883 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) {
884 if (options->inc_buffer_size != 0)
885 buffer_size = options->min_buffer_size;
887 buffer_size = options->buffer_size_list[0];
889 while (buffer_size <= options->max_buffer_size) {
890 if ((buffer_size % DES_BLOCK_SIZE) != 0) {
891 RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
892 "not suitable for the algorithm selected\n");
896 if (options->inc_buffer_size != 0)
897 buffer_size += options->inc_buffer_size;
899 if (++buffer_size_idx == options->buffer_size_count)
901 buffer_size = options->buffer_size_list[buffer_size_idx];
911 cperf_options_check(struct cperf_options *options)
913 if (options->op_type == CPERF_CIPHER_ONLY)
914 options->digest_sz = 0;
917 * If segment size is not set, assume only one segment,
918 * big enough to contain the largest buffer and the digest
920 if (options->segment_sz == 0)
921 options->segment_sz = options->max_buffer_size +
924 if (options->segment_sz < options->digest_sz) {
926 "Segment size should be at least "
927 "the size of the digest\n");
931 if (options->test == CPERF_TEST_TYPE_VERIFY &&
932 options->test_file == NULL) {
933 RTE_LOG(ERR, USER1, "Define path to the file with test"
938 if (options->test == CPERF_TEST_TYPE_VERIFY &&
939 options->op_type != CPERF_CIPHER_ONLY &&
940 options->test_name == NULL) {
941 RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
942 " from the test vectors.\n");
946 if (options->test_name != NULL && options->test_file == NULL) {
947 RTE_LOG(ERR, USER1, "Define path to the file with test"
952 if (options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY &&
953 options->test_file == NULL) {
954 RTE_LOG(ERR, USER1, "Define path to the file with test"
959 if (options->test == CPERF_TEST_TYPE_VERIFY &&
960 (options->inc_buffer_size != 0 ||
961 options->buffer_size_count > 1)) {
962 RTE_LOG(ERR, USER1, "Only one buffer size is allowed when "
963 "using the verify test.\n");
967 if (options->test == CPERF_TEST_TYPE_VERIFY &&
968 (options->inc_burst_size != 0 ||
969 options->burst_size_count > 1)) {
970 RTE_LOG(ERR, USER1, "Only one burst size is allowed when "
971 "using the verify test.\n");
975 if (options->test == CPERF_TEST_TYPE_PMDCC &&
976 options->pool_sz < options->nb_descriptors) {
977 RTE_LOG(ERR, USER1, "For pmd cyclecount benchmarks, pool size "
978 "must be equal or greater than the number of "
979 "cryptodev descriptors.\n");
983 if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
984 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
986 RTE_CRYPTO_AUTH_OP_GENERATE) {
987 RTE_LOG(ERR, USER1, "Option cipher then auth must use"
988 " options: encrypt and generate.\n");
991 } else if (options->op_type == CPERF_AUTH_THEN_CIPHER) {
992 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT &&
994 RTE_CRYPTO_AUTH_OP_VERIFY) {
995 RTE_LOG(ERR, USER1, "Option auth then cipher must use"
996 " options: decrypt and verify.\n");
1001 if (options->op_type == CPERF_CIPHER_ONLY ||
1002 options->op_type == CPERF_CIPHER_THEN_AUTH ||
1003 options->op_type == CPERF_AUTH_THEN_CIPHER) {
1004 if (check_cipher_buffer_length(options) < 0)
1012 cperf_options_dump(struct cperf_options *opts)
1016 printf("# Crypto Performance Application Options:\n");
1018 printf("# cperf test: %s\n", cperf_test_type_strs[opts->test]);
1020 printf("# size of crypto op / mbuf pool: %u\n", opts->pool_sz);
1021 printf("# total number of ops: %u\n", opts->total_ops);
1022 if (opts->inc_buffer_size != 0) {
1023 printf("# buffer size:\n");
1024 printf("#\t min: %u\n", opts->min_buffer_size);
1025 printf("#\t max: %u\n", opts->max_buffer_size);
1026 printf("#\t inc: %u\n", opts->inc_buffer_size);
1028 printf("# buffer sizes: ");
1029 for (size_idx = 0; size_idx < opts->buffer_size_count; size_idx++)
1030 printf("%u ", opts->buffer_size_list[size_idx]);
1033 if (opts->inc_burst_size != 0) {
1034 printf("# burst size:\n");
1035 printf("#\t min: %u\n", opts->min_burst_size);
1036 printf("#\t max: %u\n", opts->max_burst_size);
1037 printf("#\t inc: %u\n", opts->inc_burst_size);
1039 printf("# burst sizes: ");
1040 for (size_idx = 0; size_idx < opts->burst_size_count; size_idx++)
1041 printf("%u ", opts->burst_size_list[size_idx]);
1044 printf("\n# segment size: %u\n", opts->segment_sz);
1046 printf("# cryptodev type: %s\n", opts->device_type);
1048 printf("# number of queue pairs per device: %u\n", opts->nb_qps);
1049 printf("# crypto operation: %s\n", cperf_op_type_strs[opts->op_type]);
1050 printf("# sessionless: %s\n", opts->sessionless ? "yes" : "no");
1051 printf("# out of place: %s\n", opts->out_of_place ? "yes" : "no");
1052 if (opts->test == CPERF_TEST_TYPE_PMDCC)
1053 printf("# inter-burst delay: %u ms\n", opts->pmdcc_delay);
1057 if (opts->op_type == CPERF_AUTH_ONLY ||
1058 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1059 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1060 printf("# auth algorithm: %s\n",
1061 rte_crypto_auth_algorithm_strings[opts->auth_algo]);
1062 printf("# auth operation: %s\n",
1063 rte_crypto_auth_operation_strings[opts->auth_op]);
1064 printf("# auth key size: %u\n", opts->auth_key_sz);
1065 printf("# auth iv size: %u\n", opts->auth_iv_sz);
1066 printf("# auth digest size: %u\n", opts->digest_sz);
1070 if (opts->op_type == CPERF_CIPHER_ONLY ||
1071 opts->op_type == CPERF_CIPHER_THEN_AUTH ||
1072 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
1073 printf("# cipher algorithm: %s\n",
1074 rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
1075 printf("# cipher operation: %s\n",
1076 rte_crypto_cipher_operation_strings[opts->cipher_op]);
1077 printf("# cipher key size: %u\n", opts->cipher_key_sz);
1078 printf("# cipher iv size: %u\n", opts->cipher_iv_sz);
1082 if (opts->op_type == CPERF_AEAD) {
1083 printf("# aead algorithm: %s\n",
1084 rte_crypto_aead_algorithm_strings[opts->aead_algo]);
1085 printf("# aead operation: %s\n",
1086 rte_crypto_aead_operation_strings[opts->aead_op]);
1087 printf("# aead key size: %u\n", opts->aead_key_sz);
1088 printf("# aead iv size: %u\n", opts->aead_iv_sz);
1089 printf("# aead digest size: %u\n", opts->digest_sz);
1090 printf("# aead aad size: %u\n", opts->aead_aad_sz);