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

Function main

dpdk/examples/packet_ordering/main.c:676–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

674}
675
676int
677main(int argc, char **argv)
678{
679 int ret;
680 unsigned nb_ports;
681 unsigned int lcore_id, last_lcore_id, main_lcore_id;
682 uint16_t port_id;
683 uint16_t nb_ports_available;
684 struct worker_thread_args worker_args = {NULL, NULL};
685 struct send_thread_args send_args = {NULL, NULL};
686 struct rte_ring *rx_to_workers;
687 struct rte_ring *workers_to_tx;
688
689 /* catch ctrl-c so we can print on exit */
690 signal(SIGINT, int_handler);
691
692 /* Initialize EAL */
693 ret = rte_eal_init(argc, argv);
694 if (ret < 0)
695 rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
696
697 argc -= ret;
698 argv += ret;
699
700 /* Parse the application specific arguments */
701 ret = parse_args(argc, argv);
702 if (ret < 0)
703 rte_exit(EXIT_FAILURE, "Invalid packet_ordering arguments\n");
704
705 /* Check if we have enough cores */
706 if (rte_lcore_count() < 3)
707 rte_exit(EXIT_FAILURE, "Error, This application needs at "
708 "least 3 logical cores to run:\n"
709 "1 lcore for packet RX\n"
710 "1 lcore for packet TX\n"
711 "and at least 1 lcore for worker threads\n");
712
713 nb_ports = rte_eth_dev_count_avail();
714 if (nb_ports == 0)
715 rte_exit(EXIT_FAILURE, "Error: no ethernet ports detected\n");
716 if (nb_ports != 1 && (nb_ports & 1))
717 rte_exit(EXIT_FAILURE, "Error: number of ports must be even, except "
718 "when using a single port\n");
719
720 mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL,
721 MBUF_POOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
722 rte_socket_id());
723 if (mbuf_pool == NULL)
724 rte_exit(EXIT_FAILURE, "%s\n", rte_strerror(rte_errno));
725
726 nb_ports_available = nb_ports;
727
728 /* initialize all ports */
729 RTE_ETH_FOREACH_DEV(port_id) {
730 /* skip ports that are not enabled */
731 if ((portmask & (1 << port_id)) == 0) {
732 printf("\nSkipping disabled port %d\n", port_id);
733 nb_ports_available--;

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
rte_lcore_countFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_strerrorFunction · 0.85
configure_eth_portFunction · 0.85
rte_ring_createFunction · 0.85
rte_reorder_createFunction · 0.85
get_last_lcore_idFunction · 0.85
rte_get_main_lcoreFunction · 0.85
get_previous_lcore_idFunction · 0.85

Tested by

no test coverage detected