4 * Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
44 #include <sys/types.h>
47 #include <sys/queue.h>
54 #include <rte_common.h>
55 #include <rte_byteorder.h>
57 #include <rte_debug.h>
58 #include <rte_cycles.h>
59 #include <rte_memory.h>
60 #include <rte_memzone.h>
61 #include <rte_launch.h>
62 #include <rte_tailq.h>
64 #include <rte_per_lcore.h>
65 #include <rte_lcore.h>
66 #include <rte_atomic.h>
67 #include <rte_branch_prediction.h>
69 #include <rte_mempool.h>
70 #include <rte_interrupts.h>
72 #include <rte_ether.h>
73 #include <rte_ethdev.h>
74 #include <rte_string_fns.h>
75 #include <cmdline_parse.h>
76 #include <cmdline_parse_etheraddr.h>
83 printf("usage: %s [--interactive|-i] [--help|-h] | ["
84 "--coremask=COREMASK --portmask=PORTMASK --numa "
85 "--eth-peers-configfile= | "
86 "--eth-peer=X,M:M:M:M:M:M | --nb-cores= | --nb-ports= | "
87 "--pkt-filter-mode= |"
88 "--rss-ip | --rss-udp | "
89 "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
90 "--txpt= | --txht= | --txwt= | --txfreet= | "
93 printf(" --interactive: run in interactive mode\n");
94 printf(" --help: display this message and quit\n");
95 printf(" --eth-peers-configfile=name of file with ethernet addresses "
97 printf(" --eth-peer=X,M:M:M:M:M:M set the mac address of the X peer "
98 "port (0 <= X < %d)\n", RTE_MAX_ETHPORTS);
99 printf(" --nb-cores=N set the number of forwarding cores"
100 " (1 <= N <= %d)\n", nb_lcores);
101 printf(" --nb-ports=N set the number of forwarding ports"
102 " (1 <= N <= %d)\n", nb_ports);
103 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running "
104 "the packet forwarding test\n");
105 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used "
106 "by the packet forwarding test\n");
107 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
108 " RX memory buffers (mbufs)\n");
109 printf(" --mbuf-size=N set the data size of mbuf to N bytes\n");
110 printf(" --max-pkt-len=N set the maximum size of packet to N bytes\n");
111 printf(" --pkt-filter-mode=N: set Flow director mode "
112 "( N: none (default mode) or signature or perfect)\n");
113 printf(" --pkt-filter-report-hash=N: set Flow director report mode "
114 "( N: none or match (default) or always)\n");
115 printf(" --pkt-filter-size=N: set Flow director mode "
116 "( N: 64K (default mode) or 128K or 256K)\n");
117 printf(" --pkt-filter-flexbytes-offset=N: set flexbytes-offset."
118 " The offset is defined in word units counted from the"
119 " first byte of the destination Ethernet MAC address."
121 printf(" --pkt-filter-drop-queue=N: set drop-queue."
122 " In perfect mode, when you add a rule with queue -1"
123 " the packet will be enqueued into the rx drop-queue."
124 " If the drop-queue doesn't exist, the packet is dropped."
125 " By default drop-queue=127\n");
126 printf(" --crc-strip: enable CRC stripping by hardware\n");
127 printf(" --enable-rx-cksum: enable rx hardware checksum offload\n");
128 printf(" --disable-hw-vlan: disable hardware vlan\n");
129 printf(" --disable-rss: disable rss\n");
130 printf(" --port-topology=N: set port topology (N: paired (default) or "
132 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only \n");
133 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP\n");
134 printf(" --rxq=N set the number of RX queues per port to N\n");
135 printf(" --rxd=N set the number of descriptors in RX rings to N\n");
136 printf(" --txq=N set the number of TX queues per port to N\n");
137 printf(" --txd=N set the number of descriptors in TX rings to N\n");
138 printf(" --burst=N set the number of packets per burst to N\n");
139 printf(" --mbcache=N set the cache of mbuf memory pool to N\n");
140 printf(" --rxpt=N set prefetch threshold register of RX rings to N"
141 " (0 <= N <= 16)\n");
142 printf(" --rxht=N set the host threshold register of RX rings to N"
143 " (0 <= N <= 16)\n");
144 printf(" --rxfreet=N set the free threshold of RX descriptors to N"
145 " (0 <= N < value of rxd)\n");
146 printf(" --rxwt=N set the write-back threshold register of RX rings"
147 " to N (0 <= N <= 16)\n");
148 printf(" --txpt=N set the prefetch threshold register of TX rings"
149 " to N (0 <= N <= 16)\n");
150 printf(" --txht=N set the nhost threshold register of TX rings to N"
151 " (0 <= N <= 16)\n");
152 printf(" --txwt=N set the write-back threshold register of TX rings"
153 " to N (0 <= N <= 16)\n");
154 printf(" --txfreet=N set the transmit free threshold of TX rings to N"
155 " (0 <= N <= value of txd)\n");
156 printf(" --txrst=N set the transmit RS bit threshold of TX rings to N"
157 " (0 <= N <= value of txd)\n");
158 printf(" --tx-queue-stats-mapping (port,queue,mapping)[,(port,queue,mapping]:"
159 " tx queues statistics counters mapping"
160 " (0 <= mapping <= %d)\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
161 printf(" --rx-queue-stats-mapping (port,queue,mapping)[,(port,queue,mapping]:"
162 " rx queues statistics counters mapping"
163 " (0 <= mapping <= %d)\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
167 init_peer_eth_addrs(char *config_filename)
173 config_file = fopen(config_filename, "r");
174 if (config_file == NULL) {
175 perror("open log file failed\n");
179 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
181 if (fgets(buf, sizeof(buf), config_file) == NULL)
184 if (cmdline_parse_etheraddr(NULL, buf, &peer_eth_addrs[i]) < 0 ){
185 printf("bad format of mac address on line %d\n", i);
191 nb_peer_eth_addrs = (portid_t) i;
196 * Parse the coremask given as argument (hexadecimal string) and set
197 * the global configuration of forwarding cores.
200 parse_fwd_coremask(const char *coremask)
203 unsigned long long int cm;
205 /* parse hexadecimal string */
207 cm = strtoull(coremask, &end, 16);
208 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0'))
209 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n");
211 set_fwd_lcores_mask((uint64_t) cm);
215 * Parse the coremask given as argument (hexadecimal string) and set
216 * the global configuration of forwarding cores.
219 parse_fwd_portmask(const char *portmask)
222 unsigned long long int pm;
224 /* parse hexadecimal string */
226 pm = strtoull(portmask, &end, 16);
227 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
228 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
230 set_fwd_ports_mask((uint64_t) pm);
235 parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
238 const char *p, *p0 = q_arg;
246 unsigned long int_fld[_NUM_FLD];
247 char *str_fld[_NUM_FLD];
251 /* reset from value set at definition */
252 is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0);
254 while ((p = strchr(p0,'(')) != NULL) {
256 if((p0 = strchr(p,')')) == NULL)
260 if(size >= sizeof(s))
263 rte_snprintf(s, sizeof(s), "%.*s", size, p);
264 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
266 for (i = 0; i < _NUM_FLD; i++){
268 int_fld[i] = strtoul(str_fld[i], &end, 0);
269 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
272 /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */
273 if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
274 printf("Stats counter not in the correct range 0..%d\n",
275 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
279 if (is_rx ? (nb_rx_queue_stats_mappings >= MAX_RX_QUEUE_STATS_MAPPINGS) :
280 (nb_tx_queue_stats_mappings >= MAX_TX_QUEUE_STATS_MAPPINGS)) {
281 printf("exceeded max number of %s queue statistics mappings: %hu\n",
283 is_rx ? nb_rx_queue_stats_mappings : nb_tx_queue_stats_mappings);
287 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id =
288 (uint8_t)int_fld[FLD_PORT];
289 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id =
290 (uint8_t)int_fld[FLD_QUEUE];
291 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id =
292 (uint8_t)int_fld[FLD_STATS_COUNTER];
293 ++nb_tx_queue_stats_mappings;
296 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id =
297 (uint8_t)int_fld[FLD_PORT];
298 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id =
299 (uint8_t)int_fld[FLD_QUEUE];
300 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id =
301 (uint8_t)int_fld[FLD_STATS_COUNTER];
302 ++nb_rx_queue_stats_mappings;
306 /* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */
307 /* than to the default array (that was set at its definition) */
308 is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) :
309 (tx_queue_stats_mappings = tx_queue_stats_mappings_array);
315 launch_args_parse(int argc, char** argv)
320 static struct option lgopts[] = {
322 { "interactive", 0, 0, 0 },
323 { "eth-peers-configfile", 1, 0, 0 },
324 { "eth-peer", 1, 0, 0 },
325 { "ports", 1, 0, 0 },
326 { "nb-cores", 1, 0, 0 },
327 { "nb-ports", 1, 0, 0 },
328 { "coremask", 1, 0, 0 },
329 { "portmask", 1, 0, 0 },
331 { "mbuf-size", 1, 0, 0 },
332 { "max-pkt-len", 1, 0, 0 },
333 { "pkt-filter-mode", 1, 0, 0 },
334 { "pkt-filter-report-hash", 1, 0, 0 },
335 { "pkt-filter-size", 1, 0, 0 },
336 { "pkt-filter-flexbytes-offset",1, 0, 0 },
337 { "pkt-filter-drop-queue", 1, 0, 0 },
338 { "crc-strip", 0, 0, 0 },
339 { "disable-hw-vlan", 0, 0, 0 },
340 { "disable-rss", 0, 0, 0 },
341 { "port-topology", 1, 0, 0 },
342 { "rss-ip", 0, 0, 0 },
343 { "rss-udp", 0, 0, 0 },
348 { "burst", 1, 0, 0 },
349 { "mbcache", 1, 0, 0 },
353 { "txfreet", 1, 0, 0 },
354 { "txrst", 1, 0, 0 },
358 { "rxfreet", 1, 0, 0 },
359 { "tx-queue-stats-mapping", 1, 0, 0 },
360 { "rx-queue-stats-mapping", 1, 0, 0 },
366 while ((opt = getopt_long(argc, argvopt, "ih",
367 lgopts, &opt_idx)) != EOF) {
370 printf("Interactive-mode selected\n");
373 case 0: /*long options */
374 if (!strcmp(lgopts[opt_idx].name, "help")) {
376 rte_exit(EXIT_SUCCESS, "Displayed help\n");
378 if (!strcmp(lgopts[opt_idx].name, "interactive")) {
379 printf("Interactive-mode selected\n");
382 if (!strcmp(lgopts[opt_idx].name,
383 "eth-peers-configfile")) {
384 if (init_peer_eth_addrs(optarg) != 0)
385 rte_exit(EXIT_FAILURE,
386 "Cannot open logfile\n");
388 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
390 uint8_t c, peer_addr[6];
393 n = strtoul(optarg, &port_end, 10);
394 if (errno != 0 || port_end == optarg || *port_end++ != ',')
395 rte_exit(EXIT_FAILURE,
396 "Invalid eth-peer: %s", optarg);
397 if (n >= RTE_MAX_ETHPORTS)
398 rte_exit(EXIT_FAILURE,
399 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
400 n, RTE_MAX_ETHPORTS);
402 if (cmdline_parse_etheraddr(NULL, port_end, &peer_addr) < 0 )
403 rte_exit(EXIT_FAILURE,
404 "Invalid ethernet address: %s\n",
406 for (c = 0; c < 6; c++)
407 peer_eth_addrs[n].addr_bytes[c] =
411 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
413 if (n > 0 && n <= nb_ports)
414 nb_fwd_ports = (uint8_t) n;
416 rte_exit(EXIT_FAILURE,
417 "nb-ports should be > 0 and <= %d\n",
420 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) {
422 if (n > 0 && n <= nb_lcores)
423 nb_fwd_lcores = (uint8_t) n;
425 rte_exit(EXIT_FAILURE,
426 "nb-cores should be > 0 and <= %d\n",
429 if (!strcmp(lgopts[opt_idx].name, "coremask"))
430 parse_fwd_coremask(optarg);
431 if (!strcmp(lgopts[opt_idx].name, "portmask"))
432 parse_fwd_portmask(optarg);
433 if (!strcmp(lgopts[opt_idx].name, "numa"))
435 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
437 if (n > 0 && n <= 0xFFFF)
438 mbuf_data_size = (uint16_t) n;
440 rte_exit(EXIT_FAILURE,
441 "mbuf-size should be > 0 and < 65536\n");
443 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
445 if (n >= ETHER_MIN_LEN) {
446 rx_mode.max_rx_pkt_len = (uint32_t) n;
447 if (n > ETHER_MAX_LEN)
448 rx_mode.jumbo_frame = 1;
450 rte_exit(EXIT_FAILURE,
451 "Invalid max-pkt-len=%d - should be > %d\n",
454 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
455 if (!strcmp(optarg, "signature"))
457 RTE_FDIR_MODE_SIGNATURE;
458 else if (!strcmp(optarg, "perfect"))
459 fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
460 else if (!strcmp(optarg, "none"))
461 fdir_conf.mode = RTE_FDIR_MODE_NONE;
463 rte_exit(EXIT_FAILURE,
464 "pkt-mode-invalid %s invalid - must be: "
465 "none, signature or perfect\n",
468 if (!strcmp(lgopts[opt_idx].name,
469 "pkt-filter-report-hash")) {
470 if (!strcmp(optarg, "none"))
472 RTE_FDIR_NO_REPORT_STATUS;
473 else if (!strcmp(optarg, "match"))
475 RTE_FDIR_REPORT_STATUS;
476 else if (!strcmp(optarg, "always"))
478 RTE_FDIR_REPORT_STATUS_ALWAYS;
480 rte_exit(EXIT_FAILURE,
481 "pkt-filter-report-hash %s invalid "
482 "- must be: none or match or always\n",
485 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
486 if (!strcmp(optarg, "64K"))
488 RTE_FDIR_PBALLOC_64K;
489 else if (!strcmp(optarg, "128K"))
491 RTE_FDIR_PBALLOC_128K;
492 else if (!strcmp(optarg, "256K"))
494 RTE_FDIR_PBALLOC_256K;
496 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
497 " must be: 64K or 128K or 256K\n",
500 if (!strcmp(lgopts[opt_idx].name,
501 "pkt-filter-flexbytes-offset")) {
503 if ( n >= 0 && n <= (int) 32)
504 fdir_conf.flexbytes_offset =
507 rte_exit(EXIT_FAILURE,
508 "flexbytes %d invalid - must"
509 "be >= 0 && <= 32\n", n);
511 if (!strcmp(lgopts[opt_idx].name,
512 "pkt-filter-drop-queue")) {
515 fdir_conf.drop_queue = (uint8_t) n;
517 rte_exit(EXIT_FAILURE,
518 "drop queue %d invalid - must"
521 if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
522 rx_mode.hw_strip_crc = 1;
523 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
524 rx_mode.hw_ip_checksum = 1;
525 if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan"))
526 rx_mode.hw_vlan_filter = 0;
527 if (!strcmp(lgopts[opt_idx].name, "disable-rss"))
529 if (!strcmp(lgopts[opt_idx].name, "port-topology")) {
530 if (!strcmp(optarg, "paired"))
531 port_topology = PORT_TOPOLOGY_PAIRED;
532 else if (!strcmp(optarg, "chained"))
533 port_topology = PORT_TOPOLOGY_CHAINED;
535 rte_exit(EXIT_FAILURE, "port-topology %s invalid -"
536 " must be: paired or chained \n",
539 if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
540 rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6;
541 if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
542 rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6 |
544 if (!strcmp(lgopts[opt_idx].name, "rxq")) {
546 if (n >= 1 && n <= (int) MAX_QUEUE_ID)
547 nb_rxq = (queueid_t) n;
549 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
550 " >= 1 && <= %d\n", n,
553 if (!strcmp(lgopts[opt_idx].name, "txq")) {
555 if (n >= 1 && n <= (int) MAX_QUEUE_ID)
556 nb_txq = (queueid_t) n;
558 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
559 " >= 1 && <= %d\n", n,
562 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
565 nb_rxd = (uint16_t) n;
567 rte_exit(EXIT_FAILURE, "rxd must be > 0\n");
569 if (!strcmp(lgopts[opt_idx].name, "txd")) {
572 nb_txd = (uint16_t) n;
574 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
576 if (!strcmp(lgopts[opt_idx].name, "burst")) {
578 if ((n >= 1) && (n <= MAX_PKT_BURST))
579 nb_pkt_per_burst = (uint16_t) n;
581 rte_exit(EXIT_FAILURE,
582 "burst must >= 1 and <= %d]",
585 if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
588 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
589 mb_mempool_cache = (uint16_t) n;
591 rte_exit(EXIT_FAILURE,
592 "mbcache must be >= 0 and <= %d\n",
593 RTE_MEMPOOL_CACHE_MAX_SIZE);
595 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
598 tx_thresh.pthresh = (uint8_t)n;
600 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
602 if (!strcmp(lgopts[opt_idx].name, "txht")) {
605 tx_thresh.hthresh = (uint8_t)n;
607 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
609 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
612 tx_thresh.wthresh = (uint8_t)n;
614 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
616 if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
619 tx_free_thresh = (uint16_t)n;
621 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n");
623 if (!strcmp(lgopts[opt_idx].name, "txrst")) {
626 tx_rs_thresh = (uint16_t)n;
628 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
630 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
633 rx_thresh.pthresh = (uint8_t)n;
635 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
637 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
640 rx_thresh.hthresh = (uint8_t)n;
642 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
644 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
647 rx_thresh.wthresh = (uint8_t)n;
649 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
651 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
654 if (rx_free_thresh >= n)
655 rte_exit(EXIT_FAILURE,
657 "rx_free_thresh(%d)\n",
658 (int)rx_free_thresh);
660 nb_rxd = (uint16_t) n;
662 rte_exit(EXIT_FAILURE,
663 "rxd(%d) invalid - must be > 0\n",
666 if (!strcmp(lgopts[opt_idx].name, "txd")) {
669 nb_txd = (uint16_t) n;
671 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
673 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
676 tx_thresh.pthresh = (uint8_t)n;
678 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
680 if (!strcmp(lgopts[opt_idx].name, "txht")) {
683 tx_thresh.hthresh = (uint8_t)n;
685 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
687 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
690 tx_thresh.wthresh = (uint8_t)n;
692 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
694 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
697 rx_thresh.pthresh = (uint8_t)n;
699 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
701 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
704 rx_thresh.hthresh = (uint8_t)n;
706 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
708 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
711 rx_thresh.wthresh = (uint8_t)n;
713 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
715 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) {
718 rx_free_thresh = (uint16_t)n;
720 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n");
722 if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) {
723 if (parse_queue_stats_mapping_config(optarg, TX)) {
724 rte_exit(EXIT_FAILURE,
725 "invalid TX queue statistics mapping config entered\n");
728 if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) {
729 if (parse_queue_stats_mapping_config(optarg, RX)) {
730 rte_exit(EXIT_FAILURE,
731 "invalid RX queue statistics mapping config entered\n");
737 rte_exit(EXIT_SUCCESS, "Displayed help\n");
741 rte_exit(EXIT_FAILURE,
742 "Command line is incomplete or incorrect\n");