1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2017 Intel Corporation
14 #include <sys/types.h>
16 #include <sys/queue.h>
22 #include <arpa/inet.h>
24 #include <rte_common.h>
25 #include <rte_byteorder.h>
27 #include <rte_debug.h>
28 #include <rte_cycles.h>
29 #include <rte_memory.h>
30 #include <rte_launch.h>
32 #include <rte_per_lcore.h>
33 #include <rte_lcore.h>
34 #include <rte_atomic.h>
35 #include <rte_branch_prediction.h>
36 #include <rte_mempool.h>
37 #include <rte_interrupts.h>
39 #include <rte_ether.h>
40 #include <rte_ethdev.h>
41 #include <rte_string_fns.h>
42 #ifdef RTE_LIBRTE_PMD_BOND
43 #include <rte_eth_bond.h>
53 #ifdef RTE_LIBRTE_CMDLINE
55 "[--cmdline-file=FILENAME] "
57 "[--help|-h] | [--auto-start|-a] | ["
58 "--tx-first | --stats-period=PERIOD | "
59 "--coremask=COREMASK --portmask=PORTMASK --numa "
60 "--portlist=PORTLIST "
61 "--mbuf-size= | --total-num-mbufs= | "
62 "--nb-cores= | --nb-ports= | "
63 #ifdef RTE_LIBRTE_CMDLINE
64 "--eth-peers-configfile= | "
65 "--eth-peer=X,M:M:M:M:M:M | "
66 "--tx-ip=SRC,DST | --tx-udp=PORT | "
68 "--pkt-filter-mode= |"
69 "--rss-ip | --rss-udp | "
70 "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
71 "--txpt= | --txht= | --txwt= | --txfreet= | "
72 "--txrst= | --tx-offloads= | | --rx-offloads= | "
73 "--vxlan-gpe-port= ]\n",
75 #ifdef RTE_LIBRTE_CMDLINE
76 printf(" --interactive: run in interactive mode.\n");
77 printf(" --cmdline-file: execute cli commands before startup.\n");
79 printf(" --auto-start: start forwarding on init "
80 "[always when non-interactive].\n");
81 printf(" --help: display this message and quit.\n");
82 printf(" --tx-first: start forwarding sending a burst first "
83 "(only if interactive is disabled).\n");
84 printf(" --stats-period=PERIOD: statistics will be shown "
85 "every PERIOD seconds (only if interactive is disabled).\n");
86 printf(" --nb-cores=N: set the number of forwarding cores "
87 "(1 <= N <= %d).\n", nb_lcores);
88 printf(" --nb-ports=N: set the number of forwarding ports "
89 "(1 <= N <= %d).\n", nb_ports);
90 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running "
91 "the packet forwarding test. The master lcore is reserved for "
92 "command line parsing only, and cannot be masked on for "
93 "packet forwarding.\n");
94 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used "
95 "by the packet forwarding test.\n");
96 printf(" --portlist=PORTLIST: list of forwarding ports\n");
97 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
98 "RX memory buffers (mbufs).\n");
99 printf(" --port-numa-config=(port,socket)[,(port,socket)]: "
100 "specify the socket on which the memory pool "
101 "used by the port will be allocated.\n");
102 printf(" --ring-numa-config=(port,flag,socket)[,(port,flag,socket)]: "
103 "specify the socket on which the TX/RX rings for "
104 "the port will be allocated "
105 "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
106 printf(" --socket-num=N: set socket from which all memory is allocated "
108 printf(" --mbuf-size=N: set the data size of mbuf to N bytes.\n");
109 printf(" --total-num-mbufs=N: set the number of mbufs to be allocated "
111 printf(" --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
112 printf(" --max-lro-pkt-size=N: set the maximum LRO aggregated packet "
113 "size to N bytes.\n");
114 #ifdef RTE_LIBRTE_CMDLINE
115 printf(" --eth-peers-configfile=name: config file with ethernet addresses "
117 printf(" --eth-peer=X,M:M:M:M:M:M: set the MAC address of the X peer "
118 "port (0 <= X < %d).\n", RTE_MAX_ETHPORTS);
120 printf(" --pkt-filter-mode=N: set Flow Director mode "
121 "(N: none (default mode) or signature or perfect).\n");
122 printf(" --pkt-filter-report-hash=N: set Flow Director report mode "
123 "(N: none or match (default) or always).\n");
124 printf(" --pkt-filter-size=N: set Flow Director mode "
125 "(N: 64K (default mode) or 128K or 256K).\n");
126 printf(" --pkt-filter-drop-queue=N: set drop-queue. "
127 "In perfect mode, when you add a rule with queue = -1 "
128 "the packet will be enqueued into the rx drop-queue. "
129 "If the drop-queue doesn't exist, the packet is dropped. "
130 "By default drop-queue=127.\n");
131 #ifdef RTE_LIBRTE_LATENCY_STATS
132 printf(" --latencystats=N: enable latency and jitter statistcs "
133 "monitoring on forwarding lcore id N.\n");
135 printf(" --disable-crc-strip: disable CRC stripping by hardware.\n");
136 printf(" --enable-lro: enable large receive offload.\n");
137 printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n");
138 printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
139 printf(" --enable-hw-vlan: enable hardware vlan.\n");
140 printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n");
141 printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n");
142 printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n");
143 printf(" --enable-hw-qinq-strip: enable hardware qinq strip.\n");
144 printf(" --enable-drop-en: enable per queue packet drop.\n");
145 printf(" --disable-rss: disable rss.\n");
146 printf(" --port-topology=<paired|chained|loop>: set port topology (paired "
148 printf(" --forward-mode=N: set forwarding mode (N: %s).\n",
149 list_pkt_forwarding_modes());
150 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n");
151 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n");
152 printf(" --rxq=N: set the number of RX queues per port to N.\n");
153 printf(" --rxd=N: set the number of descriptors in RX rings to N.\n");
154 printf(" --txq=N: set the number of TX queues per port to N.\n");
155 printf(" --txd=N: set the number of descriptors in TX rings to N.\n");
156 printf(" --hairpinq=N: set the number of hairpin queues per port to "
158 printf(" --burst=N: set the number of packets per burst to N.\n");
159 printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n");
160 printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n");
161 printf(" --rxht=N: set the host threshold register of RX rings to N.\n");
162 printf(" --rxfreet=N: set the free threshold of RX descriptors to N "
163 "(0 <= N < value of rxd).\n");
164 printf(" --rxwt=N: set the write-back threshold register of RX rings to N.\n");
165 printf(" --txpt=N: set the prefetch threshold register of TX rings to N.\n");
166 printf(" --txht=N: set the nhost threshold register of TX rings to N.\n");
167 printf(" --txwt=N: set the write-back threshold register of TX rings to N.\n");
168 printf(" --txfreet=N: set the transmit free threshold of TX rings to N "
169 "(0 <= N <= value of txd).\n");
170 printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N "
171 "(0 <= N <= value of txd).\n");
172 printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: "
173 "tx queues statistics counters mapping "
174 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
175 printf(" --rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: "
176 "rx queues statistics counters mapping "
177 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
178 printf(" --no-flush-rx: Don't flush RX streams before forwarding."
179 " Used mainly with PCAP drivers.\n");
180 printf(" --txpkts=X[,Y]*: set TX segment sizes"
181 " or total packet length.\n");
182 printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n");
183 printf(" --disable-link-check: disable check on link status when "
184 "starting/stopping ports.\n");
185 printf(" --disable-device-start: do not automatically start port\n");
186 printf(" --no-lsc-interrupt: disable link status change interrupt.\n");
187 printf(" --no-rmv-interrupt: disable device removal interrupt.\n");
188 printf(" --bitrate-stats=N: set the logical core N to perform "
189 "bit-rate calculation.\n");
190 printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: "
191 "enable print of designated event or all of them.\n");
192 printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>: "
193 "disable print of designated event or all of them.\n");
194 printf(" --flow-isolate-all: "
195 "requests flow API isolated mode on all ports at initialization time.\n");
196 printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
197 printf(" --rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads\n");
198 printf(" --hot-plug: enable hot plug for device.\n");
199 printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n");
200 printf(" --mlockall: lock all memory\n");
201 printf(" --no-mlockall: do not lock all memory\n");
202 printf(" --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\n"
203 " native: use regular DPDK memory to create and populate mempool\n"
204 " anon: use regular DPDK memory to create and anonymous memory to populate mempool\n"
205 " xmem: use anonymous memory to create and populate mempool\n"
206 " xmemhuge: use anonymous hugepage memory to create and populate mempool\n");
207 printf(" --noisy-tx-sw-buffer-size=N: size of FIFO buffer\n");
208 printf(" --noisy-tx-sw-buffer-flushtime=N: flush FIFO after N ms\n");
209 printf(" --noisy-lkup-memory=N: allocate N MB of VNF memory\n");
210 printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n");
211 printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n");
212 printf(" --noisy-lkup-num-writes=N: do N random reads and writes per packet\n");
213 printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. "
214 "valid only with --mp-alloc=anon\n");
217 #ifdef RTE_LIBRTE_CMDLINE
219 init_peer_eth_addrs(char *config_filename)
225 config_file = fopen(config_filename, "r");
226 if (config_file == NULL) {
227 perror("Failed to open eth config file\n");
231 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
233 if (fgets(buf, sizeof(buf), config_file) == NULL)
236 if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
237 printf("Bad MAC address format on line %d\n", i+1);
243 nb_peer_eth_addrs = (portid_t) i;
249 * Parse the coremask given as argument (hexadecimal string) and set
250 * the global configuration of forwarding cores.
253 parse_fwd_coremask(const char *coremask)
256 unsigned long long int cm;
258 /* parse hexadecimal string */
260 cm = strtoull(coremask, &end, 16);
261 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0'))
262 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n");
263 else if (set_fwd_lcores_mask((uint64_t) cm) < 0)
264 rte_exit(EXIT_FAILURE, "coremask is not valid\n");
268 * Parse the coremask given as argument (hexadecimal string) and set
269 * the global configuration of forwarding cores.
272 parse_fwd_portmask(const char *portmask)
275 unsigned long long int pm;
277 /* parse hexadecimal string */
279 pm = strtoull(portmask, &end, 16);
280 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
281 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
283 set_fwd_ports_mask((uint64_t) pm);
288 parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
291 const char *p, *p0 = q_arg;
299 unsigned long int_fld[_NUM_FLD];
300 char *str_fld[_NUM_FLD];
304 /* reset from value set at definition */
305 is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0);
307 while ((p = strchr(p0,'(')) != NULL) {
309 if((p0 = strchr(p,')')) == NULL)
313 if(size >= sizeof(s))
316 snprintf(s, sizeof(s), "%.*s", size, p);
317 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
319 for (i = 0; i < _NUM_FLD; i++){
321 int_fld[i] = strtoul(str_fld[i], &end, 0);
322 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
325 /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */
326 if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
327 printf("Stats counter not in the correct range 0..%d\n",
328 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
333 if ((nb_tx_queue_stats_mappings >=
334 MAX_TX_QUEUE_STATS_MAPPINGS)) {
335 printf("exceeded max number of TX queue "
336 "statistics mappings: %hu\n",
337 nb_tx_queue_stats_mappings);
340 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id =
341 (uint8_t)int_fld[FLD_PORT];
342 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id =
343 (uint8_t)int_fld[FLD_QUEUE];
344 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id =
345 (uint8_t)int_fld[FLD_STATS_COUNTER];
346 ++nb_tx_queue_stats_mappings;
349 if ((nb_rx_queue_stats_mappings >=
350 MAX_RX_QUEUE_STATS_MAPPINGS)) {
351 printf("exceeded max number of RX queue "
352 "statistics mappings: %hu\n",
353 nb_rx_queue_stats_mappings);
356 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id =
357 (uint8_t)int_fld[FLD_PORT];
358 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id =
359 (uint8_t)int_fld[FLD_QUEUE];
360 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id =
361 (uint8_t)int_fld[FLD_STATS_COUNTER];
362 ++nb_rx_queue_stats_mappings;
366 /* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */
367 /* than to the default array (that was set at its definition) */
368 is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) :
369 (tx_queue_stats_mappings = tx_queue_stats_mappings_array);
374 print_invalid_socket_id_error(void)
378 printf("Invalid socket id, options are: ");
379 for (i = 0; i < num_sockets; i++) {
380 printf("%u%s", socket_ids[i],
381 (i == num_sockets - 1) ? "\n" : ",");
386 parse_portnuma_config(const char *q_arg)
389 const char *p, *p0 = q_arg;
391 uint8_t i, socket_id;
399 unsigned long int_fld[_NUM_FLD];
400 char *str_fld[_NUM_FLD];
402 /* reset from value set at definition */
403 while ((p = strchr(p0,'(')) != NULL) {
405 if((p0 = strchr(p,')')) == NULL)
409 if(size >= sizeof(s))
412 snprintf(s, sizeof(s), "%.*s", size, p);
413 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
415 for (i = 0; i < _NUM_FLD; i++) {
417 int_fld[i] = strtoul(str_fld[i], &end, 0);
418 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
421 port_id = (portid_t)int_fld[FLD_PORT];
422 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
423 port_id == (portid_t)RTE_PORT_ALL) {
427 socket_id = (uint8_t)int_fld[FLD_SOCKET];
428 if (new_socket_id(socket_id)) {
429 if (num_sockets >= RTE_MAX_NUMA_NODES) {
430 print_invalid_socket_id_error();
433 socket_ids[num_sockets++] = socket_id;
435 port_numa[port_id] = socket_id;
442 parse_ringnuma_config(const char *q_arg)
445 const char *p, *p0 = q_arg;
447 uint8_t i, ring_flag, socket_id;
456 unsigned long int_fld[_NUM_FLD];
457 char *str_fld[_NUM_FLD];
458 #define RX_RING_ONLY 0x1
459 #define TX_RING_ONLY 0x2
460 #define RXTX_RING 0x3
462 /* reset from value set at definition */
463 while ((p = strchr(p0,'(')) != NULL) {
465 if((p0 = strchr(p,')')) == NULL)
469 if(size >= sizeof(s))
472 snprintf(s, sizeof(s), "%.*s", size, p);
473 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
475 for (i = 0; i < _NUM_FLD; i++) {
477 int_fld[i] = strtoul(str_fld[i], &end, 0);
478 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
481 port_id = (portid_t)int_fld[FLD_PORT];
482 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
483 port_id == (portid_t)RTE_PORT_ALL) {
487 socket_id = (uint8_t)int_fld[FLD_SOCKET];
488 if (new_socket_id(socket_id)) {
489 if (num_sockets >= RTE_MAX_NUMA_NODES) {
490 print_invalid_socket_id_error();
493 socket_ids[num_sockets++] = socket_id;
495 ring_flag = (uint8_t)int_fld[FLD_FLAG];
496 if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {
497 printf("Invalid ring-flag=%d config for port =%d\n",
502 switch (ring_flag & RXTX_RING) {
504 rxring_numa[port_id] = socket_id;
507 txring_numa[port_id] = socket_id;
510 rxring_numa[port_id] = socket_id;
511 txring_numa[port_id] = socket_id;
514 printf("Invalid ring-flag=%d config for port=%d\n",
524 parse_event_printing_config(const char *optarg, int enable)
528 if (!strcmp(optarg, "unknown"))
529 mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN;
530 else if (!strcmp(optarg, "intr_lsc"))
531 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC;
532 else if (!strcmp(optarg, "queue_state"))
533 mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE;
534 else if (!strcmp(optarg, "intr_reset"))
535 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET;
536 else if (!strcmp(optarg, "vf_mbox"))
537 mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX;
538 else if (!strcmp(optarg, "ipsec"))
539 mask = UINT32_C(1) << RTE_ETH_EVENT_IPSEC;
540 else if (!strcmp(optarg, "macsec"))
541 mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
542 else if (!strcmp(optarg, "intr_rmv"))
543 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
544 else if (!strcmp(optarg, "dev_probed"))
545 mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
546 else if (!strcmp(optarg, "dev_released"))
547 mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
548 else if (!strcmp(optarg, "all"))
551 fprintf(stderr, "Invalid event: %s\n", optarg);
555 event_print_mask |= mask;
557 event_print_mask &= ~mask;
562 launch_args_parse(int argc, char** argv)
569 /* Default offloads for all ports. */
570 uint64_t rx_offloads = rx_mode.offloads;
571 uint64_t tx_offloads = tx_mode.offloads;
572 struct rte_eth_dev_info dev_info;
573 uint16_t rec_nb_pkts;
576 static struct option lgopts[] = {
578 #ifdef RTE_LIBRTE_CMDLINE
579 { "interactive", 0, 0, 0 },
580 { "cmdline-file", 1, 0, 0 },
581 { "auto-start", 0, 0, 0 },
582 { "eth-peers-configfile", 1, 0, 0 },
583 { "eth-peer", 1, 0, 0 },
585 { "tx-first", 0, 0, 0 },
586 { "stats-period", 1, 0, 0 },
587 { "ports", 1, 0, 0 },
588 { "nb-cores", 1, 0, 0 },
589 { "nb-ports", 1, 0, 0 },
590 { "coremask", 1, 0, 0 },
591 { "portmask", 1, 0, 0 },
592 { "portlist", 1, 0, 0 },
594 { "no-numa", 0, 0, 0 },
595 { "mp-anon", 0, 0, 0 },
596 { "port-numa-config", 1, 0, 0 },
597 { "ring-numa-config", 1, 0, 0 },
598 { "socket-num", 1, 0, 0 },
599 { "mbuf-size", 1, 0, 0 },
600 { "total-num-mbufs", 1, 0, 0 },
601 { "max-pkt-len", 1, 0, 0 },
602 { "max-lro-pkt-size", 1, 0, 0 },
603 { "pkt-filter-mode", 1, 0, 0 },
604 { "pkt-filter-report-hash", 1, 0, 0 },
605 { "pkt-filter-size", 1, 0, 0 },
606 { "pkt-filter-drop-queue", 1, 0, 0 },
607 #ifdef RTE_LIBRTE_LATENCY_STATS
608 { "latencystats", 1, 0, 0 },
610 #ifdef RTE_LIBRTE_BITRATE
611 { "bitrate-stats", 1, 0, 0 },
613 { "disable-crc-strip", 0, 0, 0 },
614 { "enable-lro", 0, 0, 0 },
615 { "enable-rx-cksum", 0, 0, 0 },
616 { "enable-rx-timestamp", 0, 0, 0 },
617 { "enable-scatter", 0, 0, 0 },
618 { "enable-hw-vlan", 0, 0, 0 },
619 { "enable-hw-vlan-filter", 0, 0, 0 },
620 { "enable-hw-vlan-strip", 0, 0, 0 },
621 { "enable-hw-vlan-extend", 0, 0, 0 },
622 { "enable-hw-qinq-strip", 0, 0, 0 },
623 { "enable-drop-en", 0, 0, 0 },
624 { "disable-rss", 0, 0, 0 },
625 { "port-topology", 1, 0, 0 },
626 { "forward-mode", 1, 0, 0 },
627 { "rss-ip", 0, 0, 0 },
628 { "rss-udp", 0, 0, 0 },
633 { "hairpinq", 1, 0, 0 },
634 { "burst", 1, 0, 0 },
635 { "mbcache", 1, 0, 0 },
639 { "txfreet", 1, 0, 0 },
640 { "txrst", 1, 0, 0 },
644 { "rxfreet", 1, 0, 0 },
645 { "tx-queue-stats-mapping", 1, 0, 0 },
646 { "rx-queue-stats-mapping", 1, 0, 0 },
647 { "no-flush-rx", 0, 0, 0 },
648 { "flow-isolate-all", 0, 0, 0 },
649 { "txpkts", 1, 0, 0 },
650 { "txonly-multi-flow", 0, 0, 0 },
651 { "disable-link-check", 0, 0, 0 },
652 { "disable-device-start", 0, 0, 0 },
653 { "no-lsc-interrupt", 0, 0, 0 },
654 { "no-rmv-interrupt", 0, 0, 0 },
655 { "print-event", 1, 0, 0 },
656 { "mask-event", 1, 0, 0 },
657 { "tx-offloads", 1, 0, 0 },
658 { "rx-offloads", 1, 0, 0 },
659 { "hot-plug", 0, 0, 0 },
660 { "vxlan-gpe-port", 1, 0, 0 },
661 { "mlockall", 0, 0, 0 },
662 { "no-mlockall", 0, 0, 0 },
663 { "mp-alloc", 1, 0, 0 },
664 { "tx-ip", 1, 0, 0 },
665 { "tx-udp", 1, 0, 0 },
666 { "noisy-tx-sw-buffer-size", 1, 0, 0 },
667 { "noisy-tx-sw-buffer-flushtime", 1, 0, 0 },
668 { "noisy-lkup-memory", 1, 0, 0 },
669 { "noisy-lkup-num-writes", 1, 0, 0 },
670 { "noisy-lkup-num-reads", 1, 0, 0 },
671 { "noisy-lkup-num-reads-writes", 1, 0, 0 },
672 { "no-iova-contig", 0, 0, 0 },
678 #ifdef RTE_LIBRTE_CMDLINE
679 #define SHORTOPTS "i"
683 while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
684 lgopts, &opt_idx)) != EOF) {
686 #ifdef RTE_LIBRTE_CMDLINE
688 printf("Interactive-mode selected\n");
693 printf("Auto-start selected\n");
697 case 0: /*long options */
698 if (!strcmp(lgopts[opt_idx].name, "help")) {
700 rte_exit(EXIT_SUCCESS, "Displayed help\n");
702 #ifdef RTE_LIBRTE_CMDLINE
703 if (!strcmp(lgopts[opt_idx].name, "interactive")) {
704 printf("Interactive-mode selected\n");
707 if (!strcmp(lgopts[opt_idx].name, "cmdline-file")) {
708 printf("CLI commands to be read from %s\n",
710 strlcpy(cmdline_filename, optarg,
711 sizeof(cmdline_filename));
713 if (!strcmp(lgopts[opt_idx].name, "auto-start")) {
714 printf("Auto-start selected\n");
717 if (!strcmp(lgopts[opt_idx].name, "tx-first")) {
718 printf("Ports to start sending a burst of "
722 if (!strcmp(lgopts[opt_idx].name, "stats-period")) {
726 n = strtoul(optarg, &end, 10);
727 if ((optarg[0] == '\0') || (end == NULL) ||
734 if (!strcmp(lgopts[opt_idx].name,
735 "eth-peers-configfile")) {
736 if (init_peer_eth_addrs(optarg) != 0)
737 rte_exit(EXIT_FAILURE,
738 "Cannot open logfile\n");
740 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
744 n = strtoul(optarg, &port_end, 10);
745 if (errno != 0 || port_end == optarg || *port_end++ != ',')
746 rte_exit(EXIT_FAILURE,
747 "Invalid eth-peer: %s", optarg);
748 if (n >= RTE_MAX_ETHPORTS)
749 rte_exit(EXIT_FAILURE,
750 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
751 n, RTE_MAX_ETHPORTS);
753 if (rte_ether_unformat_addr(port_end,
754 &peer_eth_addrs[n]) < 0)
755 rte_exit(EXIT_FAILURE,
756 "Invalid ethernet address: %s\n",
761 if (!strcmp(lgopts[opt_idx].name, "tx-ip")) {
765 end = strchr(optarg, ',');
766 if (end == optarg || !end)
767 rte_exit(EXIT_FAILURE,
768 "Invalid tx-ip: %s", optarg);
771 if (inet_aton(optarg, &in) == 0)
772 rte_exit(EXIT_FAILURE,
773 "Invalid source IP address: %s\n",
775 tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
777 if (inet_aton(end, &in) == 0)
778 rte_exit(EXIT_FAILURE,
779 "Invalid destination IP address: %s\n",
781 tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr);
783 if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
787 n = strtoul(optarg, &end, 10);
788 if (errno != 0 || end == optarg ||
790 !(*end == '\0' || *end == ','))
791 rte_exit(EXIT_FAILURE,
792 "Invalid UDP port: %s\n",
798 n = strtoul(dst, &end, 10);
799 if (errno != 0 || end == dst ||
800 n > UINT16_MAX || *end)
801 rte_exit(EXIT_FAILURE,
802 "Invalid destination UDP port: %s\n",
810 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
812 if (n > 0 && n <= nb_ports)
815 rte_exit(EXIT_FAILURE,
816 "Invalid port %d\n", n);
818 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) {
820 if (n > 0 && n <= nb_lcores)
821 nb_fwd_lcores = (uint8_t) n;
823 rte_exit(EXIT_FAILURE,
824 "nb-cores should be > 0 and <= %d\n",
827 if (!strcmp(lgopts[opt_idx].name, "coremask"))
828 parse_fwd_coremask(optarg);
829 if (!strcmp(lgopts[opt_idx].name, "portmask"))
830 parse_fwd_portmask(optarg);
831 if (!strcmp(lgopts[opt_idx].name, "portlist"))
832 parse_fwd_portlist(optarg);
833 if (!strcmp(lgopts[opt_idx].name, "no-numa"))
835 if (!strcmp(lgopts[opt_idx].name, "numa"))
837 if (!strcmp(lgopts[opt_idx].name, "mp-anon")) {
838 mp_alloc_type = MP_ALLOC_ANON;
840 if (!strcmp(lgopts[opt_idx].name, "mp-alloc")) {
841 if (!strcmp(optarg, "native"))
842 mp_alloc_type = MP_ALLOC_NATIVE;
843 else if (!strcmp(optarg, "anon"))
844 mp_alloc_type = MP_ALLOC_ANON;
845 else if (!strcmp(optarg, "xmem"))
846 mp_alloc_type = MP_ALLOC_XMEM;
847 else if (!strcmp(optarg, "xmemhuge"))
848 mp_alloc_type = MP_ALLOC_XMEM_HUGE;
849 else if (!strcmp(optarg, "xbuf"))
850 mp_alloc_type = MP_ALLOC_XBUF;
852 rte_exit(EXIT_FAILURE,
853 "mp-alloc %s invalid - must be: "
854 "native, anon, xmem or xmemhuge\n",
857 if (!strcmp(lgopts[opt_idx].name, "port-numa-config")) {
858 if (parse_portnuma_config(optarg))
859 rte_exit(EXIT_FAILURE,
860 "invalid port-numa configuration\n");
862 if (!strcmp(lgopts[opt_idx].name, "ring-numa-config"))
863 if (parse_ringnuma_config(optarg))
864 rte_exit(EXIT_FAILURE,
865 "invalid ring-numa configuration\n");
866 if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
868 if (!new_socket_id((uint8_t)n)) {
869 socket_num = (uint8_t)n;
871 print_invalid_socket_id_error();
872 rte_exit(EXIT_FAILURE,
873 "Invalid socket id");
876 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
878 if (n > 0 && n <= 0xFFFF)
879 mbuf_data_size = (uint16_t) n;
881 rte_exit(EXIT_FAILURE,
882 "mbuf-size should be > 0 and < 65536\n");
884 if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
887 param_total_num_mbufs = (unsigned)n;
889 rte_exit(EXIT_FAILURE,
890 "total-num-mbufs should be > 1024\n");
892 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
894 if (n >= RTE_ETHER_MIN_LEN) {
895 rx_mode.max_rx_pkt_len = (uint32_t) n;
896 if (n > RTE_ETHER_MAX_LEN)
898 DEV_RX_OFFLOAD_JUMBO_FRAME;
900 rte_exit(EXIT_FAILURE,
901 "Invalid max-pkt-len=%d - should be > %d\n",
902 n, RTE_ETHER_MIN_LEN);
904 if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-size")) {
906 rx_mode.max_lro_pkt_size = (uint32_t) n;
908 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
909 if (!strcmp(optarg, "signature"))
911 RTE_FDIR_MODE_SIGNATURE;
912 else if (!strcmp(optarg, "perfect"))
913 fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
914 else if (!strcmp(optarg, "perfect-mac-vlan"))
915 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
916 else if (!strcmp(optarg, "perfect-tunnel"))
917 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
918 else if (!strcmp(optarg, "none"))
919 fdir_conf.mode = RTE_FDIR_MODE_NONE;
921 rte_exit(EXIT_FAILURE,
922 "pkt-mode-invalid %s invalid - must be: "
923 "none, signature, perfect, perfect-mac-vlan"
924 " or perfect-tunnel\n",
927 if (!strcmp(lgopts[opt_idx].name,
928 "pkt-filter-report-hash")) {
929 if (!strcmp(optarg, "none"))
931 RTE_FDIR_NO_REPORT_STATUS;
932 else if (!strcmp(optarg, "match"))
934 RTE_FDIR_REPORT_STATUS;
935 else if (!strcmp(optarg, "always"))
937 RTE_FDIR_REPORT_STATUS_ALWAYS;
939 rte_exit(EXIT_FAILURE,
940 "pkt-filter-report-hash %s invalid "
941 "- must be: none or match or always\n",
944 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
945 if (!strcmp(optarg, "64K"))
947 RTE_FDIR_PBALLOC_64K;
948 else if (!strcmp(optarg, "128K"))
950 RTE_FDIR_PBALLOC_128K;
951 else if (!strcmp(optarg, "256K"))
953 RTE_FDIR_PBALLOC_256K;
955 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
956 " must be: 64K or 128K or 256K\n",
959 if (!strcmp(lgopts[opt_idx].name,
960 "pkt-filter-drop-queue")) {
963 fdir_conf.drop_queue = (uint8_t) n;
965 rte_exit(EXIT_FAILURE,
966 "drop queue %d invalid - must"
969 #ifdef RTE_LIBRTE_LATENCY_STATS
970 if (!strcmp(lgopts[opt_idx].name,
974 latencystats_lcore_id = (lcoreid_t) n;
975 latencystats_enabled = 1;
977 rte_exit(EXIT_FAILURE,
978 "invalid lcore id %d for latencystats"
979 " must be >= 0\n", n);
982 #ifdef RTE_LIBRTE_BITRATE
983 if (!strcmp(lgopts[opt_idx].name, "bitrate-stats")) {
986 bitrate_lcore_id = (lcoreid_t) n;
989 rte_exit(EXIT_FAILURE,
990 "invalid lcore id %d for bitrate stats"
991 " must be >= 0\n", n);
994 if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
995 rx_offloads |= DEV_RX_OFFLOAD_KEEP_CRC;
996 if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
997 rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO;
998 if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
999 rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
1000 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
1001 rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
1002 if (!strcmp(lgopts[opt_idx].name,
1003 "enable-rx-timestamp"))
1004 rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
1005 if (!strcmp(lgopts[opt_idx].name, "enable-hw-vlan"))
1006 rx_offloads |= DEV_RX_OFFLOAD_VLAN;
1008 if (!strcmp(lgopts[opt_idx].name,
1009 "enable-hw-vlan-filter"))
1010 rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
1012 if (!strcmp(lgopts[opt_idx].name,
1013 "enable-hw-vlan-strip"))
1014 rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
1016 if (!strcmp(lgopts[opt_idx].name,
1017 "enable-hw-vlan-extend"))
1018 rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
1020 if (!strcmp(lgopts[opt_idx].name,
1021 "enable-hw-qinq-strip"))
1022 rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
1024 if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
1027 if (!strcmp(lgopts[opt_idx].name, "disable-rss"))
1029 if (!strcmp(lgopts[opt_idx].name, "port-topology")) {
1030 if (!strcmp(optarg, "paired"))
1031 port_topology = PORT_TOPOLOGY_PAIRED;
1032 else if (!strcmp(optarg, "chained"))
1033 port_topology = PORT_TOPOLOGY_CHAINED;
1034 else if (!strcmp(optarg, "loop"))
1035 port_topology = PORT_TOPOLOGY_LOOP;
1037 rte_exit(EXIT_FAILURE, "port-topology %s invalid -"
1038 " must be: paired, chained or loop\n",
1041 if (!strcmp(lgopts[opt_idx].name, "forward-mode"))
1042 set_pkt_forwarding_mode(optarg);
1043 if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
1044 rss_hf = ETH_RSS_IP;
1045 if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
1046 rss_hf = ETH_RSS_UDP;
1047 if (!strcmp(lgopts[opt_idx].name, "rxq")) {
1049 if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
1050 nb_rxq = (queueid_t) n;
1052 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
1053 " >= 0 && <= %u\n", n,
1054 get_allowed_max_nb_rxq(&pid));
1056 if (!strcmp(lgopts[opt_idx].name, "txq")) {
1058 if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
1059 nb_txq = (queueid_t) n;
1061 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1062 " >= 0 && <= %u\n", n,
1063 get_allowed_max_nb_txq(&pid));
1065 if (!strcmp(lgopts[opt_idx].name, "hairpinq")) {
1068 check_nb_hairpinq((queueid_t)n) == 0)
1069 nb_hairpinq = (queueid_t) n;
1071 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1072 " >= 0 && <= %u\n", n,
1073 get_allowed_max_nb_hairpinq
1075 if ((n + nb_txq) < 0 ||
1076 check_nb_txq((queueid_t)(n + nb_txq)) != 0)
1077 rte_exit(EXIT_FAILURE, "txq + hairpinq "
1078 "%d invalid - must be"
1081 get_allowed_max_nb_txq(&pid));
1082 if ((n + nb_rxq) < 0 ||
1083 check_nb_rxq((queueid_t)(n + nb_rxq)) != 0)
1084 rte_exit(EXIT_FAILURE, "rxq + hairpinq "
1085 "%d invalid - must be"
1088 get_allowed_max_nb_rxq(&pid));
1090 if (!nb_rxq && !nb_txq) {
1091 rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
1094 if (!strcmp(lgopts[opt_idx].name, "burst")) {
1097 /* A burst size of zero means that the
1098 * PMD should be queried for
1099 * recommended Rx burst size. Since
1100 * testpmd uses a single size for all
1101 * ports, port 0 is queried for the
1102 * value, on the assumption that all
1103 * ports are of the same NIC model.
1105 ret = eth_dev_info_get_print_err(
1111 rec_nb_pkts = dev_info
1112 .default_rxportconf.burst_size;
1114 if (rec_nb_pkts == 0)
1115 rte_exit(EXIT_FAILURE,
1116 "PMD does not recommend a burst size. "
1117 "Provided value must be between "
1118 "1 and %d\n", MAX_PKT_BURST);
1119 else if (rec_nb_pkts > MAX_PKT_BURST)
1120 rte_exit(EXIT_FAILURE,
1121 "PMD recommended burst size of %d"
1122 " exceeds maximum value of %d\n",
1123 rec_nb_pkts, MAX_PKT_BURST);
1124 printf("Using PMD-provided burst value of %d\n",
1126 nb_pkt_per_burst = rec_nb_pkts;
1127 } else if (n > MAX_PKT_BURST)
1128 rte_exit(EXIT_FAILURE,
1129 "burst must be between1 and %d\n",
1132 nb_pkt_per_burst = (uint16_t) n;
1134 if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
1137 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
1138 mb_mempool_cache = (uint16_t) n;
1140 rte_exit(EXIT_FAILURE,
1141 "mbcache must be >= 0 and <= %d\n",
1142 RTE_MEMPOOL_CACHE_MAX_SIZE);
1144 if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
1147 tx_free_thresh = (int16_t)n;
1149 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n");
1151 if (!strcmp(lgopts[opt_idx].name, "txrst")) {
1154 tx_rs_thresh = (int16_t)n;
1156 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
1158 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
1161 if (rx_free_thresh >= n)
1162 rte_exit(EXIT_FAILURE,
1164 "rx_free_thresh(%d)\n",
1165 (int)rx_free_thresh);
1167 nb_rxd = (uint16_t) n;
1169 rte_exit(EXIT_FAILURE,
1170 "rxd(%d) invalid - must be > 0\n",
1173 if (!strcmp(lgopts[opt_idx].name, "txd")) {
1176 nb_txd = (uint16_t) n;
1178 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
1180 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
1183 tx_pthresh = (int8_t)n;
1185 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
1187 if (!strcmp(lgopts[opt_idx].name, "txht")) {
1190 tx_hthresh = (int8_t)n;
1192 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
1194 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
1197 tx_wthresh = (int8_t)n;
1199 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
1201 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
1204 rx_pthresh = (int8_t)n;
1206 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
1208 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
1211 rx_hthresh = (int8_t)n;
1213 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
1215 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
1218 rx_wthresh = (int8_t)n;
1220 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
1222 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) {
1225 rx_free_thresh = (int16_t)n;
1227 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n");
1229 if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) {
1230 if (parse_queue_stats_mapping_config(optarg, TX)) {
1231 rte_exit(EXIT_FAILURE,
1232 "invalid TX queue statistics mapping config entered\n");
1235 if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) {
1236 if (parse_queue_stats_mapping_config(optarg, RX)) {
1237 rte_exit(EXIT_FAILURE,
1238 "invalid RX queue statistics mapping config entered\n");
1241 if (!strcmp(lgopts[opt_idx].name, "txpkts")) {
1242 unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
1243 unsigned int nb_segs;
1245 nb_segs = parse_item_list(optarg, "txpkt segments",
1246 RTE_MAX_SEGS_PER_PKT, seg_lengths, 0);
1248 set_tx_pkt_segments(seg_lengths, nb_segs);
1250 rte_exit(EXIT_FAILURE, "bad txpkts\n");
1252 if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
1253 txonly_multi_flow = 1;
1254 if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
1256 if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
1258 if (!strcmp(lgopts[opt_idx].name, "disable-device-start"))
1259 no_device_start = 1;
1260 if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt"))
1262 if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
1264 if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
1265 flow_isolate_all = 1;
1266 if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
1268 n = strtoull(optarg, &end, 16);
1270 tx_offloads = (uint64_t)n;
1272 rte_exit(EXIT_FAILURE,
1273 "tx-offloads must be >= 0\n");
1276 if (!strcmp(lgopts[opt_idx].name, "rx-offloads")) {
1278 n = strtoull(optarg, &end, 16);
1280 rx_offloads = (uint64_t)n;
1282 rte_exit(EXIT_FAILURE,
1283 "rx-offloads must be >= 0\n");
1286 if (!strcmp(lgopts[opt_idx].name, "vxlan-gpe-port")) {
1289 vxlan_gpe_udp_port = (uint16_t)n;
1291 rte_exit(EXIT_FAILURE,
1292 "vxlan-gpe-port must be >= 0\n");
1294 if (!strcmp(lgopts[opt_idx].name, "print-event"))
1295 if (parse_event_printing_config(optarg, 1)) {
1296 rte_exit(EXIT_FAILURE,
1297 "invalid print-event argument\n");
1299 if (!strcmp(lgopts[opt_idx].name, "mask-event"))
1300 if (parse_event_printing_config(optarg, 0)) {
1301 rte_exit(EXIT_FAILURE,
1302 "invalid mask-event argument\n");
1304 if (!strcmp(lgopts[opt_idx].name, "hot-plug"))
1306 if (!strcmp(lgopts[opt_idx].name, "mlockall"))
1308 if (!strcmp(lgopts[opt_idx].name, "no-mlockall"))
1310 if (!strcmp(lgopts[opt_idx].name,
1311 "noisy-tx-sw-buffer-size")) {
1314 noisy_tx_sw_bufsz = n;
1316 rte_exit(EXIT_FAILURE,
1317 "noisy-tx-sw-buffer-size must be >= 0\n");
1319 if (!strcmp(lgopts[opt_idx].name,
1320 "noisy-tx-sw-buffer-flushtime")) {
1323 noisy_tx_sw_buf_flush_time = n;
1325 rte_exit(EXIT_FAILURE,
1326 "noisy-tx-sw-buffer-flushtime must be >= 0\n");
1328 if (!strcmp(lgopts[opt_idx].name,
1329 "noisy-lkup-memory")) {
1332 noisy_lkup_mem_sz = n;
1334 rte_exit(EXIT_FAILURE,
1335 "noisy-lkup-memory must be >= 0\n");
1337 if (!strcmp(lgopts[opt_idx].name,
1338 "noisy-lkup-num-writes")) {
1341 noisy_lkup_num_writes = n;
1343 rte_exit(EXIT_FAILURE,
1344 "noisy-lkup-num-writes must be >= 0\n");
1346 if (!strcmp(lgopts[opt_idx].name,
1347 "noisy-lkup-num-reads")) {
1350 noisy_lkup_num_reads = n;
1352 rte_exit(EXIT_FAILURE,
1353 "noisy-lkup-num-reads must be >= 0\n");
1355 if (!strcmp(lgopts[opt_idx].name,
1356 "noisy-lkup-num-reads-writes")) {
1359 noisy_lkup_num_reads_writes = n;
1361 rte_exit(EXIT_FAILURE,
1362 "noisy-lkup-num-reads-writes must be >= 0\n");
1364 if (!strcmp(lgopts[opt_idx].name, "no-iova-contig"))
1365 mempool_flags = MEMPOOL_F_NO_IOVA_CONTIG;
1369 rte_exit(EXIT_SUCCESS, "Displayed help\n");
1373 printf("Invalid option: %s\n", argv[optind]);
1374 rte_exit(EXIT_FAILURE,
1375 "Command line is incomplete or incorrect\n");
1380 if (optind != argc) {
1382 printf("Invalid parameter: %s\n", argv[optind]);
1383 rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
1386 /* Set offload configuration from command line parameters. */
1387 rx_mode.offloads = rx_offloads;
1388 tx_mode.offloads = tx_offloads;
1390 if (mempool_flags & MEMPOOL_F_NO_IOVA_CONTIG &&
1391 mp_alloc_type != MP_ALLOC_ANON) {
1392 TESTPMD_LOG(WARNING, "cannot use no-iova-contig without "
1393 "mp-alloc=anon. mempool no-iova-contig is "