diff options
Diffstat (limited to 'example/l2fwd_simple/odp_l2fwd_simple.c')
-rw-r--r-- | example/l2fwd_simple/odp_l2fwd_simple.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index 36b76ee1c..8fca73072 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -143,31 +143,15 @@ int main(int argc, char **argv) odph_odpthread_t thd[MAX_WORKERS]; odp_instance_t instance; odph_odpthread_params_t thr_params; - int opt; - int long_index; odph_ethaddr_t correct_src; uint32_t mtu1, mtu2; - static const struct option longopts[] = { {NULL, 0, NULL, 0} }; - static const char *shortopts = ""; - /* let helper collect its own arguments (e.g. --odph_proc) */ - odph_parse_options(argc, argv, shortopts, longopts); - - /* - * parse own options: currentely none, but this will move optind - * to the first non-option argument. (in case there where helprt args) - */ - opterr = 0; /* do not issue errors on helper options */ - while (1) { - opt = getopt_long(argc, argv, shortopts, longopts, &long_index); - if (-1 == opt) - break; /* No more options */ - } + argc = odph_parse_options(argc, argv); - if (argc != optind + 4 || - odph_eth_addr_parse(&global.dst, argv[optind + 2]) != 0 || - odph_eth_addr_parse(&global.src, argv[optind + 3]) != 0) { + if (argc != 5 || + odph_eth_addr_parse(&global.dst, argv[3]) != 0 || + odph_eth_addr_parse(&global.src, argv[4]) != 0) { printf("Usage: odp_l2fwd_simple eth0 eth1 01:02:03:04:05:06" " 07:08:09:0a:0b:0c\n"); printf("Where eth0 and eth1 are the used interfaces" @@ -201,10 +185,8 @@ int main(int argc, char **argv) exit(1); } - global.if0 = create_pktio(argv[optind], pool, &global.if0in, - &global.if0out); - global.if1 = create_pktio(argv[optind + 1], pool, &global.if1in, - &global.if1out); + global.if0 = create_pktio(argv[1], pool, &global.if0in, &global.if0out); + global.if1 = create_pktio(argv[2], pool, &global.if1in, &global.if1out); /* Do some operations to increase code coverage in tests */ if (odp_pktio_mac_addr(global.if0, &correct_src, sizeof(correct_src)) |