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>
43 #include <rte_eth_bond.h>
52 printf("usage: %s [EAL options] -- "
53 #ifdef RTE_LIB_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_LIB_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 | --rss-level-inner | --rss-level-outer |"
70 "--rxpt= | --rxht= | --rxwt= |"
71 " --rxfreet= | --txpt= | --txht= | --txwt= | --txfreet= | "
72 "--txrst= | --tx-offloads= | | --rx-offloads= | "
73 "--vxlan-gpe-port= | --geneve-parsed-port= | "
74 "--record-core-cycles | --record-burst-stats]\n",
76 #ifdef RTE_LIB_CMDLINE
77 printf(" --interactive: run in interactive mode.\n");
78 printf(" --cmdline-file: execute cli commands before startup.\n");
80 printf(" --auto-start: start forwarding on init "
81 "[always when non-interactive].\n");
82 printf(" --help: display this message and quit.\n");
83 printf(" --tx-first: start forwarding sending a burst first "
84 "(only if interactive is disabled).\n");
85 printf(" --stats-period=PERIOD: statistics will be shown "
86 "every PERIOD seconds (only if interactive is disabled).\n");
87 printf(" --nb-cores=N: set the number of forwarding cores "
88 "(1 <= N <= %d).\n", nb_lcores);
89 printf(" --nb-ports=N: set the number of forwarding ports "
90 "(1 <= N <= %d).\n", nb_ports);
91 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running "
92 "the packet forwarding test. The main lcore is reserved for "
93 "command line parsing only, and cannot be masked on for "
94 "packet forwarding.\n");
95 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used "
96 "by the packet forwarding test.\n");
97 printf(" --portlist=PORTLIST: list of forwarding ports\n");
98 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
99 "RX memory buffers (mbufs).\n");
100 printf(" --port-numa-config=(port,socket)[,(port,socket)]: "
101 "specify the socket on which the memory pool "
102 "used by the port will be allocated.\n");
103 printf(" --ring-numa-config=(port,flag,socket)[,(port,flag,socket)]: "
104 "specify the socket on which the TX/RX rings for "
105 "the port will be allocated "
106 "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
107 printf(" --socket-num=N: set socket from which all memory is allocated "
109 printf(" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to "
110 "N bytes. If multiple numbers are specified the extra pools "
111 "will be created to receive with packet split features\n");
112 printf(" --total-num-mbufs=N: set the number of mbufs to be allocated "
114 printf(" --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
115 printf(" --max-lro-pkt-size=N: set the maximum LRO aggregated packet "
116 "size to N bytes.\n");
117 #ifdef RTE_LIB_CMDLINE
118 printf(" --eth-peers-configfile=name: config file with ethernet addresses "
120 printf(" --eth-peer=X,M:M:M:M:M:M: set the MAC address of the X peer "
121 "port (0 <= X < %d).\n", RTE_MAX_ETHPORTS);
123 printf(" --pkt-filter-mode=N: set Flow Director mode "
124 "(N: none (default mode) or signature or perfect).\n");
125 printf(" --pkt-filter-report-hash=N: set Flow Director report mode "
126 "(N: none or match (default) or always).\n");
127 printf(" --pkt-filter-size=N: set Flow Director mode "
128 "(N: 64K (default mode) or 128K or 256K).\n");
129 printf(" --pkt-filter-drop-queue=N: set drop-queue. "
130 "In perfect mode, when you add a rule with queue = -1 "
131 "the packet will be enqueued into the rx drop-queue. "
132 "If the drop-queue doesn't exist, the packet is dropped. "
133 "By default drop-queue=127.\n");
134 #ifdef RTE_LIB_LATENCYSTATS
135 printf(" --latencystats=N: enable latency and jitter statistcs "
136 "monitoring on forwarding lcore id N.\n");
138 printf(" --disable-crc-strip: disable CRC stripping by hardware.\n");
139 printf(" --enable-lro: enable large receive offload.\n");
140 printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n");
141 printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
142 printf(" --enable-hw-vlan: enable hardware vlan.\n");
143 printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n");
144 printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n");
145 printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n");
146 printf(" --enable-hw-qinq-strip: enable hardware qinq strip.\n");
147 printf(" --enable-drop-en: enable per queue packet drop.\n");
148 printf(" --disable-rss: disable rss.\n");
149 printf(" --port-topology=<paired|chained|loop>: set port topology (paired "
151 printf(" --forward-mode=N: set forwarding mode (N: %s).\n",
152 list_pkt_forwarding_modes());
153 printf(" --forward-mode=5tswap: set forwarding mode to "
154 "swap L2,L3,L4 for MAC, IPv4/IPv6 and TCP/UDP only.\n");
155 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n");
156 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n");
157 printf(" --rss-level-inner: set RSS hash level to innermost\n");
158 printf(" --rss-level-outer: set RSS hash level to outermost\n");
159 printf(" --rxq=N: set the number of RX queues per port to N.\n");
160 printf(" --rxd=N: set the number of descriptors in RX rings to N.\n");
161 printf(" --txq=N: set the number of TX queues per port to N.\n");
162 printf(" --txd=N: set the number of descriptors in TX rings to N.\n");
163 printf(" --hairpinq=N: set the number of hairpin queues per port to "
165 printf(" --burst=N: set the number of packets per burst to N.\n");
166 printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n");
167 printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n");
168 printf(" --rxht=N: set the host threshold register of RX rings to N.\n");
169 printf(" --rxfreet=N: set the free threshold of RX descriptors to N "
170 "(0 <= N < value of rxd).\n");
171 printf(" --rxwt=N: set the write-back threshold register of RX rings to N.\n");
172 printf(" --txpt=N: set the prefetch threshold register of TX rings to N.\n");
173 printf(" --txht=N: set the nhost threshold register of TX rings to N.\n");
174 printf(" --txwt=N: set the write-back threshold register of TX rings to N.\n");
175 printf(" --txfreet=N: set the transmit free threshold of TX rings to N "
176 "(0 <= N <= value of txd).\n");
177 printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N "
178 "(0 <= N <= value of txd).\n");
179 printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: "
180 "tx queues statistics counters mapping "
181 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
182 printf(" --rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: "
183 "rx queues statistics counters mapping "
184 "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
185 printf(" --no-flush-rx: Don't flush RX streams before forwarding."
186 " Used mainly with PCAP drivers.\n");
187 printf(" --rxoffs=X[,Y]*: set RX segment offsets for split.\n");
188 printf(" --rxpkts=X[,Y]*: set RX segment sizes to split.\n");
189 printf(" --txpkts=X[,Y]*: set TX segment sizes"
190 " or total packet length.\n");
191 printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n");
192 printf(" --disable-link-check: disable check on link status when "
193 "starting/stopping ports.\n");
194 printf(" --disable-device-start: do not automatically start port\n");
195 printf(" --no-lsc-interrupt: disable link status change interrupt.\n");
196 printf(" --no-rmv-interrupt: disable device removal interrupt.\n");
197 printf(" --bitrate-stats=N: set the logical core N to perform "
198 "bit-rate calculation.\n");
199 printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|all>: "
200 "enable print of designated event or all of them.\n");
201 printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|all>: "
202 "disable print of designated event or all of them.\n");
203 printf(" --flow-isolate-all: "
204 "requests flow API isolated mode on all ports at initialization time.\n");
205 printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
206 printf(" --rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads\n");
207 printf(" --hot-plug: enable hot plug for device.\n");
208 printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n");
209 printf(" --geneve-parsed-port=N: UPD port to parse GENEVE tunnel protocol\n");
210 printf(" --mlockall: lock all memory\n");
211 printf(" --no-mlockall: do not lock all memory\n");
212 printf(" --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\n"
213 " native: use regular DPDK memory to create and populate mempool\n"
214 " anon: use regular DPDK memory to create and anonymous memory to populate mempool\n"
215 " xmem: use anonymous memory to create and populate mempool\n"
216 " xmemhuge: use anonymous hugepage memory to create and populate mempool\n");
217 printf(" --noisy-tx-sw-buffer-size=N: size of FIFO buffer\n");
218 printf(" --noisy-tx-sw-buffer-flushtime=N: flush FIFO after N ms\n");
219 printf(" --noisy-lkup-memory=N: allocate N MB of VNF memory\n");
220 printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n");
221 printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n");
222 printf(" --noisy-lkup-num-writes=N: do N random reads and writes per packet\n");
223 printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. "
224 "valid only with --mp-alloc=anon\n");
225 printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
227 printf(" --record-core-cycles: enable measurement of CPU cycles.\n");
228 printf(" --record-burst-stats: enable display of RX and TX bursts.\n");
229 printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n "
230 " 0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
231 " 0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
234 #ifdef RTE_LIB_CMDLINE
236 init_peer_eth_addrs(char *config_filename)
242 config_file = fopen(config_filename, "r");
243 if (config_file == NULL) {
244 perror("Failed to open eth config file\n");
248 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
250 if (fgets(buf, sizeof(buf), config_file) == NULL)
253 if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
254 printf("Bad MAC address format on line %d\n", i+1);
260 nb_peer_eth_addrs = (portid_t) i;
266 * Parse the coremask given as argument (hexadecimal string) and set
267 * the global configuration of forwarding cores.
270 parse_fwd_coremask(const char *coremask)
273 unsigned long long int cm;
275 /* parse hexadecimal string */
277 cm = strtoull(coremask, &end, 16);
278 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0'))
279 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n");
280 else if (set_fwd_lcores_mask((uint64_t) cm) < 0)
281 rte_exit(EXIT_FAILURE, "coremask is not valid\n");
285 * Parse the coremask given as argument (hexadecimal string) and set
286 * the global configuration of forwarding cores.
289 parse_fwd_portmask(const char *portmask)
292 unsigned long long int pm;
294 /* parse hexadecimal string */
296 pm = strtoull(portmask, &end, 16);
297 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
298 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
300 set_fwd_ports_mask((uint64_t) pm);
305 parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
308 const char *p, *p0 = q_arg;
316 unsigned long int_fld[_NUM_FLD];
317 char *str_fld[_NUM_FLD];
321 /* reset from value set at definition */
322 is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0);
324 while ((p = strchr(p0,'(')) != NULL) {
326 if((p0 = strchr(p,')')) == NULL)
330 if(size >= sizeof(s))
333 snprintf(s, sizeof(s), "%.*s", size, p);
334 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
336 for (i = 0; i < _NUM_FLD; i++){
338 int_fld[i] = strtoul(str_fld[i], &end, 0);
339 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
342 /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */
343 if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
344 printf("Stats counter not in the correct range 0..%d\n",
345 RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
350 if ((nb_tx_queue_stats_mappings >=
351 MAX_TX_QUEUE_STATS_MAPPINGS)) {
352 printf("exceeded max number of TX queue "
353 "statistics mappings: %hu\n",
354 nb_tx_queue_stats_mappings);
357 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id =
358 (uint8_t)int_fld[FLD_PORT];
359 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id =
360 (uint8_t)int_fld[FLD_QUEUE];
361 tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id =
362 (uint8_t)int_fld[FLD_STATS_COUNTER];
363 ++nb_tx_queue_stats_mappings;
366 if ((nb_rx_queue_stats_mappings >=
367 MAX_RX_QUEUE_STATS_MAPPINGS)) {
368 printf("exceeded max number of RX queue "
369 "statistics mappings: %hu\n",
370 nb_rx_queue_stats_mappings);
373 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id =
374 (uint8_t)int_fld[FLD_PORT];
375 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id =
376 (uint8_t)int_fld[FLD_QUEUE];
377 rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id =
378 (uint8_t)int_fld[FLD_STATS_COUNTER];
379 ++nb_rx_queue_stats_mappings;
383 /* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */
384 /* than to the default array (that was set at its definition) */
385 is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) :
386 (tx_queue_stats_mappings = tx_queue_stats_mappings_array);
391 print_invalid_socket_id_error(void)
395 printf("Invalid socket id, options are: ");
396 for (i = 0; i < num_sockets; i++) {
397 printf("%u%s", socket_ids[i],
398 (i == num_sockets - 1) ? "\n" : ",");
403 parse_portnuma_config(const char *q_arg)
406 const char *p, *p0 = q_arg;
408 uint8_t i, socket_id;
416 unsigned long int_fld[_NUM_FLD];
417 char *str_fld[_NUM_FLD];
419 /* reset from value set at definition */
420 while ((p = strchr(p0,'(')) != NULL) {
422 if((p0 = strchr(p,')')) == NULL)
426 if(size >= sizeof(s))
429 snprintf(s, sizeof(s), "%.*s", size, p);
430 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
432 for (i = 0; i < _NUM_FLD; i++) {
434 int_fld[i] = strtoul(str_fld[i], &end, 0);
435 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
438 port_id = (portid_t)int_fld[FLD_PORT];
439 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
440 port_id == (portid_t)RTE_PORT_ALL) {
444 socket_id = (uint8_t)int_fld[FLD_SOCKET];
445 if (new_socket_id(socket_id)) {
446 if (num_sockets >= RTE_MAX_NUMA_NODES) {
447 print_invalid_socket_id_error();
450 socket_ids[num_sockets++] = socket_id;
452 port_numa[port_id] = socket_id;
459 parse_ringnuma_config(const char *q_arg)
462 const char *p, *p0 = q_arg;
464 uint8_t i, ring_flag, socket_id;
473 unsigned long int_fld[_NUM_FLD];
474 char *str_fld[_NUM_FLD];
475 #define RX_RING_ONLY 0x1
476 #define TX_RING_ONLY 0x2
477 #define RXTX_RING 0x3
479 /* reset from value set at definition */
480 while ((p = strchr(p0,'(')) != NULL) {
482 if((p0 = strchr(p,')')) == NULL)
486 if(size >= sizeof(s))
489 snprintf(s, sizeof(s), "%.*s", size, p);
490 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
492 for (i = 0; i < _NUM_FLD; i++) {
494 int_fld[i] = strtoul(str_fld[i], &end, 0);
495 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
498 port_id = (portid_t)int_fld[FLD_PORT];
499 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
500 port_id == (portid_t)RTE_PORT_ALL) {
504 socket_id = (uint8_t)int_fld[FLD_SOCKET];
505 if (new_socket_id(socket_id)) {
506 if (num_sockets >= RTE_MAX_NUMA_NODES) {
507 print_invalid_socket_id_error();
510 socket_ids[num_sockets++] = socket_id;
512 ring_flag = (uint8_t)int_fld[FLD_FLAG];
513 if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {
514 printf("Invalid ring-flag=%d config for port =%d\n",
519 switch (ring_flag & RXTX_RING) {
521 rxring_numa[port_id] = socket_id;
524 txring_numa[port_id] = socket_id;
527 rxring_numa[port_id] = socket_id;
528 txring_numa[port_id] = socket_id;
531 printf("Invalid ring-flag=%d config for port=%d\n",
541 parse_event_printing_config(const char *optarg, int enable)
545 if (!strcmp(optarg, "unknown"))
546 mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN;
547 else if (!strcmp(optarg, "intr_lsc"))
548 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC;
549 else if (!strcmp(optarg, "queue_state"))
550 mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE;
551 else if (!strcmp(optarg, "intr_reset"))
552 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET;
553 else if (!strcmp(optarg, "vf_mbox"))
554 mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX;
555 else if (!strcmp(optarg, "ipsec"))
556 mask = UINT32_C(1) << RTE_ETH_EVENT_IPSEC;
557 else if (!strcmp(optarg, "macsec"))
558 mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
559 else if (!strcmp(optarg, "intr_rmv"))
560 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
561 else if (!strcmp(optarg, "dev_probed"))
562 mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
563 else if (!strcmp(optarg, "dev_released"))
564 mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
565 else if (!strcmp(optarg, "flow_aged"))
566 mask = UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED;
567 else if (!strcmp(optarg, "all"))
570 fprintf(stderr, "Invalid event: %s\n", optarg);
574 event_print_mask |= mask;
576 event_print_mask &= ~mask;
581 launch_args_parse(int argc, char** argv)
588 /* Default offloads for all ports. */
589 uint64_t rx_offloads = rx_mode.offloads;
590 uint64_t tx_offloads = tx_mode.offloads;
591 struct rte_eth_dev_info dev_info;
592 uint16_t rec_nb_pkts;
595 static struct option lgopts[] = {
597 #ifdef RTE_LIB_CMDLINE
598 { "interactive", 0, 0, 0 },
599 { "cmdline-file", 1, 0, 0 },
600 { "auto-start", 0, 0, 0 },
601 { "eth-peers-configfile", 1, 0, 0 },
602 { "eth-peer", 1, 0, 0 },
604 { "tx-first", 0, 0, 0 },
605 { "stats-period", 1, 0, 0 },
606 { "ports", 1, 0, 0 },
607 { "nb-cores", 1, 0, 0 },
608 { "nb-ports", 1, 0, 0 },
609 { "coremask", 1, 0, 0 },
610 { "portmask", 1, 0, 0 },
611 { "portlist", 1, 0, 0 },
613 { "no-numa", 0, 0, 0 },
614 { "mp-anon", 0, 0, 0 },
615 { "port-numa-config", 1, 0, 0 },
616 { "ring-numa-config", 1, 0, 0 },
617 { "socket-num", 1, 0, 0 },
618 { "mbuf-size", 1, 0, 0 },
619 { "total-num-mbufs", 1, 0, 0 },
620 { "max-pkt-len", 1, 0, 0 },
621 { "max-lro-pkt-size", 1, 0, 0 },
622 { "pkt-filter-mode", 1, 0, 0 },
623 { "pkt-filter-report-hash", 1, 0, 0 },
624 { "pkt-filter-size", 1, 0, 0 },
625 { "pkt-filter-drop-queue", 1, 0, 0 },
626 #ifdef RTE_LIB_LATENCYSTATS
627 { "latencystats", 1, 0, 0 },
629 #ifdef RTE_LIB_BITRATESTATS
630 { "bitrate-stats", 1, 0, 0 },
632 { "disable-crc-strip", 0, 0, 0 },
633 { "enable-lro", 0, 0, 0 },
634 { "enable-rx-cksum", 0, 0, 0 },
635 { "enable-rx-timestamp", 0, 0, 0 },
636 { "enable-scatter", 0, 0, 0 },
637 { "enable-hw-vlan", 0, 0, 0 },
638 { "enable-hw-vlan-filter", 0, 0, 0 },
639 { "enable-hw-vlan-strip", 0, 0, 0 },
640 { "enable-hw-vlan-extend", 0, 0, 0 },
641 { "enable-hw-qinq-strip", 0, 0, 0 },
642 { "enable-drop-en", 0, 0, 0 },
643 { "disable-rss", 0, 0, 0 },
644 { "port-topology", 1, 0, 0 },
645 { "forward-mode", 1, 0, 0 },
646 { "rss-ip", 0, 0, 0 },
647 { "rss-udp", 0, 0, 0 },
648 { "rss-level-outer", 0, 0, 0 },
649 { "rss-level-inner", 0, 0, 0 },
654 { "hairpinq", 1, 0, 0 },
655 { "hairpin-mode", 1, 0, 0 },
656 { "burst", 1, 0, 0 },
657 { "mbcache", 1, 0, 0 },
661 { "txfreet", 1, 0, 0 },
662 { "txrst", 1, 0, 0 },
666 { "rxfreet", 1, 0, 0 },
667 { "tx-queue-stats-mapping", 1, 0, 0 },
668 { "rx-queue-stats-mapping", 1, 0, 0 },
669 { "no-flush-rx", 0, 0, 0 },
670 { "flow-isolate-all", 0, 0, 0 },
671 { "rxoffs", 1, 0, 0 },
672 { "rxpkts", 1, 0, 0 },
673 { "txpkts", 1, 0, 0 },
674 { "txonly-multi-flow", 0, 0, 0 },
675 { "disable-link-check", 0, 0, 0 },
676 { "disable-device-start", 0, 0, 0 },
677 { "no-lsc-interrupt", 0, 0, 0 },
678 { "no-rmv-interrupt", 0, 0, 0 },
679 { "print-event", 1, 0, 0 },
680 { "mask-event", 1, 0, 0 },
681 { "tx-offloads", 1, 0, 0 },
682 { "rx-offloads", 1, 0, 0 },
683 { "hot-plug", 0, 0, 0 },
684 { "vxlan-gpe-port", 1, 0, 0 },
685 { "geneve-parsed-port", 1, 0, 0 },
686 { "mlockall", 0, 0, 0 },
687 { "no-mlockall", 0, 0, 0 },
688 { "mp-alloc", 1, 0, 0 },
689 { "tx-ip", 1, 0, 0 },
690 { "tx-udp", 1, 0, 0 },
691 { "noisy-tx-sw-buffer-size", 1, 0, 0 },
692 { "noisy-tx-sw-buffer-flushtime", 1, 0, 0 },
693 { "noisy-lkup-memory", 1, 0, 0 },
694 { "noisy-lkup-num-writes", 1, 0, 0 },
695 { "noisy-lkup-num-reads", 1, 0, 0 },
696 { "noisy-lkup-num-reads-writes", 1, 0, 0 },
697 { "no-iova-contig", 0, 0, 0 },
698 { "rx-mq-mode", 1, 0, 0 },
699 { "record-core-cycles", 0, 0, 0 },
700 { "record-burst-stats", 0, 0, 0 },
706 #ifdef RTE_LIB_CMDLINE
707 #define SHORTOPTS "i"
711 while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
712 lgopts, &opt_idx)) != EOF) {
714 #ifdef RTE_LIB_CMDLINE
716 printf("Interactive-mode selected\n");
721 printf("Auto-start selected\n");
725 case 0: /*long options */
726 if (!strcmp(lgopts[opt_idx].name, "help")) {
728 rte_exit(EXIT_SUCCESS, "Displayed help\n");
730 #ifdef RTE_LIB_CMDLINE
731 if (!strcmp(lgopts[opt_idx].name, "interactive")) {
732 printf("Interactive-mode selected\n");
735 if (!strcmp(lgopts[opt_idx].name, "cmdline-file")) {
736 printf("CLI commands to be read from %s\n",
738 strlcpy(cmdline_filename, optarg,
739 sizeof(cmdline_filename));
741 if (!strcmp(lgopts[opt_idx].name, "auto-start")) {
742 printf("Auto-start selected\n");
745 if (!strcmp(lgopts[opt_idx].name, "tx-first")) {
746 printf("Ports to start sending a burst of "
750 if (!strcmp(lgopts[opt_idx].name, "stats-period")) {
754 n = strtoul(optarg, &end, 10);
755 if ((optarg[0] == '\0') || (end == NULL) ||
762 if (!strcmp(lgopts[opt_idx].name,
763 "eth-peers-configfile")) {
764 if (init_peer_eth_addrs(optarg) != 0)
765 rte_exit(EXIT_FAILURE,
766 "Cannot open logfile\n");
768 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
772 n = strtoul(optarg, &port_end, 10);
773 if (errno != 0 || port_end == optarg || *port_end++ != ',')
774 rte_exit(EXIT_FAILURE,
775 "Invalid eth-peer: %s", optarg);
776 if (n >= RTE_MAX_ETHPORTS)
777 rte_exit(EXIT_FAILURE,
778 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
779 n, RTE_MAX_ETHPORTS);
781 if (rte_ether_unformat_addr(port_end,
782 &peer_eth_addrs[n]) < 0)
783 rte_exit(EXIT_FAILURE,
784 "Invalid ethernet address: %s\n",
789 if (!strcmp(lgopts[opt_idx].name, "tx-ip")) {
793 end = strchr(optarg, ',');
794 if (end == optarg || !end)
795 rte_exit(EXIT_FAILURE,
796 "Invalid tx-ip: %s", optarg);
799 if (inet_aton(optarg, &in) == 0)
800 rte_exit(EXIT_FAILURE,
801 "Invalid source IP address: %s\n",
803 tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
805 if (inet_aton(end, &in) == 0)
806 rte_exit(EXIT_FAILURE,
807 "Invalid destination IP address: %s\n",
809 tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr);
811 if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
815 n = strtoul(optarg, &end, 10);
816 if (errno != 0 || end == optarg ||
818 !(*end == '\0' || *end == ','))
819 rte_exit(EXIT_FAILURE,
820 "Invalid UDP port: %s\n",
826 n = strtoul(dst, &end, 10);
827 if (errno != 0 || end == dst ||
828 n > UINT16_MAX || *end)
829 rte_exit(EXIT_FAILURE,
830 "Invalid destination UDP port: %s\n",
838 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
840 if (n > 0 && n <= nb_ports)
843 rte_exit(EXIT_FAILURE,
844 "Invalid port %d\n", n);
846 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) {
848 if (n > 0 && n <= nb_lcores)
849 nb_fwd_lcores = (uint8_t) n;
851 rte_exit(EXIT_FAILURE,
852 "nb-cores should be > 0 and <= %d\n",
855 if (!strcmp(lgopts[opt_idx].name, "coremask"))
856 parse_fwd_coremask(optarg);
857 if (!strcmp(lgopts[opt_idx].name, "portmask"))
858 parse_fwd_portmask(optarg);
859 if (!strcmp(lgopts[opt_idx].name, "portlist"))
860 parse_fwd_portlist(optarg);
861 if (!strcmp(lgopts[opt_idx].name, "no-numa"))
863 if (!strcmp(lgopts[opt_idx].name, "numa"))
865 if (!strcmp(lgopts[opt_idx].name, "mp-anon")) {
866 mp_alloc_type = MP_ALLOC_ANON;
868 if (!strcmp(lgopts[opt_idx].name, "mp-alloc")) {
869 if (!strcmp(optarg, "native"))
870 mp_alloc_type = MP_ALLOC_NATIVE;
871 else if (!strcmp(optarg, "anon"))
872 mp_alloc_type = MP_ALLOC_ANON;
873 else if (!strcmp(optarg, "xmem"))
874 mp_alloc_type = MP_ALLOC_XMEM;
875 else if (!strcmp(optarg, "xmemhuge"))
876 mp_alloc_type = MP_ALLOC_XMEM_HUGE;
877 else if (!strcmp(optarg, "xbuf"))
878 mp_alloc_type = MP_ALLOC_XBUF;
880 rte_exit(EXIT_FAILURE,
881 "mp-alloc %s invalid - must be: "
882 "native, anon, xmem or xmemhuge\n",
885 if (!strcmp(lgopts[opt_idx].name, "port-numa-config")) {
886 if (parse_portnuma_config(optarg))
887 rte_exit(EXIT_FAILURE,
888 "invalid port-numa configuration\n");
890 if (!strcmp(lgopts[opt_idx].name, "ring-numa-config"))
891 if (parse_ringnuma_config(optarg))
892 rte_exit(EXIT_FAILURE,
893 "invalid ring-numa configuration\n");
894 if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
896 if (!new_socket_id((uint8_t)n)) {
897 socket_num = (uint8_t)n;
899 print_invalid_socket_id_error();
900 rte_exit(EXIT_FAILURE,
901 "Invalid socket id");
904 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
905 unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT];
906 unsigned int nb_segs, i;
908 nb_segs = parse_item_list(optarg, "mbuf-size",
909 MAX_SEGS_BUFFER_SPLIT, mb_sz, 0);
911 rte_exit(EXIT_FAILURE,
913 for (i = 0; i < nb_segs; i++) {
914 if (mb_sz[i] <= 0 || mb_sz[i] > 0xFFFF)
915 rte_exit(EXIT_FAILURE,
916 "mbuf-size should be "
917 "> 0 and < 65536\n");
918 mbuf_data_size[i] = (uint16_t) mb_sz[i];
920 mbuf_data_size_n = nb_segs;
922 if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
925 param_total_num_mbufs = (unsigned)n;
927 rte_exit(EXIT_FAILURE,
928 "total-num-mbufs should be > 1024\n");
930 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
932 if (n >= RTE_ETHER_MIN_LEN) {
933 rx_mode.max_rx_pkt_len = (uint32_t) n;
934 if (n > RTE_ETHER_MAX_LEN)
936 DEV_RX_OFFLOAD_JUMBO_FRAME;
938 rte_exit(EXIT_FAILURE,
939 "Invalid max-pkt-len=%d - should be > %d\n",
940 n, RTE_ETHER_MIN_LEN);
942 if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-size")) {
944 rx_mode.max_lro_pkt_size = (uint32_t) n;
946 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
947 if (!strcmp(optarg, "signature"))
949 RTE_FDIR_MODE_SIGNATURE;
950 else if (!strcmp(optarg, "perfect"))
951 fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
952 else if (!strcmp(optarg, "perfect-mac-vlan"))
953 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
954 else if (!strcmp(optarg, "perfect-tunnel"))
955 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
956 else if (!strcmp(optarg, "none"))
957 fdir_conf.mode = RTE_FDIR_MODE_NONE;
959 rte_exit(EXIT_FAILURE,
960 "pkt-mode-invalid %s invalid - must be: "
961 "none, signature, perfect, perfect-mac-vlan"
962 " or perfect-tunnel\n",
965 if (!strcmp(lgopts[opt_idx].name,
966 "pkt-filter-report-hash")) {
967 if (!strcmp(optarg, "none"))
969 RTE_FDIR_NO_REPORT_STATUS;
970 else if (!strcmp(optarg, "match"))
972 RTE_FDIR_REPORT_STATUS;
973 else if (!strcmp(optarg, "always"))
975 RTE_FDIR_REPORT_STATUS_ALWAYS;
977 rte_exit(EXIT_FAILURE,
978 "pkt-filter-report-hash %s invalid "
979 "- must be: none or match or always\n",
982 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
983 if (!strcmp(optarg, "64K"))
985 RTE_FDIR_PBALLOC_64K;
986 else if (!strcmp(optarg, "128K"))
988 RTE_FDIR_PBALLOC_128K;
989 else if (!strcmp(optarg, "256K"))
991 RTE_FDIR_PBALLOC_256K;
993 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
994 " must be: 64K or 128K or 256K\n",
997 if (!strcmp(lgopts[opt_idx].name,
998 "pkt-filter-drop-queue")) {
1001 fdir_conf.drop_queue = (uint8_t) n;
1003 rte_exit(EXIT_FAILURE,
1004 "drop queue %d invalid - must"
1007 #ifdef RTE_LIB_LATENCYSTATS
1008 if (!strcmp(lgopts[opt_idx].name,
1012 latencystats_lcore_id = (lcoreid_t) n;
1013 latencystats_enabled = 1;
1015 rte_exit(EXIT_FAILURE,
1016 "invalid lcore id %d for latencystats"
1017 " must be >= 0\n", n);
1020 #ifdef RTE_LIB_BITRATESTATS
1021 if (!strcmp(lgopts[opt_idx].name, "bitrate-stats")) {
1024 bitrate_lcore_id = (lcoreid_t) n;
1025 bitrate_enabled = 1;
1027 rte_exit(EXIT_FAILURE,
1028 "invalid lcore id %d for bitrate stats"
1029 " must be >= 0\n", n);
1032 if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
1033 rx_offloads |= DEV_RX_OFFLOAD_KEEP_CRC;
1034 if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
1035 rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO;
1036 if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
1037 rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
1038 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
1039 rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
1040 if (!strcmp(lgopts[opt_idx].name,
1041 "enable-rx-timestamp"))
1042 rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
1043 if (!strcmp(lgopts[opt_idx].name, "enable-hw-vlan"))
1044 rx_offloads |= DEV_RX_OFFLOAD_VLAN;
1046 if (!strcmp(lgopts[opt_idx].name,
1047 "enable-hw-vlan-filter"))
1048 rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
1050 if (!strcmp(lgopts[opt_idx].name,
1051 "enable-hw-vlan-strip"))
1052 rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
1054 if (!strcmp(lgopts[opt_idx].name,
1055 "enable-hw-vlan-extend"))
1056 rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
1058 if (!strcmp(lgopts[opt_idx].name,
1059 "enable-hw-qinq-strip"))
1060 rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
1062 if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
1065 if (!strcmp(lgopts[opt_idx].name, "disable-rss"))
1067 if (!strcmp(lgopts[opt_idx].name, "port-topology")) {
1068 if (!strcmp(optarg, "paired"))
1069 port_topology = PORT_TOPOLOGY_PAIRED;
1070 else if (!strcmp(optarg, "chained"))
1071 port_topology = PORT_TOPOLOGY_CHAINED;
1072 else if (!strcmp(optarg, "loop"))
1073 port_topology = PORT_TOPOLOGY_LOOP;
1075 rte_exit(EXIT_FAILURE, "port-topology %s invalid -"
1076 " must be: paired, chained or loop\n",
1079 if (!strcmp(lgopts[opt_idx].name, "forward-mode"))
1080 set_pkt_forwarding_mode(optarg);
1081 if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
1082 rss_hf = ETH_RSS_IP;
1083 if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
1084 rss_hf = ETH_RSS_UDP;
1085 if (!strcmp(lgopts[opt_idx].name, "rss-level-inner"))
1086 rss_hf |= ETH_RSS_LEVEL_INNERMOST;
1087 if (!strcmp(lgopts[opt_idx].name, "rss-level-outer"))
1088 rss_hf |= ETH_RSS_LEVEL_OUTERMOST;
1089 if (!strcmp(lgopts[opt_idx].name, "rxq")) {
1091 if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
1092 nb_rxq = (queueid_t) n;
1094 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
1095 " >= 0 && <= %u\n", n,
1096 get_allowed_max_nb_rxq(&pid));
1098 if (!strcmp(lgopts[opt_idx].name, "txq")) {
1100 if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
1101 nb_txq = (queueid_t) n;
1103 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1104 " >= 0 && <= %u\n", n,
1105 get_allowed_max_nb_txq(&pid));
1107 if (!strcmp(lgopts[opt_idx].name, "hairpinq")) {
1110 check_nb_hairpinq((queueid_t)n) == 0)
1111 nb_hairpinq = (queueid_t) n;
1113 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1114 " >= 0 && <= %u\n", n,
1115 get_allowed_max_nb_hairpinq
1117 if ((n + nb_txq) < 0 ||
1118 check_nb_txq((queueid_t)(n + nb_txq)) != 0)
1119 rte_exit(EXIT_FAILURE, "txq + hairpinq "
1120 "%d invalid - must be"
1123 get_allowed_max_nb_txq(&pid));
1124 if ((n + nb_rxq) < 0 ||
1125 check_nb_rxq((queueid_t)(n + nb_rxq)) != 0)
1126 rte_exit(EXIT_FAILURE, "rxq + hairpinq "
1127 "%d invalid - must be"
1130 get_allowed_max_nb_rxq(&pid));
1132 if (!nb_rxq && !nb_txq) {
1133 rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
1136 if (!strcmp(lgopts[opt_idx].name, "hairpin-mode")) {
1141 n = strtoul(optarg, &end, 0);
1142 if (errno != 0 || end == optarg)
1143 rte_exit(EXIT_FAILURE, "hairpin mode invalid\n");
1145 hairpin_mode = (uint16_t)n;
1147 if (!strcmp(lgopts[opt_idx].name, "burst")) {
1150 /* A burst size of zero means that the
1151 * PMD should be queried for
1152 * recommended Rx burst size. Since
1153 * testpmd uses a single size for all
1154 * ports, port 0 is queried for the
1155 * value, on the assumption that all
1156 * ports are of the same NIC model.
1158 ret = eth_dev_info_get_print_err(
1164 rec_nb_pkts = dev_info
1165 .default_rxportconf.burst_size;
1167 if (rec_nb_pkts == 0)
1168 rte_exit(EXIT_FAILURE,
1169 "PMD does not recommend a burst size. "
1170 "Provided value must be between "
1171 "1 and %d\n", MAX_PKT_BURST);
1172 else if (rec_nb_pkts > MAX_PKT_BURST)
1173 rte_exit(EXIT_FAILURE,
1174 "PMD recommended burst size of %d"
1175 " exceeds maximum value of %d\n",
1176 rec_nb_pkts, MAX_PKT_BURST);
1177 printf("Using PMD-provided burst value of %d\n",
1179 nb_pkt_per_burst = rec_nb_pkts;
1180 } else if (n > MAX_PKT_BURST)
1181 rte_exit(EXIT_FAILURE,
1182 "burst must be between1 and %d\n",
1185 nb_pkt_per_burst = (uint16_t) n;
1187 if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
1190 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
1191 mb_mempool_cache = (uint16_t) n;
1193 rte_exit(EXIT_FAILURE,
1194 "mbcache must be >= 0 and <= %d\n",
1195 RTE_MEMPOOL_CACHE_MAX_SIZE);
1197 if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
1200 tx_free_thresh = (int16_t)n;
1202 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n");
1204 if (!strcmp(lgopts[opt_idx].name, "txrst")) {
1207 tx_rs_thresh = (int16_t)n;
1209 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
1211 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
1214 if (rx_free_thresh >= n)
1215 rte_exit(EXIT_FAILURE,
1217 "rx_free_thresh(%d)\n",
1218 (int)rx_free_thresh);
1220 nb_rxd = (uint16_t) n;
1222 rte_exit(EXIT_FAILURE,
1223 "rxd(%d) invalid - must be > 0\n",
1226 if (!strcmp(lgopts[opt_idx].name, "txd")) {
1229 nb_txd = (uint16_t) n;
1231 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
1233 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
1236 tx_pthresh = (int8_t)n;
1238 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
1240 if (!strcmp(lgopts[opt_idx].name, "txht")) {
1243 tx_hthresh = (int8_t)n;
1245 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
1247 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
1250 tx_wthresh = (int8_t)n;
1252 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
1254 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
1257 rx_pthresh = (int8_t)n;
1259 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
1261 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
1264 rx_hthresh = (int8_t)n;
1266 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
1268 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
1271 rx_wthresh = (int8_t)n;
1273 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
1275 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) {
1278 rx_free_thresh = (int16_t)n;
1280 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n");
1282 if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) {
1283 if (parse_queue_stats_mapping_config(optarg, TX)) {
1284 rte_exit(EXIT_FAILURE,
1285 "invalid TX queue statistics mapping config entered\n");
1288 if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) {
1289 if (parse_queue_stats_mapping_config(optarg, RX)) {
1290 rte_exit(EXIT_FAILURE,
1291 "invalid RX queue statistics mapping config entered\n");
1294 if (!strcmp(lgopts[opt_idx].name, "rxoffs")) {
1295 unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT];
1296 unsigned int nb_offs;
1298 nb_offs = parse_item_list
1299 (optarg, "rxpkt offsets",
1300 MAX_SEGS_BUFFER_SPLIT,
1303 set_rx_pkt_offsets(seg_off, nb_offs);
1305 rte_exit(EXIT_FAILURE, "bad rxoffs\n");
1307 if (!strcmp(lgopts[opt_idx].name, "rxpkts")) {
1308 unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT];
1309 unsigned int nb_segs;
1311 nb_segs = parse_item_list
1312 (optarg, "rxpkt segments",
1313 MAX_SEGS_BUFFER_SPLIT,
1316 set_rx_pkt_segments(seg_len, nb_segs);
1318 rte_exit(EXIT_FAILURE, "bad rxpkts\n");
1320 if (!strcmp(lgopts[opt_idx].name, "txpkts")) {
1321 unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
1322 unsigned int nb_segs;
1324 nb_segs = parse_item_list(optarg, "txpkt segments",
1325 RTE_MAX_SEGS_PER_PKT, seg_lengths, 0);
1327 set_tx_pkt_segments(seg_lengths, nb_segs);
1329 rte_exit(EXIT_FAILURE, "bad txpkts\n");
1331 if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
1332 txonly_multi_flow = 1;
1333 if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
1335 if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
1337 if (!strcmp(lgopts[opt_idx].name, "disable-device-start"))
1338 no_device_start = 1;
1339 if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt"))
1341 if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
1343 if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
1344 flow_isolate_all = 1;
1345 if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
1347 n = strtoull(optarg, &end, 16);
1349 tx_offloads = (uint64_t)n;
1351 rte_exit(EXIT_FAILURE,
1352 "tx-offloads must be >= 0\n");
1355 if (!strcmp(lgopts[opt_idx].name, "rx-offloads")) {
1357 n = strtoull(optarg, &end, 16);
1359 rx_offloads = (uint64_t)n;
1361 rte_exit(EXIT_FAILURE,
1362 "rx-offloads must be >= 0\n");
1365 if (!strcmp(lgopts[opt_idx].name, "vxlan-gpe-port")) {
1368 vxlan_gpe_udp_port = (uint16_t)n;
1370 rte_exit(EXIT_FAILURE,
1371 "vxlan-gpe-port must be >= 0\n");
1373 if (!strcmp(lgopts[opt_idx].name,
1374 "geneve-parsed-port")) {
1377 geneve_udp_port = (uint16_t)n;
1379 rte_exit(EXIT_FAILURE,
1380 "geneve-parsed-port must be >= 0\n");
1382 if (!strcmp(lgopts[opt_idx].name, "print-event"))
1383 if (parse_event_printing_config(optarg, 1)) {
1384 rte_exit(EXIT_FAILURE,
1385 "invalid print-event argument\n");
1387 if (!strcmp(lgopts[opt_idx].name, "mask-event"))
1388 if (parse_event_printing_config(optarg, 0)) {
1389 rte_exit(EXIT_FAILURE,
1390 "invalid mask-event argument\n");
1392 if (!strcmp(lgopts[opt_idx].name, "hot-plug"))
1394 if (!strcmp(lgopts[opt_idx].name, "mlockall"))
1396 if (!strcmp(lgopts[opt_idx].name, "no-mlockall"))
1398 if (!strcmp(lgopts[opt_idx].name,
1399 "noisy-tx-sw-buffer-size")) {
1402 noisy_tx_sw_bufsz = n;
1404 rte_exit(EXIT_FAILURE,
1405 "noisy-tx-sw-buffer-size must be >= 0\n");
1407 if (!strcmp(lgopts[opt_idx].name,
1408 "noisy-tx-sw-buffer-flushtime")) {
1411 noisy_tx_sw_buf_flush_time = n;
1413 rte_exit(EXIT_FAILURE,
1414 "noisy-tx-sw-buffer-flushtime must be >= 0\n");
1416 if (!strcmp(lgopts[opt_idx].name,
1417 "noisy-lkup-memory")) {
1420 noisy_lkup_mem_sz = n;
1422 rte_exit(EXIT_FAILURE,
1423 "noisy-lkup-memory must be >= 0\n");
1425 if (!strcmp(lgopts[opt_idx].name,
1426 "noisy-lkup-num-writes")) {
1429 noisy_lkup_num_writes = n;
1431 rte_exit(EXIT_FAILURE,
1432 "noisy-lkup-num-writes must be >= 0\n");
1434 if (!strcmp(lgopts[opt_idx].name,
1435 "noisy-lkup-num-reads")) {
1438 noisy_lkup_num_reads = n;
1440 rte_exit(EXIT_FAILURE,
1441 "noisy-lkup-num-reads must be >= 0\n");
1443 if (!strcmp(lgopts[opt_idx].name,
1444 "noisy-lkup-num-reads-writes")) {
1447 noisy_lkup_num_reads_writes = n;
1449 rte_exit(EXIT_FAILURE,
1450 "noisy-lkup-num-reads-writes must be >= 0\n");
1452 if (!strcmp(lgopts[opt_idx].name, "no-iova-contig"))
1453 mempool_flags = MEMPOOL_F_NO_IOVA_CONTIG;
1455 if (!strcmp(lgopts[opt_idx].name, "rx-mq-mode")) {
1457 n = strtoul(optarg, &end, 16);
1458 if (n >= 0 && n <= ETH_MQ_RX_VMDQ_DCB_RSS)
1459 rx_mq_mode = (enum rte_eth_rx_mq_mode)n;
1461 rte_exit(EXIT_FAILURE,
1462 "rx-mq-mode must be >= 0 and <= %d\n",
1463 ETH_MQ_RX_VMDQ_DCB_RSS);
1465 if (!strcmp(lgopts[opt_idx].name, "record-core-cycles"))
1466 record_core_cycles = 1;
1467 if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
1468 record_burst_stats = 1;
1472 rte_exit(EXIT_SUCCESS, "Displayed help\n");
1476 printf("Invalid option: %s\n", argv[optind]);
1477 rte_exit(EXIT_FAILURE,
1478 "Command line is incomplete or incorrect\n");
1483 if (optind != argc) {
1485 printf("Invalid parameter: %s\n", argv[optind]);
1486 rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
1489 /* Set offload configuration from command line parameters. */
1490 rx_mode.offloads = rx_offloads;
1491 tx_mode.offloads = tx_offloads;
1493 if (mempool_flags & MEMPOOL_F_NO_IOVA_CONTIG &&
1494 mp_alloc_type != MP_ALLOC_ANON) {
1495 TESTPMD_LOG(WARNING, "cannot use no-iova-contig without "
1496 "mp-alloc=anon. mempool no-iova-contig is "