| 4525 | } |
| 4526 | |
| 4527 | int |
| 4528 | main(int argc, char** argv) |
| 4529 | { |
| 4530 | int diag; |
| 4531 | portid_t port_id; |
| 4532 | uint16_t count; |
| 4533 | int ret; |
| 4534 | |
| 4535 | #ifdef RTE_EXEC_ENV_WINDOWS |
| 4536 | signal(SIGINT, signal_handler); |
| 4537 | signal(SIGTERM, signal_handler); |
| 4538 | #else |
| 4539 | /* Want read() not to be restarted on signal */ |
| 4540 | struct sigaction action = { |
| 4541 | .sa_handler = signal_handler, |
| 4542 | }; |
| 4543 | |
| 4544 | sigaction(SIGINT, &action, NULL); |
| 4545 | sigaction(SIGTERM, &action, NULL); |
| 4546 | #endif |
| 4547 | |
| 4548 | testpmd_logtype = rte_log_register("testpmd"); |
| 4549 | if (testpmd_logtype < 0) |
| 4550 | rte_exit(EXIT_FAILURE, "Cannot register log type"); |
| 4551 | rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG); |
| 4552 | |
| 4553 | diag = rte_eal_init(argc, argv); |
| 4554 | if (diag < 0) |
| 4555 | rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n", |
| 4556 | rte_strerror(rte_errno)); |
| 4557 | |
| 4558 | /* allocate port structures, and init them */ |
| 4559 | init_port(); |
| 4560 | |
| 4561 | ret = register_eth_event_callback(); |
| 4562 | if (ret != 0) |
| 4563 | rte_exit(EXIT_FAILURE, "Cannot register for ethdev events"); |
| 4564 | |
| 4565 | #ifdef RTE_LIB_PDUMP |
| 4566 | /* initialize packet capture framework */ |
| 4567 | rte_pdump_init(); |
| 4568 | #endif |
| 4569 | |
| 4570 | count = 0; |
| 4571 | RTE_ETH_FOREACH_DEV(port_id) { |
| 4572 | ports_ids[count] = port_id; |
| 4573 | count++; |
| 4574 | } |
| 4575 | nb_ports = (portid_t) count; |
| 4576 | if (nb_ports == 0) |
| 4577 | TESTPMD_LOG(WARNING, "No probed ethernet devices\n"); |
| 4578 | |
| 4579 | set_def_fwd_config(); |
| 4580 | if (nb_lcores == 0) |
| 4581 | rte_exit(EXIT_FAILURE, "No cores defined for forwarding\n" |
| 4582 | "Check the core mask argument\n"); |
| 4583 | |
| 4584 | /* Bitrate/latency stats disabled by default */ |
nothing calls this directly
no test coverage detected