Parse the argument given in the command line of the application */
| 773 | |
| 774 | /* Parse the argument given in the command line of the application */ |
| 775 | static int |
| 776 | parse_args(int argc, char **argv) |
| 777 | { |
| 778 | int opt, ret; |
| 779 | char **argvopt; |
| 780 | int option_index; |
| 781 | char *prgname = argv[0]; |
| 782 | uint8_t lcore_params = 0; |
| 783 | #ifdef RTE_LIB_EVENTDEV |
| 784 | uint8_t eventq_sched = 0; |
| 785 | uint8_t eth_rx_q = 0; |
| 786 | struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc(); |
| 787 | #endif |
| 788 | |
| 789 | argvopt = argv; |
| 790 | |
| 791 | /* Error or normal output strings. */ |
| 792 | while ((opt = getopt_long(argc, argvopt, short_options, |
| 793 | lgopts, &option_index)) != EOF) { |
| 794 | |
| 795 | switch (opt) { |
| 796 | /* portmask */ |
| 797 | case 'p': |
| 798 | enabled_port_mask = parse_portmask(optarg); |
| 799 | if (enabled_port_mask == 0) { |
| 800 | fprintf(stderr, "Invalid portmask\n"); |
| 801 | print_usage(prgname); |
| 802 | return -1; |
| 803 | } |
| 804 | break; |
| 805 | |
| 806 | case 'P': |
| 807 | promiscuous_on = 1; |
| 808 | break; |
| 809 | |
| 810 | case 'E': |
| 811 | if (lookup_mode != L3FWD_LOOKUP_DEFAULT) { |
| 812 | fprintf(stderr, "Only one lookup mode is allowed at a time!\n"); |
| 813 | return -1; |
| 814 | } |
| 815 | lookup_mode = L3FWD_LOOKUP_EM; |
| 816 | break; |
| 817 | |
| 818 | case 'L': |
| 819 | if (lookup_mode != L3FWD_LOOKUP_DEFAULT) { |
| 820 | fprintf(stderr, "Only one lookup mode is allowed at a time!\n"); |
| 821 | return -1; |
| 822 | } |
| 823 | lookup_mode = L3FWD_LOOKUP_LPM; |
| 824 | break; |
| 825 | |
| 826 | /* long options */ |
| 827 | case CMD_LINE_OPT_CONFIG_NUM: |
| 828 | ret = parse_config(optarg); |
| 829 | if (ret) { |
| 830 | fprintf(stderr, "Invalid config\n"); |
| 831 | print_usage(prgname); |
| 832 | return -1; |
no test coverage detected