MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dpdk_init

Function dpdk_init

dpdk/app/dumpcap/main.c:603–637  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

601 * We don't want to expose all the DPDK internals to the user.
602 */
603static 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 */
640static struct rte_ring *create_ring(void)

Callers 1

mainFunction · 0.85

Calls 4

callocFunction · 0.85
strdupFunction · 0.85
rte_exitFunction · 0.85
rte_eal_initFunction · 0.50

Tested by

no test coverage detected