| 591 | } |
| 592 | |
| 593 | int |
| 594 | main(int argc, char **argv) |
| 595 | { |
| 596 | struct l2fwd_resources *rsrc; |
| 597 | uint16_t nb_ports_available = 0; |
| 598 | uint32_t nb_ports_in_mask = 0; |
| 599 | uint16_t port_id, last_port; |
| 600 | uint32_t nb_mbufs; |
| 601 | uint16_t nb_ports; |
| 602 | int i, ret; |
| 603 | |
| 604 | /* Init EAL. 8< */ |
| 605 | ret = rte_eal_init(argc, argv); |
| 606 | if (ret < 0) |
| 607 | rte_panic("Invalid EAL arguments\n"); |
| 608 | argc -= ret; |
| 609 | argv += ret; |
| 610 | |
| 611 | rsrc = l2fwd_get_rsrc(); |
| 612 | |
| 613 | signal(SIGINT, signal_handler); |
| 614 | signal(SIGTERM, signal_handler); |
| 615 | |
| 616 | /* parse application arguments (after the EAL ones) */ |
| 617 | ret = l2fwd_event_parse_args(argc, argv, rsrc); |
| 618 | if (ret < 0) |
| 619 | rte_panic("Invalid L2FWD arguments\n"); |
| 620 | /* >8 End of init EAL. */ |
| 621 | |
| 622 | printf("MAC updating %s\n", rsrc->mac_updating ? "enabled" : |
| 623 | "disabled"); |
| 624 | |
| 625 | nb_ports = rte_eth_dev_count_avail(); |
| 626 | if (nb_ports == 0) |
| 627 | rte_panic("No Ethernet ports - bye\n"); |
| 628 | |
| 629 | /* check port mask to possible port mask */ |
| 630 | if (rsrc->enabled_port_mask & ~((1 << nb_ports) - 1)) |
| 631 | rte_panic("Invalid portmask; possible (0x%x)\n", |
| 632 | (1 << nb_ports) - 1); |
| 633 | |
| 634 | if (!rsrc->port_pairs) { |
| 635 | last_port = 0; |
| 636 | /* |
| 637 | * Each logical core is assigned a dedicated TX queue on each |
| 638 | * port. |
| 639 | */ |
| 640 | RTE_ETH_FOREACH_DEV(port_id) { |
| 641 | /* skip ports that are not enabled */ |
| 642 | if ((rsrc->enabled_port_mask & (1 << port_id)) == 0) |
| 643 | continue; |
| 644 | |
| 645 | if (nb_ports_in_mask % 2) { |
| 646 | rsrc->dst_ports[port_id] = last_port; |
| 647 | rsrc->dst_ports[last_port] = port_id; |
| 648 | } else { |
| 649 | last_port = port_id; |
| 650 | } |
nothing calls this directly
no test coverage detected