| 971 | } |
| 972 | |
| 973 | int |
| 974 | main(int argc, char **argv) |
| 975 | { |
| 976 | struct sigaction action = { |
| 977 | .sa_flags = SA_RESTART, |
| 978 | .sa_handler = signal_handler, |
| 979 | }; |
| 980 | struct sigaction origaction; |
| 981 | int diag; |
| 982 | int ret; |
| 983 | int i; |
| 984 | |
| 985 | char n_flag[] = "-n4"; |
| 986 | char mp_flag[] = "--proc-type=secondary"; |
| 987 | char *argp[argc + 2]; |
| 988 | |
| 989 | /* catch ctrl-c so we can cleanup on exit */ |
| 990 | sigemptyset(&action.sa_mask); |
| 991 | sigaction(SIGTERM, &action, NULL); |
| 992 | sigaction(SIGINT, &action, NULL); |
| 993 | sigaction(SIGPIPE, &action, NULL); |
| 994 | sigaction(SIGHUP, NULL, &origaction); |
| 995 | if (origaction.sa_handler == SIG_DFL) |
| 996 | sigaction(SIGHUP, &action, NULL); |
| 997 | |
| 998 | argp[0] = argv[0]; |
| 999 | argp[1] = n_flag; |
| 1000 | argp[2] = mp_flag; |
| 1001 | |
| 1002 | for (i = 1; i < argc; i++) |
| 1003 | argp[i + 2] = argv[i]; |
| 1004 | |
| 1005 | argc += 2; |
| 1006 | |
| 1007 | diag = rte_eal_init(argc, argp); |
| 1008 | if (diag < 0) |
| 1009 | rte_panic("Cannot init EAL\n"); |
| 1010 | |
| 1011 | if (rte_eth_dev_count_avail() == 0) |
| 1012 | rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); |
| 1013 | |
| 1014 | argc -= diag; |
| 1015 | argv += (diag - 2); |
| 1016 | |
| 1017 | /* parse app arguments */ |
| 1018 | if (argc > 1) { |
| 1019 | ret = launch_args_parse(argc, argv, argp[0]); |
| 1020 | if (ret < 0) |
| 1021 | rte_exit(EXIT_FAILURE, "Invalid argument\n"); |
| 1022 | } |
| 1023 | |
| 1024 | /* create mempool, ring and vdevs info */ |
| 1025 | create_mp_ring_vdev(); |
| 1026 | enable_pdump(); |
| 1027 | enable_primary_monitor(); |
| 1028 | dump_packets(); |
| 1029 | |
| 1030 | disable_primary_monitor(); |
nothing calls this directly
no test coverage detected