* Start DPDK EAL with arguments. * Unlike most DPDK programs, this application does not use the * typical EAL command line arguments. * We don't want to expose all the DPDK internals to the user. */
| 601 | * We don't want to expose all the DPDK internals to the user. |
| 602 | */ |
| 603 | static void dpdk_init(void) |
| 604 | { |
| 605 | static const char * const args[] = { |
| 606 | "dumpcap", "--proc-type", "secondary", |
| 607 | "--log-level", "notice" |
| 608 | }; |
| 609 | int eal_argc = RTE_DIM(args); |
| 610 | char **eal_argv; |
| 611 | unsigned int i; |
| 612 | |
| 613 | if (file_prefix != NULL) |
| 614 | eal_argc += 2; |
| 615 | |
| 616 | /* DPDK API requires mutable versions of command line arguments. */ |
| 617 | eal_argv = calloc(eal_argc + 1, sizeof(char *)); |
| 618 | if (eal_argv == NULL) |
| 619 | rte_panic("No memory\n"); |
| 620 | |
| 621 | eal_argv[0] = strdup(progname); |
| 622 | for (i = 1; i < RTE_DIM(args); i++) |
| 623 | eal_argv[i] = strdup(args[i]); |
| 624 | |
| 625 | if (file_prefix != NULL) { |
| 626 | eal_argv[i++] = strdup("--file-prefix"); |
| 627 | eal_argv[i++] = strdup(file_prefix); |
| 628 | } |
| 629 | |
| 630 | for (i = 0; i < (unsigned int)eal_argc; i++) { |
| 631 | if (eal_argv[i] == NULL) |
| 632 | rte_panic("No memory\n"); |
| 633 | } |
| 634 | |
| 635 | if (rte_eal_init(eal_argc, eal_argv) < 0) |
| 636 | rte_exit(EXIT_FAILURE, "EAL init failed: is primary process running?\n"); |
| 637 | } |
| 638 | |
| 639 | /* Create packet ring shared between callbacks and process */ |
| 640 | static struct rte_ring *create_ring(void) |
no test coverage detected