Parse the argument given in the command line of the application */
| 199 | |
| 200 | /* Parse the argument given in the command line of the application */ |
| 201 | static int |
| 202 | l2fwd_event_parse_args(int argc, char **argv, struct l2fwd_resources *rsrc) |
| 203 | { |
| 204 | int mac_updating = 1; |
| 205 | struct option lgopts[] = { |
| 206 | { CMD_LINE_OPT_MAC_UPDATING, no_argument, &mac_updating, 1}, |
| 207 | { CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, &mac_updating, 0}, |
| 208 | { CMD_LINE_OPT_MODE, required_argument, NULL, |
| 209 | CMD_LINE_OPT_MODE_NUM}, |
| 210 | { CMD_LINE_OPT_EVENTQ_SCHED, required_argument, NULL, |
| 211 | CMD_LINE_OPT_EVENTQ_SCHED_NUM}, |
| 212 | { CMD_LINE_OPT_PORT_PAIR_CONF, required_argument, NULL, |
| 213 | CMD_LINE_OPT_PORT_PAIR_CONF_NUM}, |
| 214 | {CMD_LINE_OPT_ENABLE_VECTOR, no_argument, NULL, |
| 215 | CMD_LINE_OPT_ENABLE_VECTOR_NUM}, |
| 216 | {CMD_LINE_OPT_VECTOR_SIZE, required_argument, NULL, |
| 217 | CMD_LINE_OPT_VECTOR_SIZE_NUM}, |
| 218 | {CMD_LINE_OPT_VECTOR_TMO_NS, required_argument, NULL, |
| 219 | CMD_LINE_OPT_VECTOR_TMO_NS_NUM}, |
| 220 | {NULL, 0, 0, 0} |
| 221 | }; |
| 222 | int opt, ret, timer_secs; |
| 223 | char *prgname = argv[0]; |
| 224 | uint16_t port_id; |
| 225 | int option_index; |
| 226 | char **argvopt; |
| 227 | |
| 228 | /* Reset l2fwd_dst_ports. 8< */ |
| 229 | for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) |
| 230 | rsrc->dst_ports[port_id] = UINT32_MAX; |
| 231 | |
| 232 | argvopt = argv; |
| 233 | while ((opt = getopt_long(argc, argvopt, short_options, |
| 234 | lgopts, &option_index)) != EOF) { |
| 235 | |
| 236 | switch (opt) { |
| 237 | /* portmask */ |
| 238 | case 'p': |
| 239 | rsrc->enabled_port_mask = |
| 240 | l2fwd_event_parse_portmask(optarg); |
| 241 | if (rsrc->enabled_port_mask == 0) { |
| 242 | printf("invalid portmask\n"); |
| 243 | l2fwd_event_usage(prgname); |
| 244 | return -1; |
| 245 | } |
| 246 | break; |
| 247 | |
| 248 | /* nqueue */ |
| 249 | case 'q': |
| 250 | rsrc->rx_queue_per_lcore = |
| 251 | l2fwd_event_parse_nqueue(optarg); |
| 252 | if (rsrc->rx_queue_per_lcore == 0) { |
| 253 | printf("invalid queue number\n"); |
| 254 | l2fwd_event_usage(prgname); |
| 255 | return -1; |
| 256 | } |
| 257 | break; |
| 258 |
no test coverage detected