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 "--mbuf-size= | --total-num-mbufs= | "
86 "--eth-peers-configfile= | "
87 "--eth-peer=X,M:M:M:M:M:M | --nb-cores= | --nb-ports= | "
88 "--pkt-filter-mode= |"
89 "--rss-ip | --rss-udp | "
90 "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
91 "--txpt= | --txht= | --txwt= | --txfreet= | "
94 printf(" --interactive: run in interactive mode\n");
95 printf(" --help: display this message and quit\n");
96 printf(" --eth-peers-configfile=name of file with ethernet addresses "
98 printf(" --eth-peer=X,M:M:M:M:M:M set the mac address of the X peer "
99 "port (0 <= X < %d)\n", RTE_MAX_ETHPORTS);
100 printf(" --nb-cores=N set the number of forwarding cores"
101 " (1 <= N <= %d)\n", nb_lcores);
102 printf(" --nb-ports=N set the number of forwarding ports"
103 " (1 <= N <= %d)\n", nb_ports);
104 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running "
105 "the packet forwarding test\n");
106 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used "
107 "by the packet forwarding test\n");
108 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
109 " RX memory buffers (mbufs)\n");
110 printf(" --mbuf-size=N set the data size of mbuf to N bytes\n");
111 printf(" --total-num-mbufs=N set the number of mbufs to be allocated "
113 printf(" --max-pkt-len=N set the maximum size of packet to N bytes\n");
114 printf(" --pkt-filter-mode=N: set Flow director mode "
115 "( N: none (default mode) or signature or perfect)\n");
116 printf(" --pkt-filter-report-hash=N: set Flow director report mode "
117 "( N: none or match (default) or always)\n");
118 printf(" --pkt-filter-size=N: set Flow director mode "
119 "( N: 64K (default mode) or 128K or 256K)\n");
120 printf(" --pkt-filter-flexbytes-offset=N: set flexbytes-offset."
121 " The offset is defined in word units counted from the"
122 " first byte of the destination Ethernet MAC address."
124 printf(" --pkt-filter-drop-queue=N: set drop-queue."
125 " In perfect mode, when you add a rule with queue -1"
126 " the packet will be enqueued into the rx drop-queue."
127 " If the drop-queue doesn't exist, the packet is dropped."
128 " By default drop-queue=127\n");
129 printf(" --crc-strip: enable CRC stripping by hardware\n");
130 printf(" --enable-rx-cksum: enable rx hardware checksum offload\n");
131 printf(" --disable-hw-vlan: disable hardware vlan\n");
132 printf(" --disable-rss: disable rss\n");
133 printf(" --port-topology=N: set port topology (N: paired (default) or "
135 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only \n");
136 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP\n");
137 printf(" --rxq=N set the number of RX queues per port to N\n");
138 printf(" --rxd=N set the number of descriptors in RX rings to N\n");
139 printf(" --txq=N set the number of TX queues per port to N\n");
140 printf(" --txd=N set the number of descriptors in TX rings to N\n");
141 printf(" --burst=N set the number of packets per burst to N\n");
142 printf(" --mbcache=N set the cache of mbuf memory pool to N\n");
143 printf(" --rxpt=N set prefetch threshold register of RX rings to N"
144 " (0 <= N <= 16)\n");
145 printf(" --rxht=N set the host threshold register of RX rings to N"
146 " (0 <= N <= 16)\n");
147 printf(" --rxfreet=N set the free threshold of RX descriptors to N"
148 " (0 <= N < value of rxd)\n");
149 printf(" --rxwt=N set the write-back threshold register of RX rings"
150 " to N (0 <= N <= 16)\n");
151 printf(" --txpt=N set the prefetch threshold register of TX rings"
152 " to N (0 <= N <= 16)\n");
153 printf(" --txht=N set the nhost threshold register of TX rings to N"
154 " (0 <= N <= 16)\n");
155 printf(" --txwt=N set the write-back threshold register of TX rings"
156 " to N (0 <= N <= 16)\n");
157 printf(" --txfreet=N set the transmit free threshold of TX rings to N"
158 " (0 <= N <= value of txd)\n");
159 printf(" --txrst=N set the transmit RS bit threshold of TX rings to N"
160 " (0 <= N <= value of txd)\n");
161 printf(" --tx-queue-stats-mapping (port,queue,mapping)[,(port,queue,mapping]:"
162 " tx queues statistics counters mapping"
163 " (0 <= mapping <= %d)\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
164 printf(" --rx-queue-stats-mapping (port,queue,mapping)[,(port,queue,mapping]:"
165 " rx queues statistics counters mapping"
166 " (0 <= mapping <= %d)\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
170 init_peer_eth_addrs(char *config_filename)
176 config_file = fopen(config_filename, "r");
177 if (config_file == NULL) {
178 perror("open log file failed\n");
182 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
184 if (fgets(buf, sizeof(buf), config_file) == NULL)
187 if (cmdline_parse_etheraddr(NULL, buf, &peer_eth_addrs[i]) < 0 ){
188 printf("bad format of mac address on line %d\n", i);
194 nb_peer_eth_addrs = (portid_t) i;
199 * Parse the coremask given as argument (hexadecimal string) and set
200 * the global configuration of forwarding cores.
203 parse_fwd_coremask(const char *coremask)
206 unsigned long long int cm;
208 /* parse hexadecimal string */
210 cm = strtoull(coremask, &end, 16);
211 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0'))
212 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n");
214 set_fwd_lcores_mask((uint64_t) cm);
218 * Parse the coremask given as argument (hexadecimal string) and set
219 * the global configuration of forwarding cores.
222 parse_fwd_portmask(const char *portmask)
225 unsigned long long int pm;
227 /* parse hexadecimal string */
229 pm = strtoull(portmask, &end, 16);
230 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
231 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
233 set_fwd_ports_mask((uint64_t) pm);
238 parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
241 const char *p, *p0 = q_arg;
249 unsigned long int_fld[_NUM_FLD];
250 char *str_fld[_NUM_FLD];
254 /* reset from value set at definition */
255 is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0);
257 while ((p = strchr(p0,'(')) != NULL) {
259 if((p0 = strchr(p,')')) == NULL)
263 if(size >= sizeof(s))
266 rte_snprintf(s, sizeof(s), "%.*s", size, p);
267 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
269 for (i = 0; i < _NUM_FLD; i++){
271 int_fld[i] = strtoul(str_fld[i], &end, 0);
272 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
275 /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */
276 if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
277 printf("Stats counter not in the correct range 0..%d\n",
278 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
282 if (is_rx ? (nb_rx_queue_stats_mappings >= MAX_RX_QUEUE_STATS_MAPPINGS) :
283 (nb_tx_queue_stats_mappings >= MAX_TX_QUEUE_STATS_MAPPINGS)) {
284 printf("exceeded max number of %s queue statistics mappings: %hu\n",
286 is_rx ? nb_rx_queue_stats_mappings : nb_tx_queue_stats_mappings);
290 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id =
291 (uint8_t)int_fld[FLD_PORT];
292 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id =
293 (uint8_t)int_fld[FLD_QUEUE];
294 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id =
295 (uint8_t)int_fld[FLD_STATS_COUNTER];
296 ++nb_tx_queue_stats_mappings;
299 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id =
300 (uint8_t)int_fld[FLD_PORT];
301 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id =
302 (uint8_t)int_fld[FLD_QUEUE];
303 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id =
304 (uint8_t)int_fld[FLD_STATS_COUNTER];
305 ++nb_rx_queue_stats_mappings;
309 /* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */
310 /* than to the default array (that was set at its definition) */
311 is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) :
312 (tx_queue_stats_mappings = tx_queue_stats_mappings_array);
318 launch_args_parse(int argc, char** argv)
323 static struct option lgopts[] = {
325 { "interactive", 0, 0, 0 },
326 { "eth-peers-configfile", 1, 0, 0 },
327 { "eth-peer", 1, 0, 0 },
328 { "ports", 1, 0, 0 },
329 { "nb-cores", 1, 0, 0 },
330 { "nb-ports", 1, 0, 0 },
331 { "coremask", 1, 0, 0 },
332 { "portmask", 1, 0, 0 },
334 { "mbuf-size", 1, 0, 0 },
335 { "total-num-mbufs", 1, 0, 0 },
336 { "max-pkt-len", 1, 0, 0 },
337 { "pkt-filter-mode", 1, 0, 0 },
338 { "pkt-filter-report-hash", 1, 0, 0 },
339 { "pkt-filter-size", 1, 0, 0 },
340 { "pkt-filter-flexbytes-offset",1, 0, 0 },
341 { "pkt-filter-drop-queue", 1, 0, 0 },
342 { "crc-strip", 0, 0, 0 },
343 { "disable-hw-vlan", 0, 0, 0 },
344 { "disable-rss", 0, 0, 0 },
345 { "port-topology", 1, 0, 0 },
346 { "rss-ip", 0, 0, 0 },
347 { "rss-udp", 0, 0, 0 },
352 { "burst", 1, 0, 0 },
353 { "mbcache", 1, 0, 0 },
357 { "txfreet", 1, 0, 0 },
358 { "txrst", 1, 0, 0 },
362 { "rxfreet", 1, 0, 0 },
363 { "tx-queue-stats-mapping", 1, 0, 0 },
364 { "rx-queue-stats-mapping", 1, 0, 0 },
370 while ((opt = getopt_long(argc, argvopt, "ih",
371 lgopts, &opt_idx)) != EOF) {
374 printf("Interactive-mode selected\n");
377 case 0: /*long options */
378 if (!strcmp(lgopts[opt_idx].name, "help")) {
380 rte_exit(EXIT_SUCCESS, "Displayed help\n");
382 if (!strcmp(lgopts[opt_idx].name, "interactive")) {
383 printf("Interactive-mode selected\n");
386 if (!strcmp(lgopts[opt_idx].name,
387 "eth-peers-configfile")) {
388 if (init_peer_eth_addrs(optarg) != 0)
389 rte_exit(EXIT_FAILURE,
390 "Cannot open logfile\n");
392 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
394 uint8_t c, peer_addr[6];
397 n = strtoul(optarg, &port_end, 10);
398 if (errno != 0 || port_end == optarg || *port_end++ != ',')
399 rte_exit(EXIT_FAILURE,
400 "Invalid eth-peer: %s", optarg);
401 if (n >= RTE_MAX_ETHPORTS)
402 rte_exit(EXIT_FAILURE,
403 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
404 n, RTE_MAX_ETHPORTS);
406 if (cmdline_parse_etheraddr(NULL, port_end, &peer_addr) < 0 )
407 rte_exit(EXIT_FAILURE,
408 "Invalid ethernet address: %s\n",
410 for (c = 0; c < 6; c++)
411 peer_eth_addrs[n].addr_bytes[c] =
415 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
417 if (n > 0 && n <= nb_ports)
418 nb_fwd_ports = (uint8_t) n;
420 rte_exit(EXIT_FAILURE,
421 "nb-ports should be > 0 and <= %d\n",
424 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) {
426 if (n > 0 && n <= nb_lcores)
427 nb_fwd_lcores = (uint8_t) n;
429 rte_exit(EXIT_FAILURE,
430 "nb-cores should be > 0 and <= %d\n",
433 if (!strcmp(lgopts[opt_idx].name, "coremask"))
434 parse_fwd_coremask(optarg);
435 if (!strcmp(lgopts[opt_idx].name, "portmask"))
436 parse_fwd_portmask(optarg);
437 if (!strcmp(lgopts[opt_idx].name, "numa"))
439 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
441 if (n > 0 && n <= 0xFFFF)
442 mbuf_data_size = (uint16_t) n;
444 rte_exit(EXIT_FAILURE,
445 "mbuf-size should be > 0 and < 65536\n");
447 if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
450 param_total_num_mbufs = (unsigned)n;
452 rte_exit(EXIT_FAILURE,
453 "total-num-mbufs should be > 1024\n");
455 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
457 if (n >= ETHER_MIN_LEN) {
458 rx_mode.max_rx_pkt_len = (uint32_t) n;
459 if (n > ETHER_MAX_LEN)
460 rx_mode.jumbo_frame = 1;
462 rte_exit(EXIT_FAILURE,
463 "Invalid max-pkt-len=%d - should be > %d\n",
466 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
467 if (!strcmp(optarg, "signature"))
469 RTE_FDIR_MODE_SIGNATURE;
470 else if (!strcmp(optarg, "perfect"))
471 fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
472 else if (!strcmp(optarg, "none"))
473 fdir_conf.mode = RTE_FDIR_MODE_NONE;
475 rte_exit(EXIT_FAILURE,
476 "pkt-mode-invalid %s invalid - must be: "
477 "none, signature or perfect\n",
480 if (!strcmp(lgopts[opt_idx].name,
481 "pkt-filter-report-hash")) {
482 if (!strcmp(optarg, "none"))
484 RTE_FDIR_NO_REPORT_STATUS;
485 else if (!strcmp(optarg, "match"))
487 RTE_FDIR_REPORT_STATUS;
488 else if (!strcmp(optarg, "always"))
490 RTE_FDIR_REPORT_STATUS_ALWAYS;
492 rte_exit(EXIT_FAILURE,
493 "pkt-filter-report-hash %s invalid "
494 "- must be: none or match or always\n",
497 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
498 if (!strcmp(optarg, "64K"))
500 RTE_FDIR_PBALLOC_64K;
501 else if (!strcmp(optarg, "128K"))
503 RTE_FDIR_PBALLOC_128K;
504 else if (!strcmp(optarg, "256K"))
506 RTE_FDIR_PBALLOC_256K;
508 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
509 " must be: 64K or 128K or 256K\n",
512 if (!strcmp(lgopts[opt_idx].name,
513 "pkt-filter-flexbytes-offset")) {
515 if ( n >= 0 && n <= (int) 32)
516 fdir_conf.flexbytes_offset =
519 rte_exit(EXIT_FAILURE,
520 "flexbytes %d invalid - must"
521 "be >= 0 && <= 32\n", n);
523 if (!strcmp(lgopts[opt_idx].name,
524 "pkt-filter-drop-queue")) {
527 fdir_conf.drop_queue = (uint8_t) n;
529 rte_exit(EXIT_FAILURE,
530 "drop queue %d invalid - must"
533 if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
534 rx_mode.hw_strip_crc = 1;
535 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
536 rx_mode.hw_ip_checksum = 1;
538 if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) {
539 rx_mode.hw_vlan_filter = 0;
540 rx_mode.hw_vlan_strip = 0;
541 rx_mode.hw_vlan_extend = 0;
544 if (!strcmp(lgopts[opt_idx].name, "disable-rss"))
546 if (!strcmp(lgopts[opt_idx].name, "port-topology")) {
547 if (!strcmp(optarg, "paired"))
548 port_topology = PORT_TOPOLOGY_PAIRED;
549 else if (!strcmp(optarg, "chained"))
550 port_topology = PORT_TOPOLOGY_CHAINED;
552 rte_exit(EXIT_FAILURE, "port-topology %s invalid -"
553 " must be: paired or chained \n",
556 if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
557 rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6;
558 if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
559 rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6 |
561 if (!strcmp(lgopts[opt_idx].name, "rxq")) {
563 if (n >= 1 && n <= (int) MAX_QUEUE_ID)
564 nb_rxq = (queueid_t) n;
566 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
567 " >= 1 && <= %d\n", n,
570 if (!strcmp(lgopts[opt_idx].name, "txq")) {
572 if (n >= 1 && n <= (int) MAX_QUEUE_ID)
573 nb_txq = (queueid_t) n;
575 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
576 " >= 1 && <= %d\n", n,
579 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
582 nb_rxd = (uint16_t) n;
584 rte_exit(EXIT_FAILURE, "rxd must be > 0\n");
586 if (!strcmp(lgopts[opt_idx].name, "txd")) {
589 nb_txd = (uint16_t) n;
591 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
593 if (!strcmp(lgopts[opt_idx].name, "burst")) {
595 if ((n >= 1) && (n <= MAX_PKT_BURST))
596 nb_pkt_per_burst = (uint16_t) n;
598 rte_exit(EXIT_FAILURE,
599 "burst must >= 1 and <= %d]",
602 if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
605 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
606 mb_mempool_cache = (uint16_t) n;
608 rte_exit(EXIT_FAILURE,
609 "mbcache must be >= 0 and <= %d\n",
610 RTE_MEMPOOL_CACHE_MAX_SIZE);
612 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
615 tx_thresh.pthresh = (uint8_t)n;
617 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
619 if (!strcmp(lgopts[opt_idx].name, "txht")) {
622 tx_thresh.hthresh = (uint8_t)n;
624 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
626 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
629 tx_thresh.wthresh = (uint8_t)n;
631 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
633 if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
636 tx_free_thresh = (uint16_t)n;
638 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n");
640 if (!strcmp(lgopts[opt_idx].name, "txrst")) {
643 tx_rs_thresh = (uint16_t)n;
645 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
647 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
650 rx_thresh.pthresh = (uint8_t)n;
652 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
654 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
657 rx_thresh.hthresh = (uint8_t)n;
659 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
661 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
664 rx_thresh.wthresh = (uint8_t)n;
666 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
668 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
671 if (rx_free_thresh >= n)
672 rte_exit(EXIT_FAILURE,
674 "rx_free_thresh(%d)\n",
675 (int)rx_free_thresh);
677 nb_rxd = (uint16_t) n;
679 rte_exit(EXIT_FAILURE,
680 "rxd(%d) invalid - must be > 0\n",
683 if (!strcmp(lgopts[opt_idx].name, "txd")) {
686 nb_txd = (uint16_t) n;
688 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
690 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
693 tx_thresh.pthresh = (uint8_t)n;
695 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
697 if (!strcmp(lgopts[opt_idx].name, "txht")) {
700 tx_thresh.hthresh = (uint8_t)n;
702 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
704 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
707 tx_thresh.wthresh = (uint8_t)n;
709 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
711 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
714 rx_thresh.pthresh = (uint8_t)n;
716 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
718 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
721 rx_thresh.hthresh = (uint8_t)n;
723 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
725 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
728 rx_thresh.wthresh = (uint8_t)n;
730 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
732 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) {
735 rx_free_thresh = (uint16_t)n;
737 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n");
739 if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) {
740 if (parse_queue_stats_mapping_config(optarg, TX)) {
741 rte_exit(EXIT_FAILURE,
742 "invalid TX queue statistics mapping config entered\n");
745 if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) {
746 if (parse_queue_stats_mapping_config(optarg, RX)) {
747 rte_exit(EXIT_FAILURE,
748 "invalid RX queue statistics mapping config entered\n");
754 rte_exit(EXIT_SUCCESS, "Displayed help\n");
758 rte_exit(EXIT_FAILURE,
759 "Command line is incomplete or incorrect\n");