1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2016-2017 Intel Corporation 3 */ 4 5 #include <getopt.h> 6 #include <unistd.h> 7 8 #include <rte_cryptodev.h> 9 #include <rte_malloc.h> 10 #include <rte_ether.h> 11 12 #include "cperf_options.h" 13 #include "cperf_test_vectors.h" 14 15 #define AES_BLOCK_SIZE 16 16 #define DES_BLOCK_SIZE 8 17 18 struct name_id_map { 19 const char *name; 20 uint32_t id; 21 }; 22 23 static void 24 usage(char *progname) 25 { 26 printf("%s [EAL options] --\n" 27 " --silent: disable options dump\n" 28 " --ptest throughput / latency / verify / pmd-cyclecount :" 29 " set test type\n" 30 " --pool_sz N: set the number of crypto ops/mbufs allocated\n" 31 " --total-ops N: set the number of total operations performed\n" 32 " --burst-sz N: set the number of packets per burst\n" 33 " --buffer-sz N: set the size of a single packet\n" 34 " --imix N: set the distribution of packet sizes\n" 35 " --segment-sz N: set the size of the segment to use\n" 36 " --desc-nb N: set number of descriptors for each crypto device\n" 37 " --devtype TYPE: set crypto device type to use\n" 38 " --optype cipher-only / auth-only / cipher-then-auth /\n" 39 " auth-then-cipher / aead : set operation type\n" 40 " --sessionless: enable session-less crypto operations\n" 41 " --out-of-place: enable out-of-place crypto operations\n" 42 " --test-file NAME: set the test vector file path\n" 43 " --test-name NAME: set specific test name section in test file\n" 44 " --cipher-algo ALGO: set cipher algorithm\n" 45 " --cipher-op encrypt / decrypt: set the cipher operation\n" 46 " --cipher-key-sz N: set the cipher key size\n" 47 " --cipher-iv-sz N: set the cipher IV size\n" 48 " --auth-algo ALGO: set auth algorithm\n" 49 " --auth-op generate / verify: set the auth operation\n" 50 " --auth-key-sz N: set the auth key size\n" 51 " --auth-iv-sz N: set the auth IV size\n" 52 " --aead-algo ALGO: set AEAD algorithm\n" 53 " --aead-op encrypt / decrypt: set the AEAD operation\n" 54 " --aead-key-sz N: set the AEAD key size\n" 55 " --aead-iv-sz N: set the AEAD IV size\n" 56 " --aead-aad-sz N: set the AEAD AAD size\n" 57 " --digest-sz N: set the digest size\n" 58 " --pmd-cyclecount-delay-ms N: set delay between enqueue\n" 59 " and dequeue in pmd-cyclecount benchmarking mode\n" 60 " --csv-friendly: enable test result output CSV friendly\n" 61 " --modex-len N: modex length, supported lengths are " 62 "60, 128, 255, 448. Default: 128\n" 63 #ifdef RTE_LIB_SECURITY 64 " --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" 65 " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" 66 " --pdcp-ses-hfn-en: enable session based fixed HFN\n" 67 " --enable-sdap: enable sdap\n" 68 " --docsis-hdr-sz: set DOCSIS header size\n" 69 #endif 70 " -h: prints this help\n", 71 progname); 72 } 73 74 static int 75 get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len, 76 const char *str_key) 77 { 78 unsigned int i; 79 80 for (i = 0; i < map_len; i++) { 81 82 if (strcmp(str_key, map[i].name) == 0) 83 return map[i].id; 84 } 85 86 return -1; 87 } 88 89 static int 90 parse_cperf_test_type(struct cperf_options *opts, const char *arg) 91 { 92 struct name_id_map cperftest_namemap[] = { 93 { 94 cperf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT], 95 CPERF_TEST_TYPE_THROUGHPUT 96 }, 97 { 98 cperf_test_type_strs[CPERF_TEST_TYPE_VERIFY], 99 CPERF_TEST_TYPE_VERIFY 100 }, 101 { 102 cperf_test_type_strs[CPERF_TEST_TYPE_LATENCY], 103 CPERF_TEST_TYPE_LATENCY 104 }, 105 { 106 cperf_test_type_strs[CPERF_TEST_TYPE_PMDCC], 107 CPERF_TEST_TYPE_PMDCC 108 } 109 }; 110 111 int id = get_str_key_id_mapping( 112 (struct name_id_map *)cperftest_namemap, 113 RTE_DIM(cperftest_namemap), arg); 114 if (id < 0) { 115 RTE_LOG(ERR, USER1, "failed to parse test type"); 116 return -1; 117 } 118 119 opts->test = (enum cperf_perf_test_type)id; 120 121 return 0; 122 } 123 124 static int 125 parse_uint32_t(uint32_t *value, const char *arg) 126 { 127 char *end = NULL; 128 unsigned long n = strtoul(arg, &end, 10); 129 130 if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0')) 131 return -1; 132 133 if (n > UINT32_MAX) 134 return -ERANGE; 135 136 *value = (uint32_t) n; 137 138 return 0; 139 } 140 141 static int 142 parse_uint16_t(uint16_t *value, const char *arg) 143 { 144 uint32_t val = 0; 145 int ret = parse_uint32_t(&val, arg); 146 147 if (ret < 0) 148 return ret; 149 150 if (val > UINT16_MAX) 151 return -ERANGE; 152 153 *value = (uint16_t) val; 154 155 return 0; 156 } 157 158 static int 159 parse_range(const char *arg, uint32_t *min, uint32_t *max, uint32_t *inc) 160 { 161 char *token; 162 uint32_t number; 163 164 char *copy_arg = strdup(arg); 165 166 if (copy_arg == NULL) 167 return -1; 168 169 errno = 0; 170 token = strtok(copy_arg, ":"); 171 172 /* Parse minimum value */ 173 if (token != NULL) { 174 number = strtoul(token, NULL, 10); 175 176 if (errno == EINVAL || errno == ERANGE || 177 number == 0) 178 goto err_range; 179 180 *min = number; 181 } else 182 goto err_range; 183 184 token = strtok(NULL, ":"); 185 186 /* Parse increment value */ 187 if (token != NULL) { 188 number = strtoul(token, NULL, 10); 189 190 if (errno == EINVAL || errno == ERANGE || 191 number == 0) 192 goto err_range; 193 194 *inc = number; 195 } else 196 goto err_range; 197 198 token = strtok(NULL, ":"); 199 200 /* Parse maximum value */ 201 if (token != NULL) { 202 number = strtoul(token, NULL, 10); 203 204 if (errno == EINVAL || errno == ERANGE || 205 number == 0 || 206 number < *min) 207 goto err_range; 208 209 *max = number; 210 } else 211 goto err_range; 212 213 if (strtok(NULL, ":") != NULL) 214 goto err_range; 215 216 free(copy_arg); 217 return 0; 218 219 err_range: 220 free(copy_arg); 221 return -1; 222 } 223 224 static int 225 parse_list(const char *arg, uint32_t *list, uint32_t *min, uint32_t *max) 226 { 227 char *token; 228 uint32_t number; 229 uint8_t count = 0; 230 uint32_t temp_min; 231 uint32_t temp_max; 232 233 char *copy_arg = strdup(arg); 234 235 if (copy_arg == NULL) 236 return -1; 237 238 errno = 0; 239 token = strtok(copy_arg, ","); 240 241 /* Parse first value */ 242 if (token != NULL) { 243 number = strtoul(token, NULL, 10); 244 245 if (errno == EINVAL || errno == ERANGE || 246 number == 0) 247 goto err_list; 248 249 list[count++] = number; 250 temp_min = number; 251 temp_max = number; 252 } else 253 goto err_list; 254 255 token = strtok(NULL, ","); 256 257 while (token != NULL) { 258 if (count == MAX_LIST) { 259 RTE_LOG(WARNING, USER1, "Using only the first %u sizes\n", 260 MAX_LIST); 261 break; 262 } 263 264 number = strtoul(token, NULL, 10); 265 266 if (errno == EINVAL || errno == ERANGE || 267 number == 0) 268 goto err_list; 269 270 list[count++] = number; 271 272 if (number < temp_min) 273 temp_min = number; 274 if (number > temp_max) 275 temp_max = number; 276 277 token = strtok(NULL, ","); 278 } 279 280 if (min) 281 *min = temp_min; 282 if (max) 283 *max = temp_max; 284 285 free(copy_arg); 286 return count; 287 288 err_list: 289 free(copy_arg); 290 return -1; 291 } 292 293 static int 294 parse_total_ops(struct cperf_options *opts, const char *arg) 295 { 296 int ret = parse_uint32_t(&opts->total_ops, arg); 297 298 if (ret) 299 RTE_LOG(ERR, USER1, "failed to parse total operations count\n"); 300 301 if (opts->total_ops == 0) { 302 RTE_LOG(ERR, USER1, 303 "invalid total operations count number specified\n"); 304 return -1; 305 } 306 307 return ret; 308 } 309 310 static int 311 parse_pool_sz(struct cperf_options *opts, const char *arg) 312 { 313 int ret = parse_uint32_t(&opts->pool_sz, arg); 314 315 if (ret) 316 RTE_LOG(ERR, USER1, "failed to parse pool size"); 317 return ret; 318 } 319 320 static int 321 parse_modex_len(struct cperf_options *opts, const char *arg) 322 { 323 int ret = parse_uint16_t(&opts->modex_len, arg); 324 325 if (ret) 326 RTE_LOG(ERR, USER1, "failed to parse modex len"); 327 return ret; 328 } 329 330 static int 331 parse_burst_sz(struct cperf_options *opts, const char *arg) 332 { 333 int ret; 334 335 /* Try parsing the argument as a range, if it fails, parse it as a list */ 336 if (parse_range(arg, &opts->min_burst_size, &opts->max_burst_size, 337 &opts->inc_burst_size) < 0) { 338 ret = parse_list(arg, opts->burst_size_list, 339 &opts->min_burst_size, 340 &opts->max_burst_size); 341 if (ret < 0) { 342 RTE_LOG(ERR, USER1, "failed to parse burst size/s\n"); 343 return -1; 344 } 345 opts->burst_size_count = ret; 346 } 347 348 return 0; 349 } 350 351 static int 352 parse_buffer_sz(struct cperf_options *opts, const char *arg) 353 { 354 int ret; 355 356 /* Try parsing the argument as a range, if it fails, parse it as a list */ 357 if (parse_range(arg, &opts->min_buffer_size, &opts->max_buffer_size, 358 &opts->inc_buffer_size) < 0) { 359 ret = parse_list(arg, opts->buffer_size_list, 360 &opts->min_buffer_size, 361 &opts->max_buffer_size); 362 if (ret < 0) { 363 RTE_LOG(ERR, USER1, "failed to parse buffer size/s\n"); 364 return -1; 365 } 366 opts->buffer_size_count = ret; 367 } 368 369 return 0; 370 } 371 372 static int 373 parse_segment_sz(struct cperf_options *opts, const char *arg) 374 { 375 int ret = parse_uint32_t(&opts->segment_sz, arg); 376 377 if (ret) { 378 RTE_LOG(ERR, USER1, "failed to parse segment size\n"); 379 return -1; 380 } 381 382 if (opts->segment_sz == 0) { 383 RTE_LOG(ERR, USER1, "Segment size has to be bigger than 0\n"); 384 return -1; 385 } 386 387 return 0; 388 } 389 390 static int 391 parse_imix(struct cperf_options *opts, const char *arg) 392 { 393 int ret; 394 395 ret = parse_list(arg, opts->imix_distribution_list, 396 NULL, NULL); 397 if (ret < 0) { 398 RTE_LOG(ERR, USER1, "failed to parse imix distribution\n"); 399 return -1; 400 } 401 402 opts->imix_distribution_count = ret; 403 404 if (opts->imix_distribution_count <= 1) { 405 RTE_LOG(ERR, USER1, "imix distribution should have " 406 "at least two entries\n"); 407 return -1; 408 } 409 410 return 0; 411 } 412 413 static int 414 parse_desc_nb(struct cperf_options *opts, const char *arg) 415 { 416 int ret = parse_uint32_t(&opts->nb_descriptors, arg); 417 418 if (ret) { 419 RTE_LOG(ERR, USER1, "failed to parse descriptors number\n"); 420 return -1; 421 } 422 423 if (opts->nb_descriptors == 0) { 424 RTE_LOG(ERR, USER1, "invalid descriptors number specified\n"); 425 return -1; 426 } 427 428 return 0; 429 } 430 431 static int 432 parse_device_type(struct cperf_options *opts, const char *arg) 433 { 434 if (strlen(arg) > (sizeof(opts->device_type) - 1)) 435 return -1; 436 437 strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1); 438 *(opts->device_type + sizeof(opts->device_type) - 1) = '\0'; 439 440 return 0; 441 } 442 443 static int 444 parse_op_type(struct cperf_options *opts, const char *arg) 445 { 446 struct name_id_map optype_namemap[] = { 447 { 448 cperf_op_type_strs[CPERF_CIPHER_ONLY], 449 CPERF_CIPHER_ONLY 450 }, 451 { 452 cperf_op_type_strs[CPERF_AUTH_ONLY], 453 CPERF_AUTH_ONLY 454 }, 455 { 456 cperf_op_type_strs[CPERF_CIPHER_THEN_AUTH], 457 CPERF_CIPHER_THEN_AUTH 458 }, 459 { 460 cperf_op_type_strs[CPERF_AUTH_THEN_CIPHER], 461 CPERF_AUTH_THEN_CIPHER 462 }, 463 { 464 cperf_op_type_strs[CPERF_AEAD], 465 CPERF_AEAD 466 }, 467 { 468 cperf_op_type_strs[CPERF_PDCP], 469 CPERF_PDCP 470 }, 471 { 472 cperf_op_type_strs[CPERF_DOCSIS], 473 CPERF_DOCSIS 474 }, 475 { 476 cperf_op_type_strs[CPERF_IPSEC], 477 CPERF_IPSEC 478 }, 479 { 480 cperf_op_type_strs[CPERF_ASYM_MODEX], 481 CPERF_ASYM_MODEX 482 } 483 }; 484 485 int id = get_str_key_id_mapping(optype_namemap, 486 RTE_DIM(optype_namemap), arg); 487 if (id < 0) { 488 RTE_LOG(ERR, USER1, "invalid opt type specified\n"); 489 return -1; 490 } 491 492 opts->op_type = (enum cperf_op_type)id; 493 494 return 0; 495 } 496 497 static int 498 parse_sessionless(struct cperf_options *opts, 499 const char *arg __rte_unused) 500 { 501 opts->sessionless = 1; 502 return 0; 503 } 504 505 static int 506 parse_out_of_place(struct cperf_options *opts, 507 const char *arg __rte_unused) 508 { 509 opts->out_of_place = 1; 510 return 0; 511 } 512 513 static int 514 parse_test_file(struct cperf_options *opts, 515 const char *arg) 516 { 517 opts->test_file = strdup(arg); 518 if (access(opts->test_file, F_OK) != -1) 519 return 0; 520 RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n"); 521 522 return -1; 523 } 524 525 static int 526 parse_test_name(struct cperf_options *opts, 527 const char *arg) 528 { 529 char *test_name = (char *) rte_zmalloc(NULL, 530 sizeof(char) * (strlen(arg) + 3), 0); 531 if (test_name == NULL) { 532 RTE_LOG(ERR, USER1, "Failed to rte zmalloc with size: %zu\n", 533 strlen(arg) + 3); 534 return -1; 535 } 536 537 snprintf(test_name, strlen(arg) + 3, "[%s]", arg); 538 opts->test_name = test_name; 539 540 return 0; 541 } 542 543 static int 544 parse_silent(struct cperf_options *opts, 545 const char *arg __rte_unused) 546 { 547 opts->silent = 1; 548 549 return 0; 550 } 551 552 static int 553 parse_enable_sdap(struct cperf_options *opts, 554 const char *arg __rte_unused) 555 { 556 opts->pdcp_sdap = 1; 557 558 return 0; 559 } 560 561 static int 562 parse_cipher_algo(struct cperf_options *opts, const char *arg) 563 { 564 565 enum rte_crypto_cipher_algorithm cipher_algo; 566 567 if (rte_cryptodev_get_cipher_algo_enum(&cipher_algo, arg) < 0) { 568 RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n"); 569 return -1; 570 } 571 572 opts->cipher_algo = cipher_algo; 573 574 return 0; 575 } 576 577 static int 578 parse_cipher_op(struct cperf_options *opts, const char *arg) 579 { 580 struct name_id_map cipher_op_namemap[] = { 581 { 582 rte_crypto_cipher_operation_strings 583 [RTE_CRYPTO_CIPHER_OP_ENCRYPT], 584 RTE_CRYPTO_CIPHER_OP_ENCRYPT }, 585 { 586 rte_crypto_cipher_operation_strings 587 [RTE_CRYPTO_CIPHER_OP_DECRYPT], 588 RTE_CRYPTO_CIPHER_OP_DECRYPT 589 } 590 }; 591 592 int id = get_str_key_id_mapping(cipher_op_namemap, 593 RTE_DIM(cipher_op_namemap), arg); 594 if (id < 0) { 595 RTE_LOG(ERR, USER1, "Invalid cipher operation specified\n"); 596 return -1; 597 } 598 599 opts->cipher_op = (enum rte_crypto_cipher_operation)id; 600 601 return 0; 602 } 603 604 static int 605 parse_cipher_key_sz(struct cperf_options *opts, const char *arg) 606 { 607 return parse_uint16_t(&opts->cipher_key_sz, arg); 608 } 609 610 static int 611 parse_cipher_iv_sz(struct cperf_options *opts, const char *arg) 612 { 613 return parse_uint16_t(&opts->cipher_iv_sz, arg); 614 } 615 616 static int 617 parse_auth_algo(struct cperf_options *opts, const char *arg) 618 { 619 enum rte_crypto_auth_algorithm auth_algo; 620 621 if (rte_cryptodev_get_auth_algo_enum(&auth_algo, arg) < 0) { 622 RTE_LOG(ERR, USER1, "Invalid authentication algorithm specified\n"); 623 return -1; 624 } 625 626 opts->auth_algo = auth_algo; 627 628 return 0; 629 } 630 631 static int 632 parse_auth_op(struct cperf_options *opts, const char *arg) 633 { 634 struct name_id_map auth_op_namemap[] = { 635 { 636 rte_crypto_auth_operation_strings 637 [RTE_CRYPTO_AUTH_OP_GENERATE], 638 RTE_CRYPTO_AUTH_OP_GENERATE }, 639 { 640 rte_crypto_auth_operation_strings 641 [RTE_CRYPTO_AUTH_OP_VERIFY], 642 RTE_CRYPTO_AUTH_OP_VERIFY 643 } 644 }; 645 646 int id = get_str_key_id_mapping(auth_op_namemap, 647 RTE_DIM(auth_op_namemap), arg); 648 if (id < 0) { 649 RTE_LOG(ERR, USER1, "invalid authentication operation specified" 650 "\n"); 651 return -1; 652 } 653 654 opts->auth_op = (enum rte_crypto_auth_operation)id; 655 656 return 0; 657 } 658 659 static int 660 parse_auth_key_sz(struct cperf_options *opts, const char *arg) 661 { 662 return parse_uint16_t(&opts->auth_key_sz, arg); 663 } 664 665 static int 666 parse_digest_sz(struct cperf_options *opts, const char *arg) 667 { 668 return parse_uint16_t(&opts->digest_sz, arg); 669 } 670 671 #ifdef RTE_LIB_SECURITY 672 static int 673 parse_pdcp_sn_sz(struct cperf_options *opts, const char *arg) 674 { 675 uint32_t val = 0; 676 int ret = parse_uint32_t(&val, arg); 677 678 if (ret < 0) 679 return ret; 680 681 if (val != RTE_SECURITY_PDCP_SN_SIZE_5 && 682 val != RTE_SECURITY_PDCP_SN_SIZE_7 && 683 val != RTE_SECURITY_PDCP_SN_SIZE_12 && 684 val != RTE_SECURITY_PDCP_SN_SIZE_15 && 685 val != RTE_SECURITY_PDCP_SN_SIZE_18) { 686 printf("\nInvalid pdcp SN size: %u\n", val); 687 return -ERANGE; 688 } 689 opts->pdcp_sn_sz = val; 690 691 return 0; 692 } 693 694 const char *cperf_pdcp_domain_strs[] = { 695 [RTE_SECURITY_PDCP_MODE_CONTROL] = "control", 696 [RTE_SECURITY_PDCP_MODE_DATA] = "data", 697 [RTE_SECURITY_PDCP_MODE_SHORT_MAC] = "short_mac" 698 }; 699 700 static int 701 parse_pdcp_domain(struct cperf_options *opts, const char *arg) 702 { 703 struct name_id_map pdcp_domain_namemap[] = { 704 { 705 cperf_pdcp_domain_strs 706 [RTE_SECURITY_PDCP_MODE_CONTROL], 707 RTE_SECURITY_PDCP_MODE_CONTROL }, 708 { 709 cperf_pdcp_domain_strs 710 [RTE_SECURITY_PDCP_MODE_DATA], 711 RTE_SECURITY_PDCP_MODE_DATA 712 }, 713 { 714 cperf_pdcp_domain_strs 715 [RTE_SECURITY_PDCP_MODE_SHORT_MAC], 716 RTE_SECURITY_PDCP_MODE_SHORT_MAC 717 } 718 }; 719 720 int id = get_str_key_id_mapping(pdcp_domain_namemap, 721 RTE_DIM(pdcp_domain_namemap), arg); 722 if (id < 0) { 723 RTE_LOG(ERR, USER1, "invalid pdcp domain specified" 724 "\n"); 725 return -1; 726 } 727 728 opts->pdcp_domain = (enum rte_security_pdcp_domain)id; 729 730 return 0; 731 } 732 733 static int 734 parse_pdcp_ses_hfn_en(struct cperf_options *opts, const char *arg __rte_unused) 735 { 736 opts->pdcp_ses_hfn_en = 1; 737 return 0; 738 } 739 740 static int 741 parse_docsis_hdr_sz(struct cperf_options *opts, const char *arg) 742 { 743 return parse_uint16_t(&opts->docsis_hdr_sz, arg); 744 } 745 #endif 746 747 static int 748 parse_auth_iv_sz(struct cperf_options *opts, const char *arg) 749 { 750 return parse_uint16_t(&opts->auth_iv_sz, arg); 751 } 752 753 static int 754 parse_aead_algo(struct cperf_options *opts, const char *arg) 755 { 756 enum rte_crypto_aead_algorithm aead_algo; 757 758 if (rte_cryptodev_get_aead_algo_enum(&aead_algo, arg) < 0) { 759 RTE_LOG(ERR, USER1, "Invalid AEAD algorithm specified\n"); 760 return -1; 761 } 762 763 opts->aead_algo = aead_algo; 764 765 return 0; 766 } 767 768 static int 769 parse_aead_op(struct cperf_options *opts, const char *arg) 770 { 771 struct name_id_map aead_op_namemap[] = { 772 { 773 rte_crypto_aead_operation_strings 774 [RTE_CRYPTO_AEAD_OP_ENCRYPT], 775 RTE_CRYPTO_AEAD_OP_ENCRYPT }, 776 { 777 rte_crypto_aead_operation_strings 778 [RTE_CRYPTO_AEAD_OP_DECRYPT], 779 RTE_CRYPTO_AEAD_OP_DECRYPT 780 } 781 }; 782 783 int id = get_str_key_id_mapping(aead_op_namemap, 784 RTE_DIM(aead_op_namemap), arg); 785 if (id < 0) { 786 RTE_LOG(ERR, USER1, "invalid AEAD operation specified" 787 "\n"); 788 return -1; 789 } 790 791 opts->aead_op = (enum rte_crypto_aead_operation)id; 792 793 return 0; 794 } 795 796 static int 797 parse_aead_key_sz(struct cperf_options *opts, const char *arg) 798 { 799 return parse_uint16_t(&opts->aead_key_sz, arg); 800 } 801 802 static int 803 parse_aead_iv_sz(struct cperf_options *opts, const char *arg) 804 { 805 return parse_uint16_t(&opts->aead_iv_sz, arg); 806 } 807 808 static int 809 parse_aead_aad_sz(struct cperf_options *opts, const char *arg) 810 { 811 return parse_uint16_t(&opts->aead_aad_sz, arg); 812 } 813 814 static int 815 parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused) 816 { 817 opts->csv = 1; 818 opts->silent = 1; 819 return 0; 820 } 821 822 static int 823 parse_pmd_cyclecount_delay_ms(struct cperf_options *opts, 824 const char *arg) 825 { 826 int ret = parse_uint32_t(&opts->pmdcc_delay, arg); 827 828 if (ret) { 829 RTE_LOG(ERR, USER1, "failed to parse pmd-cyclecount delay\n"); 830 return -1; 831 } 832 833 return 0; 834 } 835 836 typedef int (*option_parser_t)(struct cperf_options *opts, 837 const char *arg); 838 839 struct long_opt_parser { 840 const char *lgopt_name; 841 option_parser_t parser_fn; 842 843 }; 844 845 static struct option lgopts[] = { 846 847 { CPERF_PTEST_TYPE, required_argument, 0, 0 }, 848 { CPERF_MODEX_LEN, required_argument, 0, 0 }, 849 850 { CPERF_POOL_SIZE, required_argument, 0, 0 }, 851 { CPERF_TOTAL_OPS, required_argument, 0, 0 }, 852 { CPERF_BURST_SIZE, required_argument, 0, 0 }, 853 { CPERF_BUFFER_SIZE, required_argument, 0, 0 }, 854 { CPERF_SEGMENT_SIZE, required_argument, 0, 0 }, 855 { CPERF_DESC_NB, required_argument, 0, 0 }, 856 857 { CPERF_IMIX, required_argument, 0, 0 }, 858 { CPERF_DEVTYPE, required_argument, 0, 0 }, 859 { CPERF_OPTYPE, required_argument, 0, 0 }, 860 861 { CPERF_SILENT, no_argument, 0, 0 }, 862 { CPERF_SESSIONLESS, no_argument, 0, 0 }, 863 { CPERF_OUT_OF_PLACE, no_argument, 0, 0 }, 864 { CPERF_TEST_FILE, required_argument, 0, 0 }, 865 { CPERF_TEST_NAME, required_argument, 0, 0 }, 866 867 { CPERF_CIPHER_ALGO, required_argument, 0, 0 }, 868 { CPERF_CIPHER_OP, required_argument, 0, 0 }, 869 870 { CPERF_CIPHER_KEY_SZ, required_argument, 0, 0 }, 871 { CPERF_CIPHER_IV_SZ, required_argument, 0, 0 }, 872 873 { CPERF_AUTH_ALGO, required_argument, 0, 0 }, 874 { CPERF_AUTH_OP, required_argument, 0, 0 }, 875 876 { CPERF_AUTH_KEY_SZ, required_argument, 0, 0 }, 877 { CPERF_AUTH_IV_SZ, required_argument, 0, 0 }, 878 879 { CPERF_AEAD_ALGO, required_argument, 0, 0 }, 880 { CPERF_AEAD_OP, required_argument, 0, 0 }, 881 882 { CPERF_AEAD_KEY_SZ, required_argument, 0, 0 }, 883 { CPERF_AEAD_AAD_SZ, required_argument, 0, 0 }, 884 { CPERF_AEAD_IV_SZ, required_argument, 0, 0 }, 885 886 { CPERF_DIGEST_SZ, required_argument, 0, 0 }, 887 888 #ifdef RTE_LIB_SECURITY 889 { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, 890 { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, 891 { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, 892 { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, 893 { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, 894 #endif 895 { CPERF_CSV, no_argument, 0, 0}, 896 897 { CPERF_PMDCC_DELAY_MS, required_argument, 0, 0 }, 898 899 { NULL, 0, 0, 0 } 900 }; 901 902 void 903 cperf_options_default(struct cperf_options *opts) 904 { 905 opts->test = CPERF_TEST_TYPE_THROUGHPUT; 906 907 opts->pool_sz = 8192; 908 opts->total_ops = 10000000; 909 opts->nb_descriptors = 2048; 910 911 opts->buffer_size_list[0] = 64; 912 opts->buffer_size_count = 1; 913 opts->max_buffer_size = 64; 914 opts->min_buffer_size = 64; 915 opts->inc_buffer_size = 0; 916 917 opts->burst_size_list[0] = 32; 918 opts->burst_size_count = 1; 919 opts->max_burst_size = 32; 920 opts->min_burst_size = 32; 921 opts->inc_burst_size = 0; 922 923 /* 924 * Will be parsed from command line or set to 925 * maximum buffer size + digest, later 926 */ 927 opts->segment_sz = 0; 928 929 opts->imix_distribution_count = 0; 930 strncpy(opts->device_type, "crypto_aesni_mb", 931 sizeof(opts->device_type)); 932 opts->nb_qps = 1; 933 934 opts->op_type = CPERF_CIPHER_THEN_AUTH; 935 936 opts->silent = 0; 937 opts->test_file = NULL; 938 opts->test_name = NULL; 939 opts->sessionless = 0; 940 opts->out_of_place = 0; 941 opts->csv = 0; 942 943 opts->cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC; 944 opts->cipher_op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; 945 opts->cipher_key_sz = 16; 946 opts->cipher_iv_sz = 16; 947 948 opts->auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC; 949 opts->auth_op = RTE_CRYPTO_AUTH_OP_GENERATE; 950 951 opts->auth_key_sz = 64; 952 opts->auth_iv_sz = 0; 953 954 opts->aead_key_sz = 0; 955 opts->aead_iv_sz = 0; 956 opts->aead_aad_sz = 0; 957 958 opts->digest_sz = 12; 959 960 opts->pmdcc_delay = 0; 961 #ifdef RTE_LIB_SECURITY 962 opts->pdcp_sn_sz = 12; 963 opts->pdcp_domain = RTE_SECURITY_PDCP_MODE_CONTROL; 964 opts->pdcp_ses_hfn_en = 0; 965 opts->pdcp_sdap = 0; 966 opts->docsis_hdr_sz = 17; 967 #endif 968 opts->modex_data = (struct cperf_modex_test_data *)&modex_perf_data[0]; 969 } 970 971 static int 972 cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) 973 { 974 struct long_opt_parser parsermap[] = { 975 { CPERF_PTEST_TYPE, parse_cperf_test_type }, 976 { CPERF_MODEX_LEN, parse_modex_len }, 977 { CPERF_SILENT, parse_silent }, 978 { CPERF_POOL_SIZE, parse_pool_sz }, 979 { CPERF_TOTAL_OPS, parse_total_ops }, 980 { CPERF_BURST_SIZE, parse_burst_sz }, 981 { CPERF_BUFFER_SIZE, parse_buffer_sz }, 982 { CPERF_SEGMENT_SIZE, parse_segment_sz }, 983 { CPERF_DESC_NB, parse_desc_nb }, 984 { CPERF_DEVTYPE, parse_device_type }, 985 { CPERF_OPTYPE, parse_op_type }, 986 { CPERF_SESSIONLESS, parse_sessionless }, 987 { CPERF_OUT_OF_PLACE, parse_out_of_place }, 988 { CPERF_IMIX, parse_imix }, 989 { CPERF_TEST_FILE, parse_test_file }, 990 { CPERF_TEST_NAME, parse_test_name }, 991 { CPERF_CIPHER_ALGO, parse_cipher_algo }, 992 { CPERF_CIPHER_OP, parse_cipher_op }, 993 { CPERF_CIPHER_KEY_SZ, parse_cipher_key_sz }, 994 { CPERF_CIPHER_IV_SZ, parse_cipher_iv_sz }, 995 { CPERF_AUTH_ALGO, parse_auth_algo }, 996 { CPERF_AUTH_OP, parse_auth_op }, 997 { CPERF_AUTH_KEY_SZ, parse_auth_key_sz }, 998 { CPERF_AUTH_IV_SZ, parse_auth_iv_sz }, 999 { CPERF_AEAD_ALGO, parse_aead_algo }, 1000 { CPERF_AEAD_OP, parse_aead_op }, 1001 { CPERF_AEAD_KEY_SZ, parse_aead_key_sz }, 1002 { CPERF_AEAD_IV_SZ, parse_aead_iv_sz }, 1003 { CPERF_AEAD_AAD_SZ, parse_aead_aad_sz }, 1004 { CPERF_DIGEST_SZ, parse_digest_sz }, 1005 #ifdef RTE_LIB_SECURITY 1006 { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, 1007 { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, 1008 { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, 1009 { CPERF_ENABLE_SDAP, parse_enable_sdap }, 1010 { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, 1011 #endif 1012 { CPERF_CSV, parse_csv_friendly}, 1013 { CPERF_PMDCC_DELAY_MS, parse_pmd_cyclecount_delay_ms}, 1014 }; 1015 unsigned int i; 1016 1017 for (i = 0; i < RTE_DIM(parsermap); i++) { 1018 if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name, 1019 strlen(lgopts[opt_idx].name)) == 0) 1020 return parsermap[i].parser_fn(opts, optarg); 1021 } 1022 1023 return -EINVAL; 1024 } 1025 1026 int 1027 cperf_options_parse(struct cperf_options *options, int argc, char **argv) 1028 { 1029 int opt, retval, opt_idx; 1030 1031 while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) { 1032 switch (opt) { 1033 case 'h': 1034 usage(argv[0]); 1035 exit(EXIT_SUCCESS); 1036 break; 1037 /* long options */ 1038 case 0: 1039 retval = cperf_opts_parse_long(opt_idx, options); 1040 if (retval != 0) 1041 return retval; 1042 1043 break; 1044 1045 default: 1046 usage(argv[0]); 1047 return -EINVAL; 1048 } 1049 } 1050 1051 return 0; 1052 } 1053 1054 static int 1055 check_cipher_buffer_length(struct cperf_options *options) 1056 { 1057 uint32_t buffer_size, buffer_size_idx = 0; 1058 1059 if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC || 1060 options->cipher_algo == RTE_CRYPTO_CIPHER_AES_ECB) { 1061 if (options->inc_buffer_size != 0) 1062 buffer_size = options->min_buffer_size; 1063 else 1064 buffer_size = options->buffer_size_list[0]; 1065 1066 while (buffer_size <= options->max_buffer_size) { 1067 if ((buffer_size % AES_BLOCK_SIZE) != 0) { 1068 RTE_LOG(ERR, USER1, "Some of the buffer sizes are " 1069 "not suitable for the algorithm selected\n"); 1070 return -EINVAL; 1071 } 1072 1073 if (options->inc_buffer_size != 0) 1074 buffer_size += options->inc_buffer_size; 1075 else { 1076 if (++buffer_size_idx == options->buffer_size_count) 1077 break; 1078 buffer_size = options->buffer_size_list[buffer_size_idx]; 1079 } 1080 1081 } 1082 } 1083 1084 if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC || 1085 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC || 1086 options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) { 1087 if (options->inc_buffer_size != 0) 1088 buffer_size = options->min_buffer_size; 1089 else 1090 buffer_size = options->buffer_size_list[0]; 1091 1092 while (buffer_size <= options->max_buffer_size) { 1093 if ((buffer_size % DES_BLOCK_SIZE) != 0) { 1094 RTE_LOG(ERR, USER1, "Some of the buffer sizes are " 1095 "not suitable for the algorithm selected\n"); 1096 return -EINVAL; 1097 } 1098 1099 if (options->inc_buffer_size != 0) 1100 buffer_size += options->inc_buffer_size; 1101 else { 1102 if (++buffer_size_idx == options->buffer_size_count) 1103 break; 1104 buffer_size = options->buffer_size_list[buffer_size_idx]; 1105 } 1106 1107 } 1108 } 1109 1110 return 0; 1111 } 1112 1113 #ifdef RTE_LIB_SECURITY 1114 static int 1115 check_docsis_buffer_length(struct cperf_options *options) 1116 { 1117 uint32_t buffer_size, buffer_size_idx = 0; 1118 1119 if (options->inc_buffer_size != 0) 1120 buffer_size = options->min_buffer_size; 1121 else 1122 buffer_size = options->buffer_size_list[0]; 1123 1124 while (buffer_size <= options->max_buffer_size) { 1125 if (buffer_size < (uint32_t)(options->docsis_hdr_sz + 1126 RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)) { 1127 RTE_LOG(ERR, USER1, "Some of the buffer sizes are not " 1128 "valid for DOCSIS\n"); 1129 return -EINVAL; 1130 } 1131 1132 if (options->inc_buffer_size != 0) 1133 buffer_size += options->inc_buffer_size; 1134 else { 1135 if (++buffer_size_idx == options->buffer_size_count) 1136 break; 1137 buffer_size = 1138 options->buffer_size_list[buffer_size_idx]; 1139 } 1140 } 1141 1142 return 0; 1143 } 1144 #endif 1145 1146 static bool 1147 is_valid_chained_op(struct cperf_options *options) 1148 { 1149 if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT && 1150 options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) 1151 return true; 1152 1153 if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT && 1154 options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) 1155 return true; 1156 1157 return false; 1158 } 1159 1160 int 1161 cperf_options_check(struct cperf_options *options) 1162 { 1163 int i; 1164 1165 if (options->op_type == CPERF_CIPHER_ONLY || 1166 options->op_type == CPERF_DOCSIS) 1167 options->digest_sz = 0; 1168 1169 if (options->out_of_place && 1170 options->segment_sz <= options->max_buffer_size) { 1171 RTE_LOG(ERR, USER1, "Out of place mode can only work " 1172 "with non segmented buffers\n"); 1173 return -EINVAL; 1174 } 1175 1176 /* 1177 * If segment size is not set, assume only one segment, 1178 * big enough to contain the largest buffer and the digest 1179 */ 1180 if (options->segment_sz == 0) { 1181 options->segment_sz = options->max_buffer_size + 1182 options->digest_sz; 1183 /* In IPsec operation, packet length will be increased 1184 * by some bytes depend upon the algorithm, so increasing 1185 * the segment size by headroom to cover most of 1186 * the scenarios. 1187 */ 1188 if (options->op_type == CPERF_IPSEC) 1189 options->segment_sz += RTE_PKTMBUF_HEADROOM; 1190 } 1191 1192 if (options->segment_sz < options->digest_sz) { 1193 RTE_LOG(ERR, USER1, 1194 "Segment size should be at least " 1195 "the size of the digest\n"); 1196 return -EINVAL; 1197 } 1198 1199 if ((options->imix_distribution_count != 0) && 1200 (options->imix_distribution_count != 1201 options->buffer_size_count)) { 1202 RTE_LOG(ERR, USER1, "IMIX distribution must have the same " 1203 "number of buffer sizes\n"); 1204 return -EINVAL; 1205 } 1206 1207 if (options->test == CPERF_TEST_TYPE_VERIFY && 1208 options->test_file == NULL) { 1209 RTE_LOG(ERR, USER1, "Define path to the file with test" 1210 " vectors.\n"); 1211 return -EINVAL; 1212 } 1213 1214 if (options->test == CPERF_TEST_TYPE_VERIFY && 1215 options->op_type != CPERF_CIPHER_ONLY && 1216 options->test_name == NULL) { 1217 RTE_LOG(ERR, USER1, "Define test name to get the correct digest" 1218 " from the test vectors.\n"); 1219 return -EINVAL; 1220 } 1221 1222 if (options->test_name != NULL && options->test_file == NULL) { 1223 RTE_LOG(ERR, USER1, "Define path to the file with test" 1224 " vectors.\n"); 1225 return -EINVAL; 1226 } 1227 1228 if (options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY && 1229 options->test_file == NULL) { 1230 RTE_LOG(ERR, USER1, "Define path to the file with test" 1231 " vectors.\n"); 1232 return -EINVAL; 1233 } 1234 1235 if (options->test == CPERF_TEST_TYPE_VERIFY && 1236 (options->inc_buffer_size != 0 || 1237 options->buffer_size_count > 1)) { 1238 RTE_LOG(ERR, USER1, "Only one buffer size is allowed when " 1239 "using the verify test.\n"); 1240 return -EINVAL; 1241 } 1242 1243 if (options->test == CPERF_TEST_TYPE_VERIFY && 1244 (options->inc_burst_size != 0 || 1245 options->burst_size_count > 1)) { 1246 RTE_LOG(ERR, USER1, "Only one burst size is allowed when " 1247 "using the verify test.\n"); 1248 return -EINVAL; 1249 } 1250 1251 if (options->test == CPERF_TEST_TYPE_PMDCC && 1252 options->pool_sz < options->nb_descriptors) { 1253 RTE_LOG(ERR, USER1, "For pmd cyclecount benchmarks, pool size " 1254 "must be equal or greater than the number of " 1255 "cryptodev descriptors.\n"); 1256 return -EINVAL; 1257 } 1258 1259 if (options->test == CPERF_TEST_TYPE_VERIFY && 1260 options->imix_distribution_count > 0) { 1261 RTE_LOG(ERR, USER1, "IMIX is not allowed when " 1262 "using the verify test.\n"); 1263 return -EINVAL; 1264 } 1265 1266 if (options->op_type == CPERF_CIPHER_THEN_AUTH || 1267 options->op_type == CPERF_AUTH_THEN_CIPHER) { 1268 if (!is_valid_chained_op(options)) { 1269 RTE_LOG(ERR, USER1, "Invalid chained operation.\n"); 1270 return -EINVAL; 1271 } 1272 } 1273 1274 if (options->op_type == CPERF_CIPHER_THEN_AUTH) { 1275 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT && 1276 options->auth_op != 1277 RTE_CRYPTO_AUTH_OP_GENERATE) { 1278 RTE_LOG(ERR, USER1, "Option cipher then auth must use" 1279 " options: encrypt and generate.\n"); 1280 return -EINVAL; 1281 } 1282 } 1283 1284 if (options->op_type == CPERF_CIPHER_ONLY || 1285 options->op_type == CPERF_CIPHER_THEN_AUTH || 1286 options->op_type == CPERF_AUTH_THEN_CIPHER) { 1287 if (check_cipher_buffer_length(options) < 0) 1288 return -EINVAL; 1289 } 1290 1291 if (options->modex_len) { 1292 if (options->op_type != CPERF_ASYM_MODEX) { 1293 RTE_LOG(ERR, USER1, "Option modex len should be used only with " 1294 " optype: modex.\n"); 1295 return -EINVAL; 1296 } 1297 1298 for (i = 0; i < (int)RTE_DIM(modex_perf_data); i++) { 1299 if (modex_perf_data[i].modulus.len == 1300 options->modex_len) { 1301 options->modex_data = 1302 (struct cperf_modex_test_data 1303 *)&modex_perf_data[i]; 1304 break; 1305 } 1306 } 1307 if (i == (int)RTE_DIM(modex_perf_data)) { 1308 RTE_LOG(ERR, USER1, 1309 "Option modex len: %d is not supported\n", 1310 options->modex_len); 1311 return -EINVAL; 1312 } 1313 } 1314 1315 #ifdef RTE_LIB_SECURITY 1316 if (options->op_type == CPERF_DOCSIS) { 1317 if (check_docsis_buffer_length(options) < 0) 1318 return -EINVAL; 1319 } 1320 #endif 1321 1322 return 0; 1323 } 1324 1325 void 1326 cperf_options_dump(struct cperf_options *opts) 1327 { 1328 uint8_t size_idx; 1329 1330 printf("# Crypto Performance Application Options:\n"); 1331 printf("#\n"); 1332 printf("# cperf test: %s\n", cperf_test_type_strs[opts->test]); 1333 printf("#\n"); 1334 printf("# size of crypto op / mbuf pool: %u\n", opts->pool_sz); 1335 printf("# total number of ops: %u\n", opts->total_ops); 1336 if (opts->inc_buffer_size != 0) { 1337 printf("# buffer size:\n"); 1338 printf("#\t min: %u\n", opts->min_buffer_size); 1339 printf("#\t max: %u\n", opts->max_buffer_size); 1340 printf("#\t inc: %u\n", opts->inc_buffer_size); 1341 } else { 1342 printf("# buffer sizes: "); 1343 for (size_idx = 0; size_idx < opts->buffer_size_count; size_idx++) 1344 printf("%u ", opts->buffer_size_list[size_idx]); 1345 printf("\n"); 1346 } 1347 if (opts->inc_burst_size != 0) { 1348 printf("# burst size:\n"); 1349 printf("#\t min: %u\n", opts->min_burst_size); 1350 printf("#\t max: %u\n", opts->max_burst_size); 1351 printf("#\t inc: %u\n", opts->inc_burst_size); 1352 } else { 1353 printf("# burst sizes: "); 1354 for (size_idx = 0; size_idx < opts->burst_size_count; size_idx++) 1355 printf("%u ", opts->burst_size_list[size_idx]); 1356 printf("\n"); 1357 } 1358 printf("\n# segment size: %u\n", opts->segment_sz); 1359 printf("#\n"); 1360 printf("# cryptodev type: %s\n", opts->device_type); 1361 printf("#\n"); 1362 printf("# number of queue pairs per device: %u\n", opts->nb_qps); 1363 printf("# crypto operation: %s\n", cperf_op_type_strs[opts->op_type]); 1364 printf("# sessionless: %s\n", opts->sessionless ? "yes" : "no"); 1365 printf("# out of place: %s\n", opts->out_of_place ? "yes" : "no"); 1366 if (opts->test == CPERF_TEST_TYPE_PMDCC) 1367 printf("# inter-burst delay: %u ms\n", opts->pmdcc_delay); 1368 1369 printf("#\n"); 1370 1371 if (opts->op_type == CPERF_AUTH_ONLY || 1372 opts->op_type == CPERF_CIPHER_THEN_AUTH || 1373 opts->op_type == CPERF_AUTH_THEN_CIPHER) { 1374 printf("# auth algorithm: %s\n", 1375 rte_crypto_auth_algorithm_strings[opts->auth_algo]); 1376 printf("# auth operation: %s\n", 1377 rte_crypto_auth_operation_strings[opts->auth_op]); 1378 printf("# auth key size: %u\n", opts->auth_key_sz); 1379 printf("# auth iv size: %u\n", opts->auth_iv_sz); 1380 printf("# auth digest size: %u\n", opts->digest_sz); 1381 printf("#\n"); 1382 } 1383 1384 if (opts->op_type == CPERF_CIPHER_ONLY || 1385 opts->op_type == CPERF_CIPHER_THEN_AUTH || 1386 opts->op_type == CPERF_AUTH_THEN_CIPHER) { 1387 printf("# cipher algorithm: %s\n", 1388 rte_crypto_cipher_algorithm_strings[opts->cipher_algo]); 1389 printf("# cipher operation: %s\n", 1390 rte_crypto_cipher_operation_strings[opts->cipher_op]); 1391 printf("# cipher key size: %u\n", opts->cipher_key_sz); 1392 printf("# cipher iv size: %u\n", opts->cipher_iv_sz); 1393 printf("#\n"); 1394 } 1395 1396 if (opts->op_type == CPERF_AEAD) { 1397 printf("# aead algorithm: %s\n", 1398 rte_crypto_aead_algorithm_strings[opts->aead_algo]); 1399 printf("# aead operation: %s\n", 1400 rte_crypto_aead_operation_strings[opts->aead_op]); 1401 printf("# aead key size: %u\n", opts->aead_key_sz); 1402 printf("# aead iv size: %u\n", opts->aead_iv_sz); 1403 printf("# aead digest size: %u\n", opts->digest_sz); 1404 printf("# aead aad size: %u\n", opts->aead_aad_sz); 1405 printf("#\n"); 1406 } 1407 1408 #ifdef RTE_LIB_SECURITY 1409 if (opts->op_type == CPERF_DOCSIS) { 1410 printf("# docsis header size: %u\n", opts->docsis_hdr_sz); 1411 printf("#\n"); 1412 } 1413 #endif 1414 } 1415