| 674 | } |
| 675 | |
| 676 | int |
| 677 | main(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--; |
nothing calls this directly
no test coverage detected