1 /*- 2 * BSD LICENSE 3 * 4 * Copyright(c) 2010-2017 Intel Corporation. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name of Intel Corporation nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #include <errno.h> 35 #include <getopt.h> 36 #include <stdarg.h> 37 #include <stdio.h> 38 #include <stdlib.h> 39 #include <signal.h> 40 #include <string.h> 41 #include <time.h> 42 #include <fcntl.h> 43 #include <sys/types.h> 44 45 #include <sys/queue.h> 46 #include <sys/stat.h> 47 48 #include <stdint.h> 49 #include <unistd.h> 50 #include <inttypes.h> 51 52 #include <rte_common.h> 53 #include <rte_byteorder.h> 54 #include <rte_log.h> 55 #include <rte_debug.h> 56 #include <rte_cycles.h> 57 #include <rte_memory.h> 58 #include <rte_memzone.h> 59 #include <rte_launch.h> 60 #include <rte_eal.h> 61 #include <rte_per_lcore.h> 62 #include <rte_lcore.h> 63 #include <rte_atomic.h> 64 #include <rte_branch_prediction.h> 65 #include <rte_mempool.h> 66 #include <rte_interrupts.h> 67 #include <rte_pci.h> 68 #include <rte_ether.h> 69 #include <rte_ethdev.h> 70 #include <rte_string_fns.h> 71 #ifdef RTE_LIBRTE_CMDLINE 72 #include <cmdline_parse.h> 73 #include <cmdline_parse_etheraddr.h> 74 #endif 75 #ifdef RTE_LIBRTE_PMD_BOND 76 #include <rte_eth_bond.h> 77 #endif 78 #include <rte_flow.h> 79 80 #include "testpmd.h" 81 82 static void 83 usage(char* progname) 84 { 85 printf("usage: %s " 86 #ifdef RTE_LIBRTE_CMDLINE 87 "[--interactive|-i] " 88 "[--cmdline-file=FILENAME] " 89 #endif 90 "[--help|-h] | [--auto-start|-a] | [" 91 "--tx-first | --stats-period=PERIOD | " 92 "--coremask=COREMASK --portmask=PORTMASK --numa " 93 "--mbuf-size= | --total-num-mbufs= | " 94 "--nb-cores= | --nb-ports= | " 95 #ifdef RTE_LIBRTE_CMDLINE 96 "--eth-peers-configfile= | " 97 "--eth-peer=X,M:M:M:M:M:M | " 98 #endif 99 "--pkt-filter-mode= |" 100 "--rss-ip | --rss-udp | " 101 "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " 102 "--txpt= | --txht= | --txwt= | --txfreet= | " 103 "--txrst= | --txqflags= ]\n", 104 progname); 105 #ifdef RTE_LIBRTE_CMDLINE 106 printf(" --interactive: run in interactive mode.\n"); 107 printf(" --cmdline-file: execute cli commands before startup.\n"); 108 #endif 109 printf(" --auto-start: start forwarding on init " 110 "[always when non-interactive].\n"); 111 printf(" --help: display this message and quit.\n"); 112 printf(" --tx-first: start forwarding sending a burst first " 113 "(only if interactive is disabled).\n"); 114 printf(" --stats-period=PERIOD: statistics will be shown " 115 "every PERIOD seconds (only if interactive is disabled).\n"); 116 printf(" --nb-cores=N: set the number of forwarding cores " 117 "(1 <= N <= %d).\n", nb_lcores); 118 printf(" --nb-ports=N: set the number of forwarding ports " 119 "(1 <= N <= %d).\n", nb_ports); 120 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running " 121 "the packet forwarding test. The master lcore is reserved for " 122 "command line parsing only, and cannot be masked on for " 123 "packet forwarding.\n"); 124 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used " 125 "by the packet forwarding test.\n"); 126 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of " 127 "RX memory buffers (mbufs).\n"); 128 printf(" --port-numa-config=(port,socket)[,(port,socket)]: " 129 "specify the socket on which the memory pool " 130 "used by the port will be allocated.\n"); 131 printf(" --ring-numa-config=(port,flag,socket)[,(port,flag,socket)]: " 132 "specify the socket on which the TX/RX rings for " 133 "the port will be allocated " 134 "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n"); 135 printf(" --socket-num=N: set socket from which all memory is allocated " 136 "in NUMA mode.\n"); 137 printf(" --mbuf-size=N: set the data size of mbuf to N bytes.\n"); 138 printf(" --total-num-mbufs=N: set the number of mbufs to be allocated " 139 "in mbuf pools.\n"); 140 printf(" --max-pkt-len=N: set the maximum size of packet to N bytes.\n"); 141 #ifdef RTE_LIBRTE_CMDLINE 142 printf(" --eth-peers-configfile=name: config file with ethernet addresses " 143 "of peer ports.\n"); 144 printf(" --eth-peer=X,M:M:M:M:M:M: set the MAC address of the X peer " 145 "port (0 <= X < %d).\n", RTE_MAX_ETHPORTS); 146 #endif 147 printf(" --pkt-filter-mode=N: set Flow Director mode " 148 "(N: none (default mode) or signature or perfect).\n"); 149 printf(" --pkt-filter-report-hash=N: set Flow Director report mode " 150 "(N: none or match (default) or always).\n"); 151 printf(" --pkt-filter-size=N: set Flow Director mode " 152 "(N: 64K (default mode) or 128K or 256K).\n"); 153 printf(" --pkt-filter-drop-queue=N: set drop-queue. " 154 "In perfect mode, when you add a rule with queue = -1 " 155 "the packet will be enqueued into the rx drop-queue. " 156 "If the drop-queue doesn't exist, the packet is dropped. " 157 "By default drop-queue=127.\n"); 158 #ifdef RTE_LIBRTE_LATENCY_STATS 159 printf(" --latencystats=N: enable latency and jitter statistcs " 160 "monitoring on forwarding lcore id N.\n"); 161 #endif 162 printf(" --disable-crc-strip: disable CRC stripping by hardware.\n"); 163 printf(" --enable-lro: enable large receive offload.\n"); 164 printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n"); 165 printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n"); 166 printf(" --disable-hw-vlan: disable hardware vlan.\n"); 167 printf(" --disable-hw-vlan-filter: disable hardware vlan filter.\n"); 168 printf(" --disable-hw-vlan-strip: disable hardware vlan strip.\n"); 169 printf(" --disable-hw-vlan-extend: disable hardware vlan extend.\n"); 170 printf(" --enable-drop-en: enable per queue packet drop.\n"); 171 printf(" --disable-rss: disable rss.\n"); 172 printf(" --port-topology=N: set port topology (N: paired (default) or " 173 "chained).\n"); 174 printf(" --forward-mode=N: set forwarding mode (N: %s).\n", 175 list_pkt_forwarding_modes()); 176 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n"); 177 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n"); 178 printf(" --rxq=N: set the number of RX queues per port to N.\n"); 179 printf(" --rxd=N: set the number of descriptors in RX rings to N.\n"); 180 printf(" --txq=N: set the number of TX queues per port to N.\n"); 181 printf(" --txd=N: set the number of descriptors in TX rings to N.\n"); 182 printf(" --burst=N: set the number of packets per burst to N.\n"); 183 printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n"); 184 printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n"); 185 printf(" --rxht=N: set the host threshold register of RX rings to N.\n"); 186 printf(" --rxfreet=N: set the free threshold of RX descriptors to N " 187 "(0 <= N < value of rxd).\n"); 188 printf(" --rxwt=N: set the write-back threshold register of RX rings to N.\n"); 189 printf(" --txpt=N: set the prefetch threshold register of TX rings to N.\n"); 190 printf(" --txht=N: set the nhost threshold register of TX rings to N.\n"); 191 printf(" --txwt=N: set the write-back threshold register of TX rings to N.\n"); 192 printf(" --txfreet=N: set the transmit free threshold of TX rings to N " 193 "(0 <= N <= value of txd).\n"); 194 printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " 195 "(0 <= N <= value of txd).\n"); 196 printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags " 197 "(0 <= N <= 0x7FFFFFFF).\n"); 198 printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " 199 "tx queues statistics counters mapping " 200 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); 201 printf(" --rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " 202 "rx queues statistics counters mapping " 203 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); 204 printf(" --no-flush-rx: Don't flush RX streams before forwarding." 205 " Used mainly with PCAP drivers.\n"); 206 printf(" --txpkts=X[,Y]*: set TX segment sizes" 207 " or total packet length.\n"); 208 printf(" --disable-link-check: disable check on link status when " 209 "starting/stopping ports.\n"); 210 printf(" --no-lsc-interrupt: disable link status change interrupt.\n"); 211 printf(" --no-rmv-interrupt: disable device removal interrupt.\n"); 212 printf(" --bitrate-stats=N: set the logical core N to perform " 213 "bit-rate calculation.\n"); 214 printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: " 215 "enable print of designated event or all of them.\n"); 216 printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: " 217 "disable print of designated event or all of them.\n"); 218 printf(" --flow-isolate-all: " 219 "requests flow API isolated mode on all ports at initialization time.\n"); 220 } 221 222 #ifdef RTE_LIBRTE_CMDLINE 223 static int 224 init_peer_eth_addrs(char *config_filename) 225 { 226 FILE *config_file; 227 portid_t i; 228 char buf[50]; 229 230 config_file = fopen(config_filename, "r"); 231 if (config_file == NULL) { 232 perror("Failed to open eth config file\n"); 233 return -1; 234 } 235 236 for (i = 0; i < RTE_MAX_ETHPORTS; i++) { 237 238 if (fgets(buf, sizeof(buf), config_file) == NULL) 239 break; 240 241 if (cmdline_parse_etheraddr(NULL, buf, &peer_eth_addrs[i], 242 sizeof(peer_eth_addrs[i])) < 0) { 243 printf("Bad MAC address format on line %d\n", i+1); 244 fclose(config_file); 245 return -1; 246 } 247 } 248 fclose(config_file); 249 nb_peer_eth_addrs = (portid_t) i; 250 return 0; 251 } 252 #endif 253 254 /* 255 * Parse the coremask given as argument (hexadecimal string) and set 256 * the global configuration of forwarding cores. 257 */ 258 static void 259 parse_fwd_coremask(const char *coremask) 260 { 261 char *end; 262 unsigned long long int cm; 263 264 /* parse hexadecimal string */ 265 end = NULL; 266 cm = strtoull(coremask, &end, 16); 267 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0')) 268 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n"); 269 else if (set_fwd_lcores_mask((uint64_t) cm) < 0) 270 rte_exit(EXIT_FAILURE, "coremask is not valid\n"); 271 } 272 273 /* 274 * Parse the coremask given as argument (hexadecimal string) and set 275 * the global configuration of forwarding cores. 276 */ 277 static void 278 parse_fwd_portmask(const char *portmask) 279 { 280 char *end; 281 unsigned long long int pm; 282 283 /* parse hexadecimal string */ 284 end = NULL; 285 pm = strtoull(portmask, &end, 16); 286 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) 287 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n"); 288 else 289 set_fwd_ports_mask((uint64_t) pm); 290 } 291 292 293 static int 294 parse_queue_stats_mapping_config(const char *q_arg, int is_rx) 295 { 296 char s[256]; 297 const char *p, *p0 = q_arg; 298 char *end; 299 enum fieldnames { 300 FLD_PORT = 0, 301 FLD_QUEUE, 302 FLD_STATS_COUNTER, 303 _NUM_FLD 304 }; 305 unsigned long int_fld[_NUM_FLD]; 306 char *str_fld[_NUM_FLD]; 307 int i; 308 unsigned size; 309 310 /* reset from value set at definition */ 311 is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0); 312 313 while ((p = strchr(p0,'(')) != NULL) { 314 ++p; 315 if((p0 = strchr(p,')')) == NULL) 316 return -1; 317 318 size = p0 - p; 319 if(size >= sizeof(s)) 320 return -1; 321 322 snprintf(s, sizeof(s), "%.*s", size, p); 323 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) 324 return -1; 325 for (i = 0; i < _NUM_FLD; i++){ 326 errno = 0; 327 int_fld[i] = strtoul(str_fld[i], &end, 0); 328 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) 329 return -1; 330 } 331 /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */ 332 if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) { 333 printf("Stats counter not in the correct range 0..%d\n", 334 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); 335 return -1; 336 } 337 338 if (!is_rx) { 339 if ((nb_tx_queue_stats_mappings >= 340 MAX_TX_QUEUE_STATS_MAPPINGS)) { 341 printf("exceeded max number of TX queue " 342 "statistics mappings: %hu\n", 343 nb_tx_queue_stats_mappings); 344 return -1; 345 } 346 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id = 347 (uint8_t)int_fld[FLD_PORT]; 348 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id = 349 (uint8_t)int_fld[FLD_QUEUE]; 350 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id = 351 (uint8_t)int_fld[FLD_STATS_COUNTER]; 352 ++nb_tx_queue_stats_mappings; 353 } 354 else { 355 if ((nb_rx_queue_stats_mappings >= 356 MAX_RX_QUEUE_STATS_MAPPINGS)) { 357 printf("exceeded max number of RX queue " 358 "statistics mappings: %hu\n", 359 nb_rx_queue_stats_mappings); 360 return -1; 361 } 362 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id = 363 (uint8_t)int_fld[FLD_PORT]; 364 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id = 365 (uint8_t)int_fld[FLD_QUEUE]; 366 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id = 367 (uint8_t)int_fld[FLD_STATS_COUNTER]; 368 ++nb_rx_queue_stats_mappings; 369 } 370 371 } 372 /* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */ 373 /* than to the default array (that was set at its definition) */ 374 is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) : 375 (tx_queue_stats_mappings = tx_queue_stats_mappings_array); 376 return 0; 377 } 378 379 static void 380 print_invalid_socket_id_error(void) 381 { 382 unsigned int i = 0; 383 384 printf("Invalid socket id, options are: "); 385 for (i = 0; i < num_sockets; i++) { 386 printf("%u%s", socket_ids[i], 387 (i == num_sockets - 1) ? "\n" : ","); 388 } 389 } 390 391 static int 392 parse_portnuma_config(const char *q_arg) 393 { 394 char s[256]; 395 const char *p, *p0 = q_arg; 396 char *end; 397 uint8_t i, socket_id; 398 portid_t port_id; 399 unsigned size; 400 enum fieldnames { 401 FLD_PORT = 0, 402 FLD_SOCKET, 403 _NUM_FLD 404 }; 405 unsigned long int_fld[_NUM_FLD]; 406 char *str_fld[_NUM_FLD]; 407 portid_t pid; 408 409 /* reset from value set at definition */ 410 while ((p = strchr(p0,'(')) != NULL) { 411 ++p; 412 if((p0 = strchr(p,')')) == NULL) 413 return -1; 414 415 size = p0 - p; 416 if(size >= sizeof(s)) 417 return -1; 418 419 snprintf(s, sizeof(s), "%.*s", size, p); 420 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) 421 return -1; 422 for (i = 0; i < _NUM_FLD; i++) { 423 errno = 0; 424 int_fld[i] = strtoul(str_fld[i], &end, 0); 425 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) 426 return -1; 427 } 428 port_id = (portid_t)int_fld[FLD_PORT]; 429 if (port_id_is_invalid(port_id, ENABLED_WARN) || 430 port_id == (portid_t)RTE_PORT_ALL) { 431 printf("Valid port range is [0"); 432 RTE_ETH_FOREACH_DEV(pid) 433 printf(", %d", pid); 434 printf("]\n"); 435 return -1; 436 } 437 socket_id = (uint8_t)int_fld[FLD_SOCKET]; 438 if (new_socket_id(socket_id)) { 439 print_invalid_socket_id_error(); 440 return -1; 441 } 442 port_numa[port_id] = socket_id; 443 } 444 445 return 0; 446 } 447 448 static int 449 parse_ringnuma_config(const char *q_arg) 450 { 451 char s[256]; 452 const char *p, *p0 = q_arg; 453 char *end; 454 uint8_t i, ring_flag, socket_id; 455 portid_t port_id; 456 unsigned size; 457 enum fieldnames { 458 FLD_PORT = 0, 459 FLD_FLAG, 460 FLD_SOCKET, 461 _NUM_FLD 462 }; 463 unsigned long int_fld[_NUM_FLD]; 464 char *str_fld[_NUM_FLD]; 465 portid_t pid; 466 #define RX_RING_ONLY 0x1 467 #define TX_RING_ONLY 0x2 468 #define RXTX_RING 0x3 469 470 /* reset from value set at definition */ 471 while ((p = strchr(p0,'(')) != NULL) { 472 ++p; 473 if((p0 = strchr(p,')')) == NULL) 474 return -1; 475 476 size = p0 - p; 477 if(size >= sizeof(s)) 478 return -1; 479 480 snprintf(s, sizeof(s), "%.*s", size, p); 481 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) 482 return -1; 483 for (i = 0; i < _NUM_FLD; i++) { 484 errno = 0; 485 int_fld[i] = strtoul(str_fld[i], &end, 0); 486 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) 487 return -1; 488 } 489 port_id = (portid_t)int_fld[FLD_PORT]; 490 if (port_id_is_invalid(port_id, ENABLED_WARN) || 491 port_id == (portid_t)RTE_PORT_ALL) { 492 printf("Valid port range is [0"); 493 RTE_ETH_FOREACH_DEV(pid) 494 printf(", %d", pid); 495 printf("]\n"); 496 return -1; 497 } 498 socket_id = (uint8_t)int_fld[FLD_SOCKET]; 499 if (new_socket_id(socket_id)) { 500 print_invalid_socket_id_error(); 501 return -1; 502 } 503 ring_flag = (uint8_t)int_fld[FLD_FLAG]; 504 if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) { 505 printf("Invalid ring-flag=%d config for port =%d\n", 506 ring_flag,port_id); 507 return -1; 508 } 509 510 switch (ring_flag & RXTX_RING) { 511 case RX_RING_ONLY: 512 rxring_numa[port_id] = socket_id; 513 break; 514 case TX_RING_ONLY: 515 txring_numa[port_id] = socket_id; 516 break; 517 case RXTX_RING: 518 rxring_numa[port_id] = socket_id; 519 txring_numa[port_id] = socket_id; 520 break; 521 default: 522 printf("Invalid ring-flag=%d config for port=%d\n", 523 ring_flag,port_id); 524 break; 525 } 526 } 527 528 return 0; 529 } 530 531 static int 532 parse_event_printing_config(const char *optarg, int enable) 533 { 534 uint32_t mask = 0; 535 536 if (!strcmp(optarg, "unknown")) 537 mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN; 538 else if (!strcmp(optarg, "intr_lsc")) 539 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC; 540 else if (!strcmp(optarg, "queue_state")) 541 mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE; 542 else if (!strcmp(optarg, "intr_reset")) 543 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET; 544 else if (!strcmp(optarg, "vf_mbox")) 545 mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX; 546 else if (!strcmp(optarg, "macsec")) 547 mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC; 548 else if (!strcmp(optarg, "intr_rmv")) 549 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV; 550 else if (!strcmp(optarg, "all")) 551 mask = ~UINT32_C(0); 552 else { 553 fprintf(stderr, "Invalid event: %s\n", optarg); 554 return -1; 555 } 556 if (enable) 557 event_print_mask |= mask; 558 else 559 event_print_mask &= ~mask; 560 return 0; 561 } 562 563 void 564 launch_args_parse(int argc, char** argv) 565 { 566 int n, opt; 567 char **argvopt; 568 int opt_idx; 569 enum { TX, RX }; 570 571 static struct option lgopts[] = { 572 { "help", 0, 0, 0 }, 573 #ifdef RTE_LIBRTE_CMDLINE 574 { "interactive", 0, 0, 0 }, 575 { "cmdline-file", 1, 0, 0 }, 576 { "auto-start", 0, 0, 0 }, 577 { "eth-peers-configfile", 1, 0, 0 }, 578 { "eth-peer", 1, 0, 0 }, 579 #endif 580 { "tx-first", 0, 0, 0 }, 581 { "stats-period", 1, 0, 0 }, 582 { "ports", 1, 0, 0 }, 583 { "nb-cores", 1, 0, 0 }, 584 { "nb-ports", 1, 0, 0 }, 585 { "coremask", 1, 0, 0 }, 586 { "portmask", 1, 0, 0 }, 587 { "numa", 0, 0, 0 }, 588 { "no-numa", 0, 0, 0 }, 589 { "mp-anon", 0, 0, 0 }, 590 { "port-numa-config", 1, 0, 0 }, 591 { "ring-numa-config", 1, 0, 0 }, 592 { "socket-num", 1, 0, 0 }, 593 { "mbuf-size", 1, 0, 0 }, 594 { "total-num-mbufs", 1, 0, 0 }, 595 { "max-pkt-len", 1, 0, 0 }, 596 { "pkt-filter-mode", 1, 0, 0 }, 597 { "pkt-filter-report-hash", 1, 0, 0 }, 598 { "pkt-filter-size", 1, 0, 0 }, 599 { "pkt-filter-drop-queue", 1, 0, 0 }, 600 #ifdef RTE_LIBRTE_LATENCY_STATS 601 { "latencystats", 1, 0, 0 }, 602 #endif 603 #ifdef RTE_LIBRTE_BITRATE 604 { "bitrate-stats", 1, 0, 0 }, 605 #endif 606 { "disable-crc-strip", 0, 0, 0 }, 607 { "enable-lro", 0, 0, 0 }, 608 { "enable-rx-cksum", 0, 0, 0 }, 609 { "enable-rx-timestamp", 0, 0, 0 }, 610 { "enable-scatter", 0, 0, 0 }, 611 { "disable-hw-vlan", 0, 0, 0 }, 612 { "disable-hw-vlan-filter", 0, 0, 0 }, 613 { "disable-hw-vlan-strip", 0, 0, 0 }, 614 { "disable-hw-vlan-extend", 0, 0, 0 }, 615 { "enable-drop-en", 0, 0, 0 }, 616 { "disable-rss", 0, 0, 0 }, 617 { "port-topology", 1, 0, 0 }, 618 { "forward-mode", 1, 0, 0 }, 619 { "rss-ip", 0, 0, 0 }, 620 { "rss-udp", 0, 0, 0 }, 621 { "rxq", 1, 0, 0 }, 622 { "txq", 1, 0, 0 }, 623 { "rxd", 1, 0, 0 }, 624 { "txd", 1, 0, 0 }, 625 { "burst", 1, 0, 0 }, 626 { "mbcache", 1, 0, 0 }, 627 { "txpt", 1, 0, 0 }, 628 { "txht", 1, 0, 0 }, 629 { "txwt", 1, 0, 0 }, 630 { "txfreet", 1, 0, 0 }, 631 { "txrst", 1, 0, 0 }, 632 { "txqflags", 1, 0, 0 }, 633 { "rxpt", 1, 0, 0 }, 634 { "rxht", 1, 0, 0 }, 635 { "rxwt", 1, 0, 0 }, 636 { "rxfreet", 1, 0, 0 }, 637 { "tx-queue-stats-mapping", 1, 0, 0 }, 638 { "rx-queue-stats-mapping", 1, 0, 0 }, 639 { "no-flush-rx", 0, 0, 0 }, 640 { "flow-isolate-all", 0, 0, 0 }, 641 { "txpkts", 1, 0, 0 }, 642 { "disable-link-check", 0, 0, 0 }, 643 { "no-lsc-interrupt", 0, 0, 0 }, 644 { "no-rmv-interrupt", 0, 0, 0 }, 645 { "print-event", 1, 0, 0 }, 646 { "mask-event", 1, 0, 0 }, 647 { 0, 0, 0, 0 }, 648 }; 649 650 argvopt = argv; 651 652 #ifdef RTE_LIBRTE_CMDLINE 653 #define SHORTOPTS "i" 654 #else 655 #define SHORTOPTS "" 656 #endif 657 while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah", 658 lgopts, &opt_idx)) != EOF) { 659 switch (opt) { 660 #ifdef RTE_LIBRTE_CMDLINE 661 case 'i': 662 printf("Interactive-mode selected\n"); 663 interactive = 1; 664 break; 665 #endif 666 case 'a': 667 printf("Auto-start selected\n"); 668 auto_start = 1; 669 break; 670 671 case 0: /*long options */ 672 if (!strcmp(lgopts[opt_idx].name, "help")) { 673 usage(argv[0]); 674 rte_exit(EXIT_SUCCESS, "Displayed help\n"); 675 } 676 #ifdef RTE_LIBRTE_CMDLINE 677 if (!strcmp(lgopts[opt_idx].name, "interactive")) { 678 printf("Interactive-mode selected\n"); 679 interactive = 1; 680 } 681 if (!strcmp(lgopts[opt_idx].name, "cmdline-file")) { 682 printf("CLI commands to be read from %s\n", 683 optarg); 684 snprintf(cmdline_filename, 685 sizeof(cmdline_filename), "%s", 686 optarg); 687 } 688 if (!strcmp(lgopts[opt_idx].name, "auto-start")) { 689 printf("Auto-start selected\n"); 690 auto_start = 1; 691 } 692 if (!strcmp(lgopts[opt_idx].name, "tx-first")) { 693 printf("Ports to start sending a burst of " 694 "packets first\n"); 695 tx_first = 1; 696 } 697 if (!strcmp(lgopts[opt_idx].name, "stats-period")) { 698 char *end = NULL; 699 unsigned int n; 700 701 n = strtoul(optarg, &end, 10); 702 if ((optarg[0] == '\0') || (end == NULL) || 703 (*end != '\0')) 704 break; 705 706 stats_period = n; 707 break; 708 } 709 if (!strcmp(lgopts[opt_idx].name, 710 "eth-peers-configfile")) { 711 if (init_peer_eth_addrs(optarg) != 0) 712 rte_exit(EXIT_FAILURE, 713 "Cannot open logfile\n"); 714 } 715 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) { 716 char *port_end; 717 uint8_t c, peer_addr[6]; 718 719 errno = 0; 720 n = strtoul(optarg, &port_end, 10); 721 if (errno != 0 || port_end == optarg || *port_end++ != ',') 722 rte_exit(EXIT_FAILURE, 723 "Invalid eth-peer: %s", optarg); 724 if (n >= RTE_MAX_ETHPORTS) 725 rte_exit(EXIT_FAILURE, 726 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n", 727 n, RTE_MAX_ETHPORTS); 728 729 if (cmdline_parse_etheraddr(NULL, port_end, 730 &peer_addr, sizeof(peer_addr)) < 0) 731 rte_exit(EXIT_FAILURE, 732 "Invalid ethernet address: %s\n", 733 port_end); 734 for (c = 0; c < 6; c++) 735 peer_eth_addrs[n].addr_bytes[c] = 736 peer_addr[c]; 737 nb_peer_eth_addrs++; 738 } 739 #endif 740 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) { 741 n = atoi(optarg); 742 if (n > 0 && n <= nb_ports) 743 nb_fwd_ports = n; 744 else 745 rte_exit(EXIT_FAILURE, 746 "Invalid port %d\n", n); 747 } 748 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) { 749 n = atoi(optarg); 750 if (n > 0 && n <= nb_lcores) 751 nb_fwd_lcores = (uint8_t) n; 752 else 753 rte_exit(EXIT_FAILURE, 754 "nb-cores should be > 0 and <= %d\n", 755 nb_lcores); 756 } 757 if (!strcmp(lgopts[opt_idx].name, "coremask")) 758 parse_fwd_coremask(optarg); 759 if (!strcmp(lgopts[opt_idx].name, "portmask")) 760 parse_fwd_portmask(optarg); 761 if (!strcmp(lgopts[opt_idx].name, "no-numa")) 762 numa_support = 0; 763 if (!strcmp(lgopts[opt_idx].name, "numa")) 764 numa_support = 1; 765 if (!strcmp(lgopts[opt_idx].name, "mp-anon")) { 766 mp_anon = 1; 767 } 768 if (!strcmp(lgopts[opt_idx].name, "port-numa-config")) { 769 if (parse_portnuma_config(optarg)) 770 rte_exit(EXIT_FAILURE, 771 "invalid port-numa configuration\n"); 772 } 773 if (!strcmp(lgopts[opt_idx].name, "ring-numa-config")) 774 if (parse_ringnuma_config(optarg)) 775 rte_exit(EXIT_FAILURE, 776 "invalid ring-numa configuration\n"); 777 if (!strcmp(lgopts[opt_idx].name, "socket-num")) { 778 n = atoi(optarg); 779 if (!new_socket_id((uint8_t)n)) { 780 socket_num = (uint8_t)n; 781 } else { 782 print_invalid_socket_id_error(); 783 rte_exit(EXIT_FAILURE, 784 "Invalid socket id"); 785 } 786 } 787 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) { 788 n = atoi(optarg); 789 if (n > 0 && n <= 0xFFFF) 790 mbuf_data_size = (uint16_t) n; 791 else 792 rte_exit(EXIT_FAILURE, 793 "mbuf-size should be > 0 and < 65536\n"); 794 } 795 if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) { 796 n = atoi(optarg); 797 if (n > 1024) 798 param_total_num_mbufs = (unsigned)n; 799 else 800 rte_exit(EXIT_FAILURE, 801 "total-num-mbufs should be > 1024\n"); 802 } 803 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) { 804 n = atoi(optarg); 805 if (n >= ETHER_MIN_LEN) { 806 rx_mode.max_rx_pkt_len = (uint32_t) n; 807 if (n > ETHER_MAX_LEN) 808 rx_mode.jumbo_frame = 1; 809 } else 810 rte_exit(EXIT_FAILURE, 811 "Invalid max-pkt-len=%d - should be > %d\n", 812 n, ETHER_MIN_LEN); 813 } 814 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) { 815 if (!strcmp(optarg, "signature")) 816 fdir_conf.mode = 817 RTE_FDIR_MODE_SIGNATURE; 818 else if (!strcmp(optarg, "perfect")) 819 fdir_conf.mode = RTE_FDIR_MODE_PERFECT; 820 else if (!strcmp(optarg, "perfect-mac-vlan")) 821 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN; 822 else if (!strcmp(optarg, "perfect-tunnel")) 823 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL; 824 else if (!strcmp(optarg, "none")) 825 fdir_conf.mode = RTE_FDIR_MODE_NONE; 826 else 827 rte_exit(EXIT_FAILURE, 828 "pkt-mode-invalid %s invalid - must be: " 829 "none, signature, perfect, perfect-mac-vlan" 830 " or perfect-tunnel\n", 831 optarg); 832 } 833 if (!strcmp(lgopts[opt_idx].name, 834 "pkt-filter-report-hash")) { 835 if (!strcmp(optarg, "none")) 836 fdir_conf.status = 837 RTE_FDIR_NO_REPORT_STATUS; 838 else if (!strcmp(optarg, "match")) 839 fdir_conf.status = 840 RTE_FDIR_REPORT_STATUS; 841 else if (!strcmp(optarg, "always")) 842 fdir_conf.status = 843 RTE_FDIR_REPORT_STATUS_ALWAYS; 844 else 845 rte_exit(EXIT_FAILURE, 846 "pkt-filter-report-hash %s invalid " 847 "- must be: none or match or always\n", 848 optarg); 849 } 850 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) { 851 if (!strcmp(optarg, "64K")) 852 fdir_conf.pballoc = 853 RTE_FDIR_PBALLOC_64K; 854 else if (!strcmp(optarg, "128K")) 855 fdir_conf.pballoc = 856 RTE_FDIR_PBALLOC_128K; 857 else if (!strcmp(optarg, "256K")) 858 fdir_conf.pballoc = 859 RTE_FDIR_PBALLOC_256K; 860 else 861 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -" 862 " must be: 64K or 128K or 256K\n", 863 optarg); 864 } 865 if (!strcmp(lgopts[opt_idx].name, 866 "pkt-filter-drop-queue")) { 867 n = atoi(optarg); 868 if (n >= 0) 869 fdir_conf.drop_queue = (uint8_t) n; 870 else 871 rte_exit(EXIT_FAILURE, 872 "drop queue %d invalid - must" 873 "be >= 0 \n", n); 874 } 875 #ifdef RTE_LIBRTE_LATENCY_STATS 876 if (!strcmp(lgopts[opt_idx].name, 877 "latencystats")) { 878 n = atoi(optarg); 879 if (n >= 0) { 880 latencystats_lcore_id = (lcoreid_t) n; 881 latencystats_enabled = 1; 882 } else 883 rte_exit(EXIT_FAILURE, 884 "invalid lcore id %d for latencystats" 885 " must be >= 0\n", n); 886 } 887 #endif 888 #ifdef RTE_LIBRTE_BITRATE 889 if (!strcmp(lgopts[opt_idx].name, "bitrate-stats")) { 890 n = atoi(optarg); 891 if (n >= 0) { 892 bitrate_lcore_id = (lcoreid_t) n; 893 bitrate_enabled = 1; 894 } else 895 rte_exit(EXIT_FAILURE, 896 "invalid lcore id %d for bitrate stats" 897 " must be >= 0\n", n); 898 } 899 #endif 900 if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) 901 rx_mode.hw_strip_crc = 0; 902 if (!strcmp(lgopts[opt_idx].name, "enable-lro")) 903 rx_mode.enable_lro = 1; 904 if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) 905 rx_mode.enable_scatter = 1; 906 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) 907 rx_mode.hw_ip_checksum = 1; 908 if (!strcmp(lgopts[opt_idx].name, 909 "enable-rx-timestamp")) 910 rx_mode.hw_timestamp = 1; 911 912 if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { 913 rx_mode.hw_vlan_filter = 0; 914 rx_mode.hw_vlan_strip = 0; 915 rx_mode.hw_vlan_extend = 0; 916 } 917 918 if (!strcmp(lgopts[opt_idx].name, 919 "disable-hw-vlan-filter")) 920 rx_mode.hw_vlan_filter = 0; 921 922 if (!strcmp(lgopts[opt_idx].name, 923 "disable-hw-vlan-strip")) 924 rx_mode.hw_vlan_strip = 0; 925 926 if (!strcmp(lgopts[opt_idx].name, 927 "disable-hw-vlan-extend")) 928 rx_mode.hw_vlan_extend = 0; 929 930 if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) 931 rx_drop_en = 1; 932 933 if (!strcmp(lgopts[opt_idx].name, "disable-rss")) 934 rss_hf = 0; 935 if (!strcmp(lgopts[opt_idx].name, "port-topology")) { 936 if (!strcmp(optarg, "paired")) 937 port_topology = PORT_TOPOLOGY_PAIRED; 938 else if (!strcmp(optarg, "chained")) 939 port_topology = PORT_TOPOLOGY_CHAINED; 940 else if (!strcmp(optarg, "loop")) 941 port_topology = PORT_TOPOLOGY_LOOP; 942 else 943 rte_exit(EXIT_FAILURE, "port-topology %s invalid -" 944 " must be: paired or chained \n", 945 optarg); 946 } 947 if (!strcmp(lgopts[opt_idx].name, "forward-mode")) 948 set_pkt_forwarding_mode(optarg); 949 if (!strcmp(lgopts[opt_idx].name, "rss-ip")) 950 rss_hf = ETH_RSS_IP; 951 if (!strcmp(lgopts[opt_idx].name, "rss-udp")) 952 rss_hf = ETH_RSS_UDP; 953 if (!strcmp(lgopts[opt_idx].name, "rxq")) { 954 n = atoi(optarg); 955 if (n >= 0 && n <= (int) MAX_QUEUE_ID) 956 nb_rxq = (queueid_t) n; 957 else 958 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" 959 " >= 0 && <= %d\n", n, 960 (int) MAX_QUEUE_ID); 961 } 962 if (!strcmp(lgopts[opt_idx].name, "txq")) { 963 n = atoi(optarg); 964 if (n >= 0 && n <= (int) MAX_QUEUE_ID) 965 nb_txq = (queueid_t) n; 966 else 967 rte_exit(EXIT_FAILURE, "txq %d invalid - must be" 968 " >= 0 && <= %d\n", n, 969 (int) MAX_QUEUE_ID); 970 } 971 if (!nb_rxq && !nb_txq) { 972 rte_exit(EXIT_FAILURE, "Either rx or tx queues should " 973 "be non-zero\n"); 974 } 975 if (!strcmp(lgopts[opt_idx].name, "burst")) { 976 n = atoi(optarg); 977 if ((n >= 1) && (n <= MAX_PKT_BURST)) 978 nb_pkt_per_burst = (uint16_t) n; 979 else 980 rte_exit(EXIT_FAILURE, 981 "burst must >= 1 and <= %d]", 982 MAX_PKT_BURST); 983 } 984 if (!strcmp(lgopts[opt_idx].name, "mbcache")) { 985 n = atoi(optarg); 986 if ((n >= 0) && 987 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE)) 988 mb_mempool_cache = (uint16_t) n; 989 else 990 rte_exit(EXIT_FAILURE, 991 "mbcache must be >= 0 and <= %d\n", 992 RTE_MEMPOOL_CACHE_MAX_SIZE); 993 } 994 if (!strcmp(lgopts[opt_idx].name, "txfreet")) { 995 n = atoi(optarg); 996 if (n >= 0) 997 tx_free_thresh = (int16_t)n; 998 else 999 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n"); 1000 } 1001 if (!strcmp(lgopts[opt_idx].name, "txrst")) { 1002 n = atoi(optarg); 1003 if (n >= 0) 1004 tx_rs_thresh = (int16_t)n; 1005 else 1006 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); 1007 } 1008 if (!strcmp(lgopts[opt_idx].name, "txqflags")) { 1009 char *end = NULL; 1010 n = strtoul(optarg, &end, 16); 1011 if (n >= 0) 1012 txq_flags = (int32_t)n; 1013 else 1014 rte_exit(EXIT_FAILURE, 1015 "txqflags must be >= 0\n"); 1016 } 1017 if (!strcmp(lgopts[opt_idx].name, "rxd")) { 1018 n = atoi(optarg); 1019 if (n > 0) { 1020 if (rx_free_thresh >= n) 1021 rte_exit(EXIT_FAILURE, 1022 "rxd must be > " 1023 "rx_free_thresh(%d)\n", 1024 (int)rx_free_thresh); 1025 else 1026 nb_rxd = (uint16_t) n; 1027 } else 1028 rte_exit(EXIT_FAILURE, 1029 "rxd(%d) invalid - must be > 0\n", 1030 n); 1031 } 1032 if (!strcmp(lgopts[opt_idx].name, "txd")) { 1033 n = atoi(optarg); 1034 if (n > 0) 1035 nb_txd = (uint16_t) n; 1036 else 1037 rte_exit(EXIT_FAILURE, "txd must be in > 0\n"); 1038 } 1039 if (!strcmp(lgopts[opt_idx].name, "txpt")) { 1040 n = atoi(optarg); 1041 if (n >= 0) 1042 tx_pthresh = (int8_t)n; 1043 else 1044 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n"); 1045 } 1046 if (!strcmp(lgopts[opt_idx].name, "txht")) { 1047 n = atoi(optarg); 1048 if (n >= 0) 1049 tx_hthresh = (int8_t)n; 1050 else 1051 rte_exit(EXIT_FAILURE, "txht must be >= 0\n"); 1052 } 1053 if (!strcmp(lgopts[opt_idx].name, "txwt")) { 1054 n = atoi(optarg); 1055 if (n >= 0) 1056 tx_wthresh = (int8_t)n; 1057 else 1058 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n"); 1059 } 1060 if (!strcmp(lgopts[opt_idx].name, "rxpt")) { 1061 n = atoi(optarg); 1062 if (n >= 0) 1063 rx_pthresh = (int8_t)n; 1064 else 1065 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n"); 1066 } 1067 if (!strcmp(lgopts[opt_idx].name, "rxht")) { 1068 n = atoi(optarg); 1069 if (n >= 0) 1070 rx_hthresh = (int8_t)n; 1071 else 1072 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n"); 1073 } 1074 if (!strcmp(lgopts[opt_idx].name, "rxwt")) { 1075 n = atoi(optarg); 1076 if (n >= 0) 1077 rx_wthresh = (int8_t)n; 1078 else 1079 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n"); 1080 } 1081 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) { 1082 n = atoi(optarg); 1083 if (n >= 0) 1084 rx_free_thresh = (int16_t)n; 1085 else 1086 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n"); 1087 } 1088 if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) { 1089 if (parse_queue_stats_mapping_config(optarg, TX)) { 1090 rte_exit(EXIT_FAILURE, 1091 "invalid TX queue statistics mapping config entered\n"); 1092 } 1093 } 1094 if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) { 1095 if (parse_queue_stats_mapping_config(optarg, RX)) { 1096 rte_exit(EXIT_FAILURE, 1097 "invalid RX queue statistics mapping config entered\n"); 1098 } 1099 } 1100 if (!strcmp(lgopts[opt_idx].name, "txpkts")) { 1101 unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT]; 1102 unsigned int nb_segs; 1103 1104 nb_segs = parse_item_list(optarg, "txpkt segments", 1105 RTE_MAX_SEGS_PER_PKT, seg_lengths, 0); 1106 if (nb_segs > 0) 1107 set_tx_pkt_segments(seg_lengths, nb_segs); 1108 else 1109 rte_exit(EXIT_FAILURE, "bad txpkts\n"); 1110 } 1111 if (!strcmp(lgopts[opt_idx].name, "no-flush-rx")) 1112 no_flush_rx = 1; 1113 if (!strcmp(lgopts[opt_idx].name, "disable-link-check")) 1114 no_link_check = 1; 1115 if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt")) 1116 lsc_interrupt = 0; 1117 if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt")) 1118 rmv_interrupt = 0; 1119 if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all")) 1120 flow_isolate_all = 1; 1121 if (!strcmp(lgopts[opt_idx].name, "print-event")) 1122 if (parse_event_printing_config(optarg, 1)) { 1123 rte_exit(EXIT_FAILURE, 1124 "invalid print-event argument\n"); 1125 } 1126 if (!strcmp(lgopts[opt_idx].name, "mask-event")) 1127 if (parse_event_printing_config(optarg, 0)) { 1128 rte_exit(EXIT_FAILURE, 1129 "invalid mask-event argument\n"); 1130 } 1131 1132 break; 1133 case 'h': 1134 usage(argv[0]); 1135 rte_exit(EXIT_SUCCESS, "Displayed help\n"); 1136 break; 1137 default: 1138 usage(argv[0]); 1139 rte_exit(EXIT_FAILURE, 1140 "Command line is incomplete or incorrect\n"); 1141 break; 1142 } 1143 } 1144 } 1145