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

Function main

dpdk/examples/l2fwd-keepalive/main.c:521–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521int
522main(int argc, char **argv)
523{
524 struct lcore_queue_conf *qconf;
525 int ret;
526 uint16_t nb_ports;
527 uint16_t nb_ports_available = 0;
528 uint16_t portid, last_port;
529 unsigned lcore_id, rx_lcore_id;
530 unsigned nb_ports_in_mask = 0;
531 unsigned int total_nb_mbufs;
532 struct sigaction signal_handler;
533 struct rte_keepalive_shm *ka_shm;
534
535 memset(&signal_handler, 0, sizeof(signal_handler));
536 terminate_signal_received = 0;
537 signal_handler.sa_handler = &handle_sigterm;
538 if (sigaction(SIGINT, &signal_handler, NULL) == -1 ||
539 sigaction(SIGTERM, &signal_handler, NULL) == -1)
540 rte_exit(EXIT_FAILURE, "SIGNAL\n");
541
542
543 /* init EAL */
544 ret = rte_eal_init(argc, argv);
545 if (ret < 0)
546 rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
547 argc -= ret;
548 argv += ret;
549
550 l2fwd_enabled_port_mask = 0;
551
552 /* parse application arguments (after the EAL ones) */
553 ret = l2fwd_parse_args(argc, argv);
554 if (ret < 0)
555 rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
556
557 nb_ports = rte_eth_dev_count_avail();
558 if (nb_ports == 0)
559 rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
560
561 /* create the mbuf pool */
562 total_nb_mbufs = NB_MBUF_PER_PORT * nb_ports;
563
564 l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool",
565 total_nb_mbufs, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
566 rte_socket_id());
567 if (l2fwd_pktmbuf_pool == NULL)
568 rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
569
570 /* reset l2fwd_dst_ports */
571 for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
572 l2fwd_dst_ports[portid] = 0;
573 last_port = 0;
574
575 /*
576 * Each logical core is assigned a dedicated TX queue on each port.
577 */
578 RTE_ETH_FOREACH_DEV(portid) {

Callers

nothing calls this directly

Calls 15

memsetFunction · 0.85
rte_exitFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
rte_eth_dev_socket_idFunction · 0.85

Tested by

no test coverage detected