1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2017 Intel Corporation
14 #include <sys/types.h>
16 #include <sys/queue.h>
23 #include <rte_common.h>
24 #include <rte_byteorder.h>
26 #include <rte_debug.h>
27 #include <rte_cycles.h>
28 #include <rte_memory.h>
29 #include <rte_launch.h>
31 #include <rte_per_lcore.h>
32 #include <rte_lcore.h>
33 #include <rte_atomic.h>
34 #include <rte_branch_prediction.h>
35 #include <rte_mempool.h>
36 #include <rte_interrupts.h>
38 #include <rte_ether.h>
39 #include <rte_ethdev.h>
40 #include <rte_string_fns.h>
42 #include <rte_eth_bond.h>
51 printf("\nUsage: %s [EAL options] -- [testpmd options]\n\n",
53 #ifdef RTE_LIB_CMDLINE
54 printf(" --interactive: run in interactive mode.\n");
55 printf(" --cmdline-file: execute cli commands before startup.\n");
57 printf(" --auto-start: start forwarding on init "
58 "[always when non-interactive].\n");
59 printf(" --help: display this message and quit.\n");
60 printf(" --tx-first: start forwarding sending a burst first "
61 "(only if interactive is disabled).\n");
62 printf(" --stats-period=PERIOD: statistics will be shown "
63 "every PERIOD seconds (only if interactive is disabled).\n");
64 printf(" --nb-cores=N: set the number of forwarding cores "
65 "(1 <= N <= %d).\n", nb_lcores);
66 printf(" --nb-ports=N: set the number of forwarding ports "
67 "(1 <= N <= %d).\n", nb_ports);
68 printf(" --coremask=COREMASK: hexadecimal bitmask of cores running "
69 "the packet forwarding test. The main lcore is reserved for "
70 "command line parsing only, and cannot be masked on for "
71 "packet forwarding.\n");
72 printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used "
73 "by the packet forwarding test.\n");
74 printf(" --portlist=PORTLIST: list of forwarding ports\n");
75 printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
76 "RX memory buffers (mbufs).\n");
77 printf(" --no-numa: disable NUMA-aware allocation.\n");
78 printf(" --port-numa-config=(port,socket)[,(port,socket)]: "
79 "specify the socket on which the memory pool "
80 "used by the port will be allocated.\n");
81 printf(" --ring-numa-config=(port,flag,socket)[,(port,flag,socket)]: "
82 "specify the socket on which the TX/RX rings for "
83 "the port will be allocated "
84 "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
85 printf(" --socket-num=N: set socket from which all memory is allocated "
87 printf(" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to "
88 "N bytes. If multiple numbers are specified the extra pools "
89 "will be created to receive with packet split features\n");
90 printf(" --total-num-mbufs=N: set the number of mbufs to be allocated "
92 printf(" --max-pkt-len=N: set the maximum size of packet to N bytes.\n");
93 printf(" --max-lro-pkt-size=N: set the maximum LRO aggregated packet "
94 "size to N bytes.\n");
95 #ifdef RTE_LIB_CMDLINE
96 printf(" --eth-peers-configfile=name: config 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);
101 printf(" --pkt-filter-mode=N: set Flow Director mode "
102 "(N: none (default mode) or signature or perfect).\n");
103 printf(" --pkt-filter-report-hash=N: set Flow Director report mode "
104 "(N: none or match (default) or always).\n");
105 printf(" --pkt-filter-size=N: set Flow Director mode "
106 "(N: 64K (default mode) or 128K or 256K).\n");
107 printf(" --pkt-filter-drop-queue=N: set drop-queue. "
108 "In perfect mode, when you add a rule with queue = -1 "
109 "the packet will be enqueued into the rx drop-queue. "
110 "If the drop-queue doesn't exist, the packet is dropped. "
111 "By default drop-queue=127.\n");
112 #ifdef RTE_LIB_LATENCYSTATS
113 printf(" --latencystats=N: enable latency and jitter statistcs "
114 "monitoring on forwarding lcore id N.\n");
116 printf(" --disable-crc-strip: disable CRC stripping by hardware.\n");
117 printf(" --enable-scatter: enable scattered Rx.\n");
118 printf(" --enable-lro: enable large receive offload.\n");
119 printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n");
120 printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n");
121 printf(" --enable-hw-vlan: enable hardware vlan.\n");
122 printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n");
123 printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n");
124 printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n");
125 printf(" --enable-hw-qinq-strip: enable hardware qinq strip.\n");
126 printf(" --enable-drop-en: enable per queue packet drop.\n");
127 printf(" --disable-rss: disable rss.\n");
128 printf(" --port-topology=<paired|chained|loop>: set port topology (paired "
130 printf(" --forward-mode=N: set forwarding mode (N: %s).\n",
131 list_pkt_forwarding_modes());
132 printf(" --forward-mode=5tswap: set forwarding mode to "
133 "swap L2,L3,L4 for MAC, IPv4/IPv6 and TCP/UDP only.\n");
134 printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n");
135 printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n");
136 printf(" --rss-level-inner: set RSS hash level to innermost\n");
137 printf(" --rss-level-outer: set RSS hash level to outermost\n");
138 printf(" --rxq=N: set the number of RX queues per port to N.\n");
139 printf(" --rxd=N: set the number of descriptors in RX rings to N.\n");
140 printf(" --txq=N: set the number of TX queues per port to N.\n");
141 printf(" --txd=N: set the number of descriptors in TX rings to N.\n");
142 printf(" --hairpinq=N: set the number of hairpin queues per port to "
144 printf(" --burst=N: set the number of packets per burst to N.\n");
145 printf(" --flowgen-clones=N: set the number of single packet clones to send in flowgen mode. Should be less than burst value.\n");
146 printf(" --flowgen-flows=N: set the number of flows in flowgen mode to N (1 <= N <= INT32_MAX).\n");
147 printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n");
148 printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n");
149 printf(" --rxht=N: set the host threshold register of RX rings to N.\n");
150 printf(" --rxfreet=N: set the free threshold of RX descriptors to N "
151 "(0 <= N < value of rxd).\n");
152 printf(" --rxwt=N: set the write-back threshold register of RX rings to N.\n");
153 printf(" --txpt=N: set the prefetch threshold register of TX rings to N.\n");
154 printf(" --txht=N: set the nhost threshold register of TX rings to N.\n");
155 printf(" --txwt=N: set the write-back threshold register of TX rings to N.\n");
156 printf(" --txfreet=N: set the transmit free threshold of TX rings to N "
157 "(0 <= N <= value of txd).\n");
158 printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N "
159 "(0 <= N <= value of txd).\n");
160 printf(" --no-flush-rx: Don't flush RX streams before forwarding."
161 " Used mainly with PCAP drivers.\n");
162 printf(" --rxoffs=X[,Y]*: set RX segment offsets for split.\n");
163 printf(" --rxpkts=X[,Y]*: set RX segment sizes to split.\n");
164 printf(" --txpkts=X[,Y]*: set TX segment sizes"
165 " or total packet length.\n");
166 printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n");
167 printf(" --tx-ip=src,dst: IP addresses in Tx-only mode\n");
168 printf(" --tx-udp=src[,dst]: UDP ports in Tx-only mode\n");
169 printf(" --eth-link-speed: force link speed.\n");
170 printf(" --disable-link-check: disable check on link status when "
171 "starting/stopping ports.\n");
172 printf(" --disable-device-start: do not automatically start port\n");
173 printf(" --no-lsc-interrupt: disable link status change interrupt.\n");
174 printf(" --no-rmv-interrupt: disable device removal interrupt.\n");
175 printf(" --bitrate-stats=N: set the logical core N to perform "
176 "bit-rate calculation.\n");
177 printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|all>: "
178 "enable print of designated event or all of them.\n");
179 printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|all>: "
180 "disable print of designated event or all of them.\n");
181 printf(" --flow-isolate-all: "
182 "requests flow API isolated mode on all ports at initialization time.\n");
183 printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
184 printf(" --rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads\n");
185 printf(" --hot-plug: enable hot plug for device.\n");
186 printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n");
187 printf(" --geneve-parsed-port=N: UPD port to parse GENEVE tunnel protocol\n");
188 #ifndef RTE_EXEC_ENV_WINDOWS
189 printf(" --mlockall: lock all memory\n");
190 printf(" --no-mlockall: do not lock all memory\n");
192 printf(" --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\n"
193 " native: use regular DPDK memory to create and populate mempool\n"
194 " anon: use regular DPDK memory to create and anonymous memory to populate mempool\n"
195 " xmem: use anonymous memory to create and populate mempool\n"
196 " xmemhuge: use anonymous hugepage memory to create and populate mempool\n");
197 printf(" --noisy-tx-sw-buffer-size=N: size of FIFO buffer\n");
198 printf(" --noisy-tx-sw-buffer-flushtime=N: flush FIFO after N ms\n");
199 printf(" --noisy-lkup-memory=N: allocate N MB of VNF memory\n");
200 printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n");
201 printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n");
202 printf(" --noisy-lkup-num-reads-writes=N: do N random reads and writes per packet\n");
203 printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. "
204 "valid only with --mp-alloc=anon\n");
205 printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
207 printf(" --record-core-cycles: enable measurement of CPU cycles.\n");
208 printf(" --record-burst-stats: enable display of RX and TX bursts.\n");
209 printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
210 " 0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
211 " 0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
214 #ifdef RTE_LIB_CMDLINE
216 init_peer_eth_addrs(const char *config_filename)
222 config_file = fopen(config_filename, "r");
223 if (config_file == NULL) {
224 perror("Failed to open eth config file\n");
228 for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
230 if (fgets(buf, sizeof(buf), config_file) == NULL)
233 if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
234 fprintf(stderr, "Bad MAC address format on line %d\n",
241 nb_peer_eth_addrs = (portid_t) i;
247 * Parse the coremask given as argument (hexadecimal string) and set
248 * the global configuration of forwarding cores.
251 parse_fwd_coremask(const char *coremask)
254 unsigned long long int cm;
256 /* parse hexadecimal string */
258 cm = strtoull(coremask, &end, 16);
259 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0'))
260 rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n");
261 else if (set_fwd_lcores_mask((uint64_t) cm) < 0)
262 rte_exit(EXIT_FAILURE, "coremask is not valid\n");
266 * Parse the coremask given as argument (hexadecimal string) and set
267 * the global configuration of forwarding cores.
270 parse_fwd_portmask(const char *portmask)
273 unsigned long long int pm;
275 /* parse hexadecimal string */
277 pm = strtoull(portmask, &end, 16);
278 if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
279 rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
281 set_fwd_ports_mask((uint64_t) pm);
285 print_invalid_socket_id_error(void)
289 fprintf(stderr, "Invalid socket id, options are: ");
290 for (i = 0; i < num_sockets; i++) {
291 fprintf(stderr, "%u%s", socket_ids[i],
292 (i == num_sockets - 1) ? "\n" : ",");
297 parse_portnuma_config(const char *q_arg)
300 const char *p, *p0 = q_arg;
302 uint8_t i, socket_id;
310 unsigned long int_fld[_NUM_FLD];
311 char *str_fld[_NUM_FLD];
313 /* reset from value set at definition */
314 while ((p = strchr(p0,'(')) != NULL) {
316 if((p0 = strchr(p,')')) == NULL)
320 if(size >= sizeof(s))
323 snprintf(s, sizeof(s), "%.*s", size, p);
324 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
326 for (i = 0; i < _NUM_FLD; i++) {
328 int_fld[i] = strtoul(str_fld[i], &end, 0);
329 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
332 port_id = (portid_t)int_fld[FLD_PORT];
333 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
334 port_id == (portid_t)RTE_PORT_ALL) {
338 socket_id = (uint8_t)int_fld[FLD_SOCKET];
339 if (new_socket_id(socket_id)) {
340 if (num_sockets >= RTE_MAX_NUMA_NODES) {
341 print_invalid_socket_id_error();
344 socket_ids[num_sockets++] = socket_id;
346 port_numa[port_id] = socket_id;
353 parse_ringnuma_config(const char *q_arg)
356 const char *p, *p0 = q_arg;
358 uint8_t i, ring_flag, socket_id;
367 unsigned long int_fld[_NUM_FLD];
368 char *str_fld[_NUM_FLD];
369 #define RX_RING_ONLY 0x1
370 #define TX_RING_ONLY 0x2
371 #define RXTX_RING 0x3
373 /* reset from value set at definition */
374 while ((p = strchr(p0,'(')) != NULL) {
376 if((p0 = strchr(p,')')) == NULL)
380 if(size >= sizeof(s))
383 snprintf(s, sizeof(s), "%.*s", size, p);
384 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
386 for (i = 0; i < _NUM_FLD; i++) {
388 int_fld[i] = strtoul(str_fld[i], &end, 0);
389 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
392 port_id = (portid_t)int_fld[FLD_PORT];
393 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
394 port_id == (portid_t)RTE_PORT_ALL) {
398 socket_id = (uint8_t)int_fld[FLD_SOCKET];
399 if (new_socket_id(socket_id)) {
400 if (num_sockets >= RTE_MAX_NUMA_NODES) {
401 print_invalid_socket_id_error();
404 socket_ids[num_sockets++] = socket_id;
406 ring_flag = (uint8_t)int_fld[FLD_FLAG];
407 if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {
409 "Invalid ring-flag=%d config for port =%d\n",
414 switch (ring_flag & RXTX_RING) {
416 rxring_numa[port_id] = socket_id;
419 txring_numa[port_id] = socket_id;
422 rxring_numa[port_id] = socket_id;
423 txring_numa[port_id] = socket_id;
427 "Invalid ring-flag=%d config for port=%d\n",
437 parse_event_printing_config(const char *optarg, int enable)
441 if (!strcmp(optarg, "unknown"))
442 mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN;
443 else if (!strcmp(optarg, "intr_lsc"))
444 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC;
445 else if (!strcmp(optarg, "queue_state"))
446 mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE;
447 else if (!strcmp(optarg, "intr_reset"))
448 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET;
449 else if (!strcmp(optarg, "vf_mbox"))
450 mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX;
451 else if (!strcmp(optarg, "ipsec"))
452 mask = UINT32_C(1) << RTE_ETH_EVENT_IPSEC;
453 else if (!strcmp(optarg, "macsec"))
454 mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
455 else if (!strcmp(optarg, "intr_rmv"))
456 mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
457 else if (!strcmp(optarg, "dev_probed"))
458 mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
459 else if (!strcmp(optarg, "dev_released"))
460 mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
461 else if (!strcmp(optarg, "flow_aged"))
462 mask = UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED;
463 else if (!strcmp(optarg, "all"))
466 fprintf(stderr, "Invalid event: %s\n", optarg);
470 event_print_mask |= mask;
472 event_print_mask &= ~mask;
477 parse_link_speed(int n)
479 uint32_t speed = ETH_LINK_SPEED_FIXED;
483 speed |= ETH_LINK_SPEED_1G;
486 speed |= ETH_LINK_SPEED_10G;
489 speed |= ETH_LINK_SPEED_25G;
492 speed |= ETH_LINK_SPEED_40G;
495 speed |= ETH_LINK_SPEED_50G;
498 speed |= ETH_LINK_SPEED_100G;
501 speed |= ETH_LINK_SPEED_200G;
506 fprintf(stderr, "Unsupported fixed speed\n");
514 launch_args_parse(int argc, char** argv)
516 #define PARAM_PROC_ID "proc-id"
517 #define PARAM_NUM_PROCS "num-procs"
524 /* Default offloads for all ports. */
525 uint64_t rx_offloads = rx_mode.offloads;
526 uint64_t tx_offloads = tx_mode.offloads;
527 struct rte_eth_dev_info dev_info;
528 uint16_t rec_nb_pkts;
531 static struct option lgopts[] = {
533 #ifdef RTE_LIB_CMDLINE
534 { "interactive", 0, 0, 0 },
535 { "cmdline-file", 1, 0, 0 },
536 { "auto-start", 0, 0, 0 },
537 { "eth-peers-configfile", 1, 0, 0 },
538 { "eth-peer", 1, 0, 0 },
540 { "tx-first", 0, 0, 0 },
541 { "stats-period", 1, 0, 0 },
542 { "nb-cores", 1, 0, 0 },
543 { "nb-ports", 1, 0, 0 },
544 { "coremask", 1, 0, 0 },
545 { "portmask", 1, 0, 0 },
546 { "portlist", 1, 0, 0 },
548 { "no-numa", 0, 0, 0 },
549 { "mp-anon", 0, 0, 0 }, /* deprecated */
550 { "port-numa-config", 1, 0, 0 },
551 { "ring-numa-config", 1, 0, 0 },
552 { "socket-num", 1, 0, 0 },
553 { "mbuf-size", 1, 0, 0 },
554 { "total-num-mbufs", 1, 0, 0 },
555 { "max-pkt-len", 1, 0, 0 },
556 { "max-lro-pkt-size", 1, 0, 0 },
557 { "pkt-filter-mode", 1, 0, 0 },
558 { "pkt-filter-report-hash", 1, 0, 0 },
559 { "pkt-filter-size", 1, 0, 0 },
560 { "pkt-filter-drop-queue", 1, 0, 0 },
561 #ifdef RTE_LIB_LATENCYSTATS
562 { "latencystats", 1, 0, 0 },
564 #ifdef RTE_LIB_BITRATESTATS
565 { "bitrate-stats", 1, 0, 0 },
567 { "disable-crc-strip", 0, 0, 0 },
568 { "enable-lro", 0, 0, 0 },
569 { "enable-rx-cksum", 0, 0, 0 },
570 { "enable-rx-timestamp", 0, 0, 0 },
571 { "enable-scatter", 0, 0, 0 },
572 { "enable-hw-vlan", 0, 0, 0 },
573 { "enable-hw-vlan-filter", 0, 0, 0 },
574 { "enable-hw-vlan-strip", 0, 0, 0 },
575 { "enable-hw-vlan-extend", 0, 0, 0 },
576 { "enable-hw-qinq-strip", 0, 0, 0 },
577 { "enable-drop-en", 0, 0, 0 },
578 { "disable-rss", 0, 0, 0 },
579 { "port-topology", 1, 0, 0 },
580 { "forward-mode", 1, 0, 0 },
581 { "rss-ip", 0, 0, 0 },
582 { "rss-udp", 0, 0, 0 },
583 { "rss-level-outer", 0, 0, 0 },
584 { "rss-level-inner", 0, 0, 0 },
589 { "hairpinq", 1, 0, 0 },
590 { "hairpin-mode", 1, 0, 0 },
591 { "burst", 1, 0, 0 },
592 { "flowgen-clones", 1, 0, 0 },
593 { "flowgen-flows", 1, 0, 0 },
594 { "mbcache", 1, 0, 0 },
598 { "txfreet", 1, 0, 0 },
599 { "txrst", 1, 0, 0 },
603 { "rxfreet", 1, 0, 0 },
604 { "no-flush-rx", 0, 0, 0 },
605 { "flow-isolate-all", 0, 0, 0 },
606 { "rxoffs", 1, 0, 0 },
607 { "rxpkts", 1, 0, 0 },
608 { "txpkts", 1, 0, 0 },
609 { "txonly-multi-flow", 0, 0, 0 },
610 { "eth-link-speed", 1, 0, 0 },
611 { "disable-link-check", 0, 0, 0 },
612 { "disable-device-start", 0, 0, 0 },
613 { "no-lsc-interrupt", 0, 0, 0 },
614 { "no-rmv-interrupt", 0, 0, 0 },
615 { "print-event", 1, 0, 0 },
616 { "mask-event", 1, 0, 0 },
617 { "tx-offloads", 1, 0, 0 },
618 { "rx-offloads", 1, 0, 0 },
619 { "hot-plug", 0, 0, 0 },
620 { "vxlan-gpe-port", 1, 0, 0 },
621 { "geneve-parsed-port", 1, 0, 0 },
622 #ifndef RTE_EXEC_ENV_WINDOWS
623 { "mlockall", 0, 0, 0 },
624 { "no-mlockall", 0, 0, 0 },
626 { "mp-alloc", 1, 0, 0 },
627 { "tx-ip", 1, 0, 0 },
628 { "tx-udp", 1, 0, 0 },
629 { "noisy-tx-sw-buffer-size", 1, 0, 0 },
630 { "noisy-tx-sw-buffer-flushtime", 1, 0, 0 },
631 { "noisy-lkup-memory", 1, 0, 0 },
632 { "noisy-lkup-num-writes", 1, 0, 0 },
633 { "noisy-lkup-num-reads", 1, 0, 0 },
634 { "noisy-lkup-num-reads-writes", 1, 0, 0 },
635 { "no-iova-contig", 0, 0, 0 },
636 { "rx-mq-mode", 1, 0, 0 },
637 { "record-core-cycles", 0, 0, 0 },
638 { "record-burst-stats", 0, 0, 0 },
639 { PARAM_NUM_PROCS, 1, 0, 0 },
640 { PARAM_PROC_ID, 1, 0, 0 },
646 #ifdef RTE_LIB_CMDLINE
647 #define SHORTOPTS "i"
651 while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
652 lgopts, &opt_idx)) != EOF) {
654 #ifdef RTE_LIB_CMDLINE
656 printf("Interactive-mode selected\n");
661 printf("Auto-start selected\n");
665 case 0: /*long options */
666 if (!strcmp(lgopts[opt_idx].name, "help")) {
670 #ifdef RTE_LIB_CMDLINE
671 if (!strcmp(lgopts[opt_idx].name, "interactive")) {
672 printf("Interactive-mode selected\n");
675 if (!strcmp(lgopts[opt_idx].name, "cmdline-file")) {
676 printf("CLI commands to be read from %s\n",
678 strlcpy(cmdline_filename, optarg,
679 sizeof(cmdline_filename));
681 if (!strcmp(lgopts[opt_idx].name, "auto-start")) {
682 printf("Auto-start selected\n");
685 if (!strcmp(lgopts[opt_idx].name, "tx-first")) {
686 printf("Ports to start sending a burst of "
690 if (!strcmp(lgopts[opt_idx].name, "stats-period")) {
694 n = strtoul(optarg, &end, 10);
695 if ((optarg[0] == '\0') || (end == NULL) ||
702 if (!strcmp(lgopts[opt_idx].name,
703 "eth-peers-configfile")) {
704 if (init_peer_eth_addrs(optarg) != 0)
705 rte_exit(EXIT_FAILURE,
706 "Cannot open logfile\n");
708 if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
712 n = strtoul(optarg, &port_end, 10);
713 if (errno != 0 || port_end == optarg || *port_end++ != ',')
714 rte_exit(EXIT_FAILURE,
715 "Invalid eth-peer: %s", optarg);
716 if (n >= RTE_MAX_ETHPORTS)
717 rte_exit(EXIT_FAILURE,
718 "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
719 n, RTE_MAX_ETHPORTS);
721 if (rte_ether_unformat_addr(port_end,
722 &peer_eth_addrs[n]) < 0)
723 rte_exit(EXIT_FAILURE,
724 "Invalid ethernet address: %s\n",
729 if (!strcmp(lgopts[opt_idx].name, "tx-ip")) {
733 end = strchr(optarg, ',');
734 if (end == optarg || !end)
735 rte_exit(EXIT_FAILURE,
736 "Invalid tx-ip: %s", optarg);
739 if (inet_pton(AF_INET, optarg, &in) == 0)
740 rte_exit(EXIT_FAILURE,
741 "Invalid source IP address: %s\n",
743 tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
745 if (inet_pton(AF_INET, end, &in) == 0)
746 rte_exit(EXIT_FAILURE,
747 "Invalid destination IP address: %s\n",
749 tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr);
751 if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
755 n = strtoul(optarg, &end, 10);
756 if (errno != 0 || end == optarg ||
758 !(*end == '\0' || *end == ','))
759 rte_exit(EXIT_FAILURE,
760 "Invalid UDP port: %s\n",
766 n = strtoul(dst, &end, 10);
767 if (errno != 0 || end == dst ||
768 n > UINT16_MAX || *end)
769 rte_exit(EXIT_FAILURE,
770 "Invalid destination UDP port: %s\n",
778 if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
780 if (n > 0 && n <= nb_ports)
783 rte_exit(EXIT_FAILURE,
784 "Invalid port %d\n", n);
786 if (!strcmp(lgopts[opt_idx].name, "nb-cores")) {
788 if (n > 0 && n <= nb_lcores)
789 nb_fwd_lcores = (uint8_t) n;
791 rte_exit(EXIT_FAILURE,
792 "nb-cores should be > 0 and <= %d\n",
795 if (!strcmp(lgopts[opt_idx].name, "coremask"))
796 parse_fwd_coremask(optarg);
797 if (!strcmp(lgopts[opt_idx].name, "portmask"))
798 parse_fwd_portmask(optarg);
799 if (!strcmp(lgopts[opt_idx].name, "portlist"))
800 parse_fwd_portlist(optarg);
801 if (!strcmp(lgopts[opt_idx].name, "no-numa"))
803 if (!strcmp(lgopts[opt_idx].name, "numa"))
805 if (!strcmp(lgopts[opt_idx].name, "mp-anon")) {
806 mp_alloc_type = MP_ALLOC_ANON;
808 if (!strcmp(lgopts[opt_idx].name, "mp-alloc")) {
809 if (!strcmp(optarg, "native"))
810 mp_alloc_type = MP_ALLOC_NATIVE;
811 else if (!strcmp(optarg, "anon"))
812 mp_alloc_type = MP_ALLOC_ANON;
813 else if (!strcmp(optarg, "xmem"))
814 mp_alloc_type = MP_ALLOC_XMEM;
815 else if (!strcmp(optarg, "xmemhuge"))
816 mp_alloc_type = MP_ALLOC_XMEM_HUGE;
817 else if (!strcmp(optarg, "xbuf"))
818 mp_alloc_type = MP_ALLOC_XBUF;
820 rte_exit(EXIT_FAILURE,
821 "mp-alloc %s invalid - must be: "
822 "native, anon, xmem or xmemhuge\n",
825 if (!strcmp(lgopts[opt_idx].name, "port-numa-config")) {
826 if (parse_portnuma_config(optarg))
827 rte_exit(EXIT_FAILURE,
828 "invalid port-numa configuration\n");
830 if (!strcmp(lgopts[opt_idx].name, "ring-numa-config"))
831 if (parse_ringnuma_config(optarg))
832 rte_exit(EXIT_FAILURE,
833 "invalid ring-numa configuration\n");
834 if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
836 if (!new_socket_id((uint8_t)n)) {
837 socket_num = (uint8_t)n;
839 print_invalid_socket_id_error();
840 rte_exit(EXIT_FAILURE,
841 "Invalid socket id");
844 if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
845 unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT];
846 unsigned int nb_segs, i;
848 nb_segs = parse_item_list(optarg, "mbuf-size",
849 MAX_SEGS_BUFFER_SPLIT, mb_sz, 0);
851 rte_exit(EXIT_FAILURE,
853 for (i = 0; i < nb_segs; i++) {
854 if (mb_sz[i] <= 0 || mb_sz[i] > 0xFFFF)
855 rte_exit(EXIT_FAILURE,
856 "mbuf-size should be "
857 "> 0 and < 65536\n");
858 mbuf_data_size[i] = (uint16_t) mb_sz[i];
860 mbuf_data_size_n = nb_segs;
862 if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
865 param_total_num_mbufs = (unsigned)n;
867 rte_exit(EXIT_FAILURE,
868 "total-num-mbufs should be > 1024\n");
870 if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
872 if (n >= RTE_ETHER_MIN_LEN)
873 rx_mode.max_rx_pkt_len = (uint32_t) n;
875 rte_exit(EXIT_FAILURE,
876 "Invalid max-pkt-len=%d - should be > %d\n",
877 n, RTE_ETHER_MIN_LEN);
879 if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-size")) {
881 rx_mode.max_lro_pkt_size = (uint32_t) n;
883 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
884 if (!strcmp(optarg, "signature"))
886 RTE_FDIR_MODE_SIGNATURE;
887 else if (!strcmp(optarg, "perfect"))
888 fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
889 else if (!strcmp(optarg, "perfect-mac-vlan"))
890 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
891 else if (!strcmp(optarg, "perfect-tunnel"))
892 fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
893 else if (!strcmp(optarg, "none"))
894 fdir_conf.mode = RTE_FDIR_MODE_NONE;
896 rte_exit(EXIT_FAILURE,
897 "pkt-mode-invalid %s invalid - must be: "
898 "none, signature, perfect, perfect-mac-vlan"
899 " or perfect-tunnel\n",
902 if (!strcmp(lgopts[opt_idx].name,
903 "pkt-filter-report-hash")) {
904 if (!strcmp(optarg, "none"))
906 RTE_FDIR_NO_REPORT_STATUS;
907 else if (!strcmp(optarg, "match"))
909 RTE_FDIR_REPORT_STATUS;
910 else if (!strcmp(optarg, "always"))
912 RTE_FDIR_REPORT_STATUS_ALWAYS;
914 rte_exit(EXIT_FAILURE,
915 "pkt-filter-report-hash %s invalid "
916 "- must be: none or match or always\n",
919 if (!strcmp(lgopts[opt_idx].name, "pkt-filter-size")) {
920 if (!strcmp(optarg, "64K"))
922 RTE_FDIR_PBALLOC_64K;
923 else if (!strcmp(optarg, "128K"))
925 RTE_FDIR_PBALLOC_128K;
926 else if (!strcmp(optarg, "256K"))
928 RTE_FDIR_PBALLOC_256K;
930 rte_exit(EXIT_FAILURE, "pkt-filter-size %s invalid -"
931 " must be: 64K or 128K or 256K\n",
934 if (!strcmp(lgopts[opt_idx].name,
935 "pkt-filter-drop-queue")) {
938 fdir_conf.drop_queue = (uint8_t) n;
940 rte_exit(EXIT_FAILURE,
941 "drop queue %d invalid - must"
944 #ifdef RTE_LIB_LATENCYSTATS
945 if (!strcmp(lgopts[opt_idx].name,
949 latencystats_lcore_id = (lcoreid_t) n;
950 latencystats_enabled = 1;
952 rte_exit(EXIT_FAILURE,
953 "invalid lcore id %d for latencystats"
954 " must be >= 0\n", n);
957 #ifdef RTE_LIB_BITRATESTATS
958 if (!strcmp(lgopts[opt_idx].name, "bitrate-stats")) {
961 bitrate_lcore_id = (lcoreid_t) n;
964 rte_exit(EXIT_FAILURE,
965 "invalid lcore id %d for bitrate stats"
966 " must be >= 0\n", n);
969 if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
970 rx_offloads |= DEV_RX_OFFLOAD_KEEP_CRC;
971 if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
972 rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO;
973 if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
974 rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
975 if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
976 rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
977 if (!strcmp(lgopts[opt_idx].name,
978 "enable-rx-timestamp"))
979 rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
980 if (!strcmp(lgopts[opt_idx].name, "enable-hw-vlan"))
981 rx_offloads |= DEV_RX_OFFLOAD_VLAN;
983 if (!strcmp(lgopts[opt_idx].name,
984 "enable-hw-vlan-filter"))
985 rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
987 if (!strcmp(lgopts[opt_idx].name,
988 "enable-hw-vlan-strip"))
989 rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
991 if (!strcmp(lgopts[opt_idx].name,
992 "enable-hw-vlan-extend"))
993 rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
995 if (!strcmp(lgopts[opt_idx].name,
996 "enable-hw-qinq-strip"))
997 rx_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
999 if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
1002 if (!strcmp(lgopts[opt_idx].name, "disable-rss"))
1004 if (!strcmp(lgopts[opt_idx].name, "port-topology")) {
1005 if (!strcmp(optarg, "paired"))
1006 port_topology = PORT_TOPOLOGY_PAIRED;
1007 else if (!strcmp(optarg, "chained"))
1008 port_topology = PORT_TOPOLOGY_CHAINED;
1009 else if (!strcmp(optarg, "loop"))
1010 port_topology = PORT_TOPOLOGY_LOOP;
1012 rte_exit(EXIT_FAILURE, "port-topology %s invalid -"
1013 " must be: paired, chained or loop\n",
1016 if (!strcmp(lgopts[opt_idx].name, "forward-mode"))
1017 set_pkt_forwarding_mode(optarg);
1018 if (!strcmp(lgopts[opt_idx].name, "rss-ip"))
1019 rss_hf = ETH_RSS_IP;
1020 if (!strcmp(lgopts[opt_idx].name, "rss-udp"))
1021 rss_hf = ETH_RSS_UDP;
1022 if (!strcmp(lgopts[opt_idx].name, "rss-level-inner"))
1023 rss_hf |= ETH_RSS_LEVEL_INNERMOST;
1024 if (!strcmp(lgopts[opt_idx].name, "rss-level-outer"))
1025 rss_hf |= ETH_RSS_LEVEL_OUTERMOST;
1026 if (!strcmp(lgopts[opt_idx].name, "rxq")) {
1028 if (n >= 0 && check_nb_rxq((queueid_t)n) == 0)
1029 nb_rxq = (queueid_t) n;
1031 rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
1032 " >= 0 && <= %u\n", n,
1033 get_allowed_max_nb_rxq(&pid));
1035 if (!strcmp(lgopts[opt_idx].name, "txq")) {
1037 if (n >= 0 && check_nb_txq((queueid_t)n) == 0)
1038 nb_txq = (queueid_t) n;
1040 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1041 " >= 0 && <= %u\n", n,
1042 get_allowed_max_nb_txq(&pid));
1044 if (!strcmp(lgopts[opt_idx].name, "hairpinq")) {
1047 check_nb_hairpinq((queueid_t)n) == 0)
1048 nb_hairpinq = (queueid_t) n;
1050 rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
1051 " >= 0 && <= %u\n", n,
1052 get_allowed_max_nb_hairpinq
1054 if ((n + nb_txq) < 0 ||
1055 check_nb_txq((queueid_t)(n + nb_txq)) != 0)
1056 rte_exit(EXIT_FAILURE, "txq + hairpinq "
1057 "%d invalid - must be"
1060 get_allowed_max_nb_txq(&pid));
1061 if ((n + nb_rxq) < 0 ||
1062 check_nb_rxq((queueid_t)(n + nb_rxq)) != 0)
1063 rte_exit(EXIT_FAILURE, "rxq + hairpinq "
1064 "%d invalid - must be"
1067 get_allowed_max_nb_rxq(&pid));
1069 if (!nb_rxq && !nb_txq) {
1070 rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
1073 if (!strcmp(lgopts[opt_idx].name, "hairpin-mode")) {
1078 n = strtoul(optarg, &end, 0);
1079 if (errno != 0 || end == optarg)
1080 rte_exit(EXIT_FAILURE, "hairpin mode invalid\n");
1082 hairpin_mode = (uint16_t)n;
1084 if (!strcmp(lgopts[opt_idx].name, "burst")) {
1087 /* A burst size of zero means that the
1088 * PMD should be queried for
1089 * recommended Rx burst size. Since
1090 * testpmd uses a single size for all
1091 * ports, port 0 is queried for the
1092 * value, on the assumption that all
1093 * ports are of the same NIC model.
1095 ret = eth_dev_info_get_print_err(
1101 rec_nb_pkts = dev_info
1102 .default_rxportconf.burst_size;
1104 if (rec_nb_pkts == 0)
1105 rte_exit(EXIT_FAILURE,
1106 "PMD does not recommend a burst size. "
1107 "Provided value must be between "
1108 "1 and %d\n", MAX_PKT_BURST);
1109 else if (rec_nb_pkts > MAX_PKT_BURST)
1110 rte_exit(EXIT_FAILURE,
1111 "PMD recommended burst size of %d"
1112 " exceeds maximum value of %d\n",
1113 rec_nb_pkts, MAX_PKT_BURST);
1114 printf("Using PMD-provided burst value of %d\n",
1116 nb_pkt_per_burst = rec_nb_pkts;
1117 } else if (n > MAX_PKT_BURST)
1118 rte_exit(EXIT_FAILURE,
1119 "burst must be between1 and %d\n",
1122 nb_pkt_per_burst = (uint16_t) n;
1124 if (!strcmp(lgopts[opt_idx].name, "flowgen-clones")) {
1127 nb_pkt_flowgen_clones = (uint16_t) n;
1129 rte_exit(EXIT_FAILURE,
1130 "clones must be >= 0 and <= current burst\n");
1132 if (!strcmp(lgopts[opt_idx].name, "flowgen-flows")) {
1135 nb_flows_flowgen = (int) n;
1137 rte_exit(EXIT_FAILURE,
1138 "flows must be >= 1\n");
1140 if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
1143 (n <= RTE_MEMPOOL_CACHE_MAX_SIZE))
1144 mb_mempool_cache = (uint16_t) n;
1146 rte_exit(EXIT_FAILURE,
1147 "mbcache must be >= 0 and <= %d\n",
1148 RTE_MEMPOOL_CACHE_MAX_SIZE);
1150 if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
1153 tx_free_thresh = (int16_t)n;
1155 rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n");
1157 if (!strcmp(lgopts[opt_idx].name, "txrst")) {
1160 tx_rs_thresh = (int16_t)n;
1162 rte_exit(EXIT_FAILURE, "txrst must be >= 0\n");
1164 if (!strcmp(lgopts[opt_idx].name, "rxd")) {
1167 if (rx_free_thresh >= n)
1168 rte_exit(EXIT_FAILURE,
1170 "rx_free_thresh(%d)\n",
1171 (int)rx_free_thresh);
1173 nb_rxd = (uint16_t) n;
1175 rte_exit(EXIT_FAILURE,
1176 "rxd(%d) invalid - must be > 0\n",
1179 if (!strcmp(lgopts[opt_idx].name, "txd")) {
1182 nb_txd = (uint16_t) n;
1184 rte_exit(EXIT_FAILURE, "txd must be in > 0\n");
1186 if (!strcmp(lgopts[opt_idx].name, "txpt")) {
1189 tx_pthresh = (int8_t)n;
1191 rte_exit(EXIT_FAILURE, "txpt must be >= 0\n");
1193 if (!strcmp(lgopts[opt_idx].name, "txht")) {
1196 tx_hthresh = (int8_t)n;
1198 rte_exit(EXIT_FAILURE, "txht must be >= 0\n");
1200 if (!strcmp(lgopts[opt_idx].name, "txwt")) {
1203 tx_wthresh = (int8_t)n;
1205 rte_exit(EXIT_FAILURE, "txwt must be >= 0\n");
1207 if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
1210 rx_pthresh = (int8_t)n;
1212 rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n");
1214 if (!strcmp(lgopts[opt_idx].name, "rxht")) {
1217 rx_hthresh = (int8_t)n;
1219 rte_exit(EXIT_FAILURE, "rxht must be >= 0\n");
1221 if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
1224 rx_wthresh = (int8_t)n;
1226 rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n");
1228 if (!strcmp(lgopts[opt_idx].name, "rxfreet")) {
1231 rx_free_thresh = (int16_t)n;
1233 rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n");
1235 if (!strcmp(lgopts[opt_idx].name, "rxoffs")) {
1236 unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT];
1237 unsigned int nb_offs;
1239 nb_offs = parse_item_list
1240 (optarg, "rxpkt offsets",
1241 MAX_SEGS_BUFFER_SPLIT,
1244 set_rx_pkt_offsets(seg_off, nb_offs);
1246 rte_exit(EXIT_FAILURE, "bad rxoffs\n");
1248 if (!strcmp(lgopts[opt_idx].name, "rxpkts")) {
1249 unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT];
1250 unsigned int nb_segs;
1252 nb_segs = parse_item_list
1253 (optarg, "rxpkt segments",
1254 MAX_SEGS_BUFFER_SPLIT,
1257 set_rx_pkt_segments(seg_len, nb_segs);
1259 rte_exit(EXIT_FAILURE, "bad rxpkts\n");
1261 if (!strcmp(lgopts[opt_idx].name, "txpkts")) {
1262 unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
1263 unsigned int nb_segs;
1265 nb_segs = parse_item_list(optarg, "txpkt segments",
1266 RTE_MAX_SEGS_PER_PKT, seg_lengths, 0);
1268 set_tx_pkt_segments(seg_lengths, nb_segs);
1270 rte_exit(EXIT_FAILURE, "bad txpkts\n");
1272 if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow"))
1273 txonly_multi_flow = 1;
1274 if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
1276 if (!strcmp(lgopts[opt_idx].name, "eth-link-speed")) {
1278 if (n >= 0 && parse_link_speed(n) > 0)
1279 eth_link_speed = parse_link_speed(n);
1281 if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
1283 if (!strcmp(lgopts[opt_idx].name, "disable-device-start"))
1284 no_device_start = 1;
1285 if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt"))
1287 if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
1289 if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
1290 flow_isolate_all = 1;
1291 if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
1293 n = strtoull(optarg, &end, 16);
1295 tx_offloads = (uint64_t)n;
1297 rte_exit(EXIT_FAILURE,
1298 "tx-offloads must be >= 0\n");
1301 if (!strcmp(lgopts[opt_idx].name, "rx-offloads")) {
1303 n = strtoull(optarg, &end, 16);
1305 rx_offloads = (uint64_t)n;
1307 rte_exit(EXIT_FAILURE,
1308 "rx-offloads must be >= 0\n");
1311 if (!strcmp(lgopts[opt_idx].name, "vxlan-gpe-port")) {
1314 vxlan_gpe_udp_port = (uint16_t)n;
1316 rte_exit(EXIT_FAILURE,
1317 "vxlan-gpe-port must be >= 0\n");
1319 if (!strcmp(lgopts[opt_idx].name,
1320 "geneve-parsed-port")) {
1323 geneve_udp_port = (uint16_t)n;
1325 rte_exit(EXIT_FAILURE,
1326 "geneve-parsed-port must be >= 0\n");
1328 if (!strcmp(lgopts[opt_idx].name, "print-event"))
1329 if (parse_event_printing_config(optarg, 1)) {
1330 rte_exit(EXIT_FAILURE,
1331 "invalid print-event argument\n");
1333 if (!strcmp(lgopts[opt_idx].name, "mask-event"))
1334 if (parse_event_printing_config(optarg, 0)) {
1335 rte_exit(EXIT_FAILURE,
1336 "invalid mask-event argument\n");
1338 if (!strcmp(lgopts[opt_idx].name, "hot-plug"))
1340 if (!strcmp(lgopts[opt_idx].name, "mlockall"))
1342 if (!strcmp(lgopts[opt_idx].name, "no-mlockall"))
1344 if (!strcmp(lgopts[opt_idx].name,
1345 "noisy-tx-sw-buffer-size")) {
1348 noisy_tx_sw_bufsz = n;
1350 rte_exit(EXIT_FAILURE,
1351 "noisy-tx-sw-buffer-size must be >= 0\n");
1353 if (!strcmp(lgopts[opt_idx].name,
1354 "noisy-tx-sw-buffer-flushtime")) {
1357 noisy_tx_sw_buf_flush_time = n;
1359 rte_exit(EXIT_FAILURE,
1360 "noisy-tx-sw-buffer-flushtime must be >= 0\n");
1362 if (!strcmp(lgopts[opt_idx].name,
1363 "noisy-lkup-memory")) {
1366 noisy_lkup_mem_sz = n;
1368 rte_exit(EXIT_FAILURE,
1369 "noisy-lkup-memory must be >= 0\n");
1371 if (!strcmp(lgopts[opt_idx].name,
1372 "noisy-lkup-num-writes")) {
1375 noisy_lkup_num_writes = n;
1377 rte_exit(EXIT_FAILURE,
1378 "noisy-lkup-num-writes must be >= 0\n");
1380 if (!strcmp(lgopts[opt_idx].name,
1381 "noisy-lkup-num-reads")) {
1384 noisy_lkup_num_reads = n;
1386 rte_exit(EXIT_FAILURE,
1387 "noisy-lkup-num-reads must be >= 0\n");
1389 if (!strcmp(lgopts[opt_idx].name,
1390 "noisy-lkup-num-reads-writes")) {
1393 noisy_lkup_num_reads_writes = n;
1395 rte_exit(EXIT_FAILURE,
1396 "noisy-lkup-num-reads-writes must be >= 0\n");
1398 if (!strcmp(lgopts[opt_idx].name, "no-iova-contig"))
1399 mempool_flags = RTE_MEMPOOL_F_NO_IOVA_CONTIG;
1401 if (!strcmp(lgopts[opt_idx].name, "rx-mq-mode")) {
1403 n = strtoul(optarg, &end, 16);
1404 if (n >= 0 && n <= ETH_MQ_RX_VMDQ_DCB_RSS)
1405 rx_mq_mode = (enum rte_eth_rx_mq_mode)n;
1407 rte_exit(EXIT_FAILURE,
1408 "rx-mq-mode must be >= 0 and <= %d\n",
1409 ETH_MQ_RX_VMDQ_DCB_RSS);
1411 if (!strcmp(lgopts[opt_idx].name, "record-core-cycles"))
1412 record_core_cycles = 1;
1413 if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
1414 record_burst_stats = 1;
1415 if (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))
1416 num_procs = atoi(optarg);
1417 if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
1418 proc_id = atoi(optarg);
1426 fprintf(stderr, "Invalid option: %s\n", argv[optind]);
1427 rte_exit(EXIT_FAILURE,
1428 "Command line is incomplete or incorrect\n");
1433 if (optind != argc) {
1435 fprintf(stderr, "Invalid parameter: %s\n", argv[optind]);
1436 rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
1439 /* Set offload configuration from command line parameters. */
1440 rx_mode.offloads = rx_offloads;
1441 tx_mode.offloads = tx_offloads;
1443 if (mempool_flags & RTE_MEMPOOL_F_NO_IOVA_CONTIG &&
1444 mp_alloc_type != MP_ALLOC_ANON) {
1445 TESTPMD_LOG(WARNING, "cannot use no-iova-contig without "
1446 "mp-alloc=anon. mempool no-iova-contig is "