1174a1631SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2174a1631SBruce Richardson * Copyright(c) 2010-2017 Intel Corporation 3af75078fSIntel */ 4af75078fSIntel 5af75078fSIntel #include <errno.h> 6af75078fSIntel #include <getopt.h> 7af75078fSIntel #include <stdarg.h> 8af75078fSIntel #include <stdio.h> 9af75078fSIntel #include <stdlib.h> 10af75078fSIntel #include <signal.h> 11af75078fSIntel #include <string.h> 12af75078fSIntel #include <time.h> 13af75078fSIntel #include <fcntl.h> 14af75078fSIntel #include <sys/types.h> 15af75078fSIntel 16af75078fSIntel #include <sys/queue.h> 17af75078fSIntel #include <sys/stat.h> 18af75078fSIntel 19af75078fSIntel #include <stdint.h> 20af75078fSIntel #include <unistd.h> 21af75078fSIntel #include <inttypes.h> 22af75078fSIntel 23af75078fSIntel #include <rte_common.h> 24af75078fSIntel #include <rte_byteorder.h> 25af75078fSIntel #include <rte_log.h> 26af75078fSIntel #include <rte_debug.h> 27af75078fSIntel #include <rte_cycles.h> 28af75078fSIntel #include <rte_memory.h> 29af75078fSIntel #include <rte_launch.h> 30af75078fSIntel #include <rte_eal.h> 31af75078fSIntel #include <rte_per_lcore.h> 32af75078fSIntel #include <rte_lcore.h> 33af75078fSIntel #include <rte_branch_prediction.h> 34af75078fSIntel #include <rte_mempool.h> 35af75078fSIntel #include <rte_interrupts.h> 36af75078fSIntel #include <rte_ether.h> 37af75078fSIntel #include <rte_ethdev.h> 38af75078fSIntel #include <rte_string_fns.h> 39938a184aSAdrien Mazarguil #include <rte_flow.h> 40af75078fSIntel 41af75078fSIntel #include "testpmd.h" 42af75078fSIntel 4390c26386SDavid Marchand enum { 4490c26386SDavid Marchand #define TESTPMD_OPT_AUTO_START "auto-start" 4590c26386SDavid Marchand TESTPMD_OPT_AUTO_START_NUM = 'a', 4690c26386SDavid Marchand #define TESTPMD_OPT_HELP "help" 4790c26386SDavid Marchand TESTPMD_OPT_HELP_NUM = 'h', 4890c26386SDavid Marchand #define TESTPMD_OPT_INTERACTIVE "interactive" 4990c26386SDavid Marchand TESTPMD_OPT_INTERACTIVE_NUM = 'i', 5090c26386SDavid Marchand 5190c26386SDavid Marchand TESTPMD_OPT_LONG_MIN_NUM = 256, 5290c26386SDavid Marchand #define TESTPMD_OPT_CMDLINE_FILE "cmdline-file" 5390c26386SDavid Marchand TESTPMD_OPT_CMDLINE_FILE_NUM, 5490c26386SDavid Marchand #define TESTPMD_OPT_ETH_PEERS_CONFIGFILE "eth-peers-configfile" 5590c26386SDavid Marchand TESTPMD_OPT_ETH_PEERS_CONFIGFILE_NUM, 5690c26386SDavid Marchand #define TESTPMD_OPT_ETH_PEER "eth-peer" 5790c26386SDavid Marchand TESTPMD_OPT_ETH_PEER_NUM, 5890c26386SDavid Marchand #define TESTPMD_OPT_TX_FIRST "tx-first" 5990c26386SDavid Marchand TESTPMD_OPT_TX_FIRST_NUM, 6090c26386SDavid Marchand #define TESTPMD_OPT_STATS_PERIOD "stats-period" 6190c26386SDavid Marchand TESTPMD_OPT_STATS_PERIOD_NUM, 6290c26386SDavid Marchand #define TESTPMD_OPT_DISPLAY_XSTATS "display-xstats" 6390c26386SDavid Marchand TESTPMD_OPT_DISPLAY_XSTATS_NUM, 6490c26386SDavid Marchand #define TESTPMD_OPT_NB_CORES "nb-cores" 6590c26386SDavid Marchand TESTPMD_OPT_NB_CORES_NUM, 6690c26386SDavid Marchand #define TESTPMD_OPT_NB_PORTS "nb-ports" 6790c26386SDavid Marchand TESTPMD_OPT_NB_PORTS_NUM, 6890c26386SDavid Marchand #define TESTPMD_OPT_COREMASK "coremask" 6990c26386SDavid Marchand TESTPMD_OPT_COREMASK_NUM, 7090c26386SDavid Marchand #define TESTPMD_OPT_PORTMASK "portmask" 7190c26386SDavid Marchand TESTPMD_OPT_PORTMASK_NUM, 7290c26386SDavid Marchand #define TESTPMD_OPT_PORTLIST "portlist" 7390c26386SDavid Marchand TESTPMD_OPT_PORTLIST_NUM, 7490c26386SDavid Marchand #define TESTPMD_OPT_NUMA "numa" 7590c26386SDavid Marchand TESTPMD_OPT_NUMA_NUM, 7690c26386SDavid Marchand #define TESTPMD_OPT_NO_NUMA "no-numa" 7790c26386SDavid Marchand TESTPMD_OPT_NO_NUMA_NUM, 7890c26386SDavid Marchand #define TESTPMD_OPT_MP_ANON "mp-anon" 7990c26386SDavid Marchand TESTPMD_OPT_MP_ANON_NUM, 8090c26386SDavid Marchand #define TESTPMD_OPT_PORT_NUMA_CONFIG "port-numa-config" 8190c26386SDavid Marchand TESTPMD_OPT_PORT_NUMA_CONFIG_NUM, 8290c26386SDavid Marchand #define TESTPMD_OPT_RING_NUMA_CONFIG "ring-numa-config" 8390c26386SDavid Marchand TESTPMD_OPT_RING_NUMA_CONFIG_NUM, 8490c26386SDavid Marchand #define TESTPMD_OPT_SOCKET_NUM "socket-num" 8590c26386SDavid Marchand TESTPMD_OPT_SOCKET_NUM_NUM, 8690c26386SDavid Marchand #define TESTPMD_OPT_MBUF_SIZE "mbuf-size" 8790c26386SDavid Marchand TESTPMD_OPT_MBUF_SIZE_NUM, 8890c26386SDavid Marchand #define TESTPMD_OPT_TOTAL_NUM_MBUFS "total-num-mbufs" 8990c26386SDavid Marchand TESTPMD_OPT_TOTAL_NUM_MBUFS_NUM, 9090c26386SDavid Marchand #define TESTPMD_OPT_MAX_PKT_LEN "max-pkt-len" 9190c26386SDavid Marchand TESTPMD_OPT_MAX_PKT_LEN_NUM, 9290c26386SDavid Marchand #define TESTPMD_OPT_MAX_LRO_PKT_SIZE "max-lro-pkt-size" 9390c26386SDavid Marchand TESTPMD_OPT_MAX_LRO_PKT_SIZE_NUM, 9490c26386SDavid Marchand #define TESTPMD_OPT_LATENCYSTATS "latencystats" 9590c26386SDavid Marchand TESTPMD_OPT_LATENCYSTATS_NUM, 9690c26386SDavid Marchand #define TESTPMD_OPT_BITRATE_STATS "bitrate-stats" 9790c26386SDavid Marchand TESTPMD_OPT_BITRATE_STATS_NUM, 9890c26386SDavid Marchand #define TESTPMD_OPT_DISABLE_CRC_STRIP "disable-crc-strip" 9990c26386SDavid Marchand TESTPMD_OPT_DISABLE_CRC_STRIP_NUM, 10090c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_LRO "enable-lro" 10190c26386SDavid Marchand TESTPMD_OPT_ENABLE_LRO_NUM, 10290c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_RX_CKSUM "enable-rx-cksum" 10390c26386SDavid Marchand TESTPMD_OPT_ENABLE_RX_CKSUM_NUM, 10490c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_RX_TIMESTAMP "enable-rx-timestamp" 10590c26386SDavid Marchand TESTPMD_OPT_ENABLE_RX_TIMESTAMP_NUM, 10690c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_SCATTER "enable-scatter" 10790c26386SDavid Marchand TESTPMD_OPT_ENABLE_SCATTER_NUM, 10890c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_HW_VLAN "enable-hw-vlan" 10990c26386SDavid Marchand TESTPMD_OPT_ENABLE_HW_VLAN_NUM, 11090c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_HW_VLAN_FILTER "enable-hw-vlan-filter" 11190c26386SDavid Marchand TESTPMD_OPT_ENABLE_HW_VLAN_FILTER_NUM, 11290c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_HW_VLAN_STRIP "enable-hw-vlan-strip" 11390c26386SDavid Marchand TESTPMD_OPT_ENABLE_HW_VLAN_STRIP_NUM, 11490c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_HW_VLAN_EXTEND "enable-hw-vlan-extend" 11590c26386SDavid Marchand TESTPMD_OPT_ENABLE_HW_VLAN_EXTEND_NUM, 11690c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_HW_QINQ_STRIP "enable-hw-qinq-strip" 11790c26386SDavid Marchand TESTPMD_OPT_ENABLE_HW_QINQ_STRIP_NUM, 11890c26386SDavid Marchand #define TESTPMD_OPT_ENABLE_DROP_EN "enable-drop-en" 11990c26386SDavid Marchand TESTPMD_OPT_ENABLE_DROP_EN_NUM, 12090c26386SDavid Marchand #define TESTPMD_OPT_DISABLE_RSS "disable-rss" 12190c26386SDavid Marchand TESTPMD_OPT_DISABLE_RSS_NUM, 12290c26386SDavid Marchand #define TESTPMD_OPT_PORT_TOPOLOGY "port-topology" 12390c26386SDavid Marchand TESTPMD_OPT_PORT_TOPOLOGY_NUM, 12490c26386SDavid Marchand #define TESTPMD_OPT_FORWARD_MODE "forward-mode" 12590c26386SDavid Marchand TESTPMD_OPT_FORWARD_MODE_NUM, 12690c26386SDavid Marchand #define TESTPMD_OPT_RSS_IP "rss-ip" 12790c26386SDavid Marchand TESTPMD_OPT_RSS_IP_NUM, 12890c26386SDavid Marchand #define TESTPMD_OPT_RSS_UDP "rss-udp" 12990c26386SDavid Marchand TESTPMD_OPT_RSS_UDP_NUM, 13090c26386SDavid Marchand #define TESTPMD_OPT_RSS_LEVEL_OUTER "rss-level-outer" 13190c26386SDavid Marchand TESTPMD_OPT_RSS_LEVEL_OUTER_NUM, 13290c26386SDavid Marchand #define TESTPMD_OPT_RSS_LEVEL_INNER "rss-level-inner" 13390c26386SDavid Marchand TESTPMD_OPT_RSS_LEVEL_INNER_NUM, 13490c26386SDavid Marchand #define TESTPMD_OPT_RXQ "rxq" 13590c26386SDavid Marchand TESTPMD_OPT_RXQ_NUM, 13690c26386SDavid Marchand #define TESTPMD_OPT_TXQ "txq" 13790c26386SDavid Marchand TESTPMD_OPT_TXQ_NUM, 13890c26386SDavid Marchand #define TESTPMD_OPT_RXD "rxd" 13990c26386SDavid Marchand TESTPMD_OPT_RXD_NUM, 14090c26386SDavid Marchand #define TESTPMD_OPT_TXD "txd" 14190c26386SDavid Marchand TESTPMD_OPT_TXD_NUM, 14290c26386SDavid Marchand #define TESTPMD_OPT_HAIRPINQ "hairpinq" 14390c26386SDavid Marchand TESTPMD_OPT_HAIRPINQ_NUM, 14490c26386SDavid Marchand #define TESTPMD_OPT_HAIRPIN_MODE "hairpin-mode" 14590c26386SDavid Marchand TESTPMD_OPT_HAIRPIN_MODE_NUM, 14690c26386SDavid Marchand #define TESTPMD_OPT_BURST "burst" 14790c26386SDavid Marchand TESTPMD_OPT_BURST_NUM, 14890c26386SDavid Marchand #define TESTPMD_OPT_FLOWGEN_CLONES "flowgen-clones" 14990c26386SDavid Marchand TESTPMD_OPT_FLOWGEN_CLONES_NUM, 15090c26386SDavid Marchand #define TESTPMD_OPT_FLOWGEN_FLOWS "flowgen-flows" 15190c26386SDavid Marchand TESTPMD_OPT_FLOWGEN_FLOWS_NUM, 15290c26386SDavid Marchand #define TESTPMD_OPT_MBCACHE "mbcache" 15390c26386SDavid Marchand TESTPMD_OPT_MBCACHE_NUM, 15490c26386SDavid Marchand #define TESTPMD_OPT_TXPT "txpt" 15590c26386SDavid Marchand TESTPMD_OPT_TXPT_NUM, 15690c26386SDavid Marchand #define TESTPMD_OPT_TXHT "txht" 15790c26386SDavid Marchand TESTPMD_OPT_TXHT_NUM, 15890c26386SDavid Marchand #define TESTPMD_OPT_TXWT "txwt" 15990c26386SDavid Marchand TESTPMD_OPT_TXWT_NUM, 16090c26386SDavid Marchand #define TESTPMD_OPT_TXFREET "txfreet" 16190c26386SDavid Marchand TESTPMD_OPT_TXFREET_NUM, 16290c26386SDavid Marchand #define TESTPMD_OPT_TXRST "txrst" 16390c26386SDavid Marchand TESTPMD_OPT_TXRST_NUM, 16490c26386SDavid Marchand #define TESTPMD_OPT_RXPT "rxpt" 16590c26386SDavid Marchand TESTPMD_OPT_RXPT_NUM, 16690c26386SDavid Marchand #define TESTPMD_OPT_RXHT "rxht" 16790c26386SDavid Marchand TESTPMD_OPT_RXHT_NUM, 16890c26386SDavid Marchand #define TESTPMD_OPT_RXWT "rxwt" 16990c26386SDavid Marchand TESTPMD_OPT_RXWT_NUM, 17090c26386SDavid Marchand #define TESTPMD_OPT_RXFREET "rxfreet" 17190c26386SDavid Marchand TESTPMD_OPT_RXFREET_NUM, 17290c26386SDavid Marchand #define TESTPMD_OPT_NO_FLUSH_RX "no-flush-rx" 17390c26386SDavid Marchand TESTPMD_OPT_NO_FLUSH_RX_NUM, 17490c26386SDavid Marchand #define TESTPMD_OPT_FLOW_ISOLATE_ALL "flow-isolate-all" 17590c26386SDavid Marchand TESTPMD_OPT_FLOW_ISOLATE_ALL_NUM, 17690c26386SDavid Marchand #define TESTPMD_OPT_DISABLE_FLOW_FLUSH "disable-flow-flush" 17790c26386SDavid Marchand TESTPMD_OPT_DISABLE_FLOW_FLUSH_NUM, 17890c26386SDavid Marchand #define TESTPMD_OPT_RXOFFS "rxoffs" 17990c26386SDavid Marchand TESTPMD_OPT_RXOFFS_NUM, 18090c26386SDavid Marchand #define TESTPMD_OPT_RXPKTS "rxpkts" 18190c26386SDavid Marchand TESTPMD_OPT_RXPKTS_NUM, 18290c26386SDavid Marchand #define TESTPMD_OPT_RXHDRS "rxhdrs" 18390c26386SDavid Marchand TESTPMD_OPT_RXHDRS_NUM, 18490c26386SDavid Marchand #define TESTPMD_OPT_TXPKTS "txpkts" 18590c26386SDavid Marchand TESTPMD_OPT_TXPKTS_NUM, 18690c26386SDavid Marchand #define TESTPMD_OPT_MULTI_RX_MEMPOOL "multi-rx-mempool" 18790c26386SDavid Marchand TESTPMD_OPT_MULTI_RX_MEMPOOL_NUM, 18890c26386SDavid Marchand #define TESTPMD_OPT_TXONLY_MULTI_FLOW "txonly-multi-flow" 18990c26386SDavid Marchand TESTPMD_OPT_TXONLY_MULTI_FLOW_NUM, 19090c26386SDavid Marchand #define TESTPMD_OPT_RXQ_SHARE "rxq-share" 19190c26386SDavid Marchand TESTPMD_OPT_RXQ_SHARE_NUM, 19290c26386SDavid Marchand #define TESTPMD_OPT_ETH_LINK_SPEED "eth-link-speed" 19390c26386SDavid Marchand TESTPMD_OPT_ETH_LINK_SPEED_NUM, 19490c26386SDavid Marchand #define TESTPMD_OPT_DISABLE_LINK_CHECK "disable-link-check" 19590c26386SDavid Marchand TESTPMD_OPT_DISABLE_LINK_CHECK_NUM, 19690c26386SDavid Marchand #define TESTPMD_OPT_DISABLE_DEVICE_START "disable-device-start" 19790c26386SDavid Marchand TESTPMD_OPT_DISABLE_DEVICE_START_NUM, 19890c26386SDavid Marchand #define TESTPMD_OPT_NO_LSC_INTERRUPT "no-lsc-interrupt" 19990c26386SDavid Marchand TESTPMD_OPT_NO_LSC_INTERRUPT_NUM, 20090c26386SDavid Marchand #define TESTPMD_OPT_NO_RMV_INTERRUPT "no-rmv-interrupt" 20190c26386SDavid Marchand TESTPMD_OPT_NO_RMV_INTERRUPT_NUM, 20290c26386SDavid Marchand #define TESTPMD_OPT_PRINT_EVENT "print-event" 20390c26386SDavid Marchand TESTPMD_OPT_PRINT_EVENT_NUM, 20490c26386SDavid Marchand #define TESTPMD_OPT_MASK_EVENT "mask-event" 20590c26386SDavid Marchand TESTPMD_OPT_MASK_EVENT_NUM, 20690c26386SDavid Marchand #define TESTPMD_OPT_TX_OFFLOADS "tx-offloads" 20790c26386SDavid Marchand TESTPMD_OPT_TX_OFFLOADS_NUM, 20890c26386SDavid Marchand #define TESTPMD_OPT_RX_OFFLOADS "rx-offloads" 20990c26386SDavid Marchand TESTPMD_OPT_RX_OFFLOADS_NUM, 21090c26386SDavid Marchand #define TESTPMD_OPT_HOT_PLUG "hot-plug" 21190c26386SDavid Marchand TESTPMD_OPT_HOT_PLUG_NUM, 21290c26386SDavid Marchand #define TESTPMD_OPT_VXLAN_GPE_PORT "vxlan-gpe-port" 21390c26386SDavid Marchand TESTPMD_OPT_VXLAN_GPE_PORT_NUM, 21490c26386SDavid Marchand #define TESTPMD_OPT_GENEVE_PARSED_PORT "geneve-parsed-port" 21590c26386SDavid Marchand TESTPMD_OPT_GENEVE_PARSED_PORT_NUM, 21690c26386SDavid Marchand #define TESTPMD_OPT_MLOCKALL "mlockall" 21790c26386SDavid Marchand TESTPMD_OPT_MLOCKALL_NUM, 21890c26386SDavid Marchand #define TESTPMD_OPT_NO_MLOCKALL "no-mlockall" 21990c26386SDavid Marchand TESTPMD_OPT_NO_MLOCKALL_NUM, 22090c26386SDavid Marchand #define TESTPMD_OPT_MP_ALLOC "mp-alloc" 22190c26386SDavid Marchand TESTPMD_OPT_MP_ALLOC_NUM, 22290c26386SDavid Marchand #define TESTPMD_OPT_TX_IP "tx-ip" 22390c26386SDavid Marchand TESTPMD_OPT_TX_IP_NUM, 22490c26386SDavid Marchand #define TESTPMD_OPT_TX_UDP "tx-udp" 22590c26386SDavid Marchand TESTPMD_OPT_TX_UDP_NUM, 22690c26386SDavid Marchand #define TESTPMD_OPT_NOISY_TX_SW_BUFFER_SIZE "noisy-tx-sw-buffer-size" 22790c26386SDavid Marchand TESTPMD_OPT_NOISY_TX_SW_BUFFER_SIZE_NUM, 22890c26386SDavid Marchand #define TESTPMD_OPT_NOISY_TX_SW_BUFFER_FLUSHTIME "noisy-tx-sw-buffer-flushtime" 22990c26386SDavid Marchand TESTPMD_OPT_NOISY_TX_SW_BUFFER_FLUSHTIME_NUM, 23090c26386SDavid Marchand #define TESTPMD_OPT_NOISY_LKUP_MEMORY "noisy-lkup-memory" 23190c26386SDavid Marchand TESTPMD_OPT_NOISY_LKUP_MEMORY_NUM, 23290c26386SDavid Marchand #define TESTPMD_OPT_NOISY_LKUP_NUM_WRITES "noisy-lkup-num-writes" 23390c26386SDavid Marchand TESTPMD_OPT_NOISY_LKUP_NUM_WRITES_NUM, 23490c26386SDavid Marchand #define TESTPMD_OPT_NOISY_LKUP_NUM_READS "noisy-lkup-num-reads" 23590c26386SDavid Marchand TESTPMD_OPT_NOISY_LKUP_NUM_READS_NUM, 23690c26386SDavid Marchand #define TESTPMD_OPT_NOISY_LKUP_NUM_READS_WRITES "noisy-lkup-num-reads-writes" 23790c26386SDavid Marchand TESTPMD_OPT_NOISY_LKUP_NUM_READS_WRITES_NUM, 23890c26386SDavid Marchand #define TESTPMD_OPT_NOISY_FORWARD_MODE "noisy-forward-mode" 23990c26386SDavid Marchand TESTPMD_OPT_NOISY_FORWARD_MODE_NUM, 24090c26386SDavid Marchand #define TESTPMD_OPT_NO_IOVA_CONTIG "no-iova-contig" 24190c26386SDavid Marchand TESTPMD_OPT_NO_IOVA_CONTIG_NUM, 24290c26386SDavid Marchand #define TESTPMD_OPT_RX_MQ_MODE "rx-mq-mode" 24390c26386SDavid Marchand TESTPMD_OPT_RX_MQ_MODE_NUM, 24490c26386SDavid Marchand #define TESTPMD_OPT_RECORD_CORE_CYCLES "record-core-cycles" 24590c26386SDavid Marchand TESTPMD_OPT_RECORD_CORE_CYCLES_NUM, 24690c26386SDavid Marchand #define TESTPMD_OPT_RECORD_BURST_STATS "record-burst-stats" 24790c26386SDavid Marchand TESTPMD_OPT_RECORD_BURST_STATS_NUM, 24890c26386SDavid Marchand #define TESTPMD_OPT_NUM_PROCS "num-procs" 24990c26386SDavid Marchand TESTPMD_OPT_NUM_PROCS_NUM, 25090c26386SDavid Marchand #define TESTPMD_OPT_PROC_ID "proc-id" 25190c26386SDavid Marchand TESTPMD_OPT_PROC_ID_NUM, 25290c26386SDavid Marchand 25390c26386SDavid Marchand TESTPMD_OPT_LONG_MAX_NUM 25490c26386SDavid Marchand }; 25590c26386SDavid Marchand 25690c26386SDavid Marchand static const char short_options[] = { 25790c26386SDavid Marchand "a" /* auto-start */ 25890c26386SDavid Marchand "h" /* help */ 25990c26386SDavid Marchand "i" /* interactive */ 26090c26386SDavid Marchand }; 26190c26386SDavid Marchand 26290c26386SDavid Marchand #define NO_ARG(opt) { opt, no_argument, NULL, opt ## _NUM } 26390c26386SDavid Marchand #define REQUIRED_ARG(opt) { opt, required_argument, NULL, opt ## _NUM } 26490c26386SDavid Marchand #define OPTIONAL_ARG(opt) { opt, optional_argument, NULL, opt ## _NUM } 26590c26386SDavid Marchand static const struct option long_options[] = { 26690c26386SDavid Marchand NO_ARG(TESTPMD_OPT_AUTO_START), 26790c26386SDavid Marchand NO_ARG(TESTPMD_OPT_HELP), 26890c26386SDavid Marchand NO_ARG(TESTPMD_OPT_INTERACTIVE), 26990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_CMDLINE_FILE), 27090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_ETH_PEERS_CONFIGFILE), 27190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_ETH_PEER), 27290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_TX_FIRST), 27390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_STATS_PERIOD), 27490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_DISPLAY_XSTATS), 27590c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NB_CORES), 27690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NB_PORTS), 27790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_COREMASK), 27890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PORTMASK), 27990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PORTLIST), 28090c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NUMA), 28190c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_NUMA), 28290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_MP_ANON), /* deprecated */ 28390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PORT_NUMA_CONFIG), 28490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RING_NUMA_CONFIG), 28590c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_SOCKET_NUM), 28690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MBUF_SIZE), 28790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TOTAL_NUM_MBUFS), 28890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MAX_PKT_LEN), 28990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MAX_LRO_PKT_SIZE), 29090c26386SDavid Marchand #ifdef RTE_LIB_LATENCYSTATS 29190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_LATENCYSTATS), 29290c26386SDavid Marchand #endif 29390c26386SDavid Marchand #ifdef RTE_LIB_BITRATESTATS 29490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_BITRATE_STATS), 29590c26386SDavid Marchand #endif 29690c26386SDavid Marchand NO_ARG(TESTPMD_OPT_DISABLE_CRC_STRIP), 29790c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_LRO), 29890c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_RX_CKSUM), 29990c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_RX_TIMESTAMP), 30090c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_SCATTER), 30190c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_HW_VLAN), 30290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_HW_VLAN_FILTER), 30390c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_HW_VLAN_STRIP), 30490c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_HW_VLAN_EXTEND), 30590c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_HW_QINQ_STRIP), 30690c26386SDavid Marchand NO_ARG(TESTPMD_OPT_ENABLE_DROP_EN), 30790c26386SDavid Marchand NO_ARG(TESTPMD_OPT_DISABLE_RSS), 30890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PORT_TOPOLOGY), 30990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_FORWARD_MODE), 31090c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RSS_IP), 31190c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RSS_UDP), 31290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RSS_LEVEL_OUTER), 31390c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RSS_LEVEL_INNER), 31490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXQ), 31590c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXQ), 31690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXD), 31790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXD), 31890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_HAIRPINQ), 31990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_HAIRPIN_MODE), 32090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_BURST), 32190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_FLOWGEN_CLONES), 32290c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_FLOWGEN_FLOWS), 32390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MBCACHE), 32490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXPT), 32590c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXHT), 32690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXWT), 32790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXFREET), 32890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXRST), 32990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXPT), 33090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXHT), 33190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXWT), 33290c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXFREET), 33390c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_FLUSH_RX), 33490c26386SDavid Marchand NO_ARG(TESTPMD_OPT_FLOW_ISOLATE_ALL), 33590c26386SDavid Marchand NO_ARG(TESTPMD_OPT_DISABLE_FLOW_FLUSH), 33690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXOFFS), 33790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXPKTS), 33890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RXHDRS), 33990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TXPKTS), 34090c26386SDavid Marchand NO_ARG(TESTPMD_OPT_MULTI_RX_MEMPOOL), 34190c26386SDavid Marchand NO_ARG(TESTPMD_OPT_TXONLY_MULTI_FLOW), 34290c26386SDavid Marchand OPTIONAL_ARG(TESTPMD_OPT_RXQ_SHARE), 34390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_ETH_LINK_SPEED), 34490c26386SDavid Marchand NO_ARG(TESTPMD_OPT_DISABLE_LINK_CHECK), 34590c26386SDavid Marchand NO_ARG(TESTPMD_OPT_DISABLE_DEVICE_START), 34690c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_LSC_INTERRUPT), 34790c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_RMV_INTERRUPT), 34890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PRINT_EVENT), 34990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MASK_EVENT), 35090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TX_OFFLOADS), 35190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RX_OFFLOADS), 35290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_HOT_PLUG), 35390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_VXLAN_GPE_PORT), 35490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_GENEVE_PARSED_PORT), 35590c26386SDavid Marchand #ifndef RTE_EXEC_ENV_WINDOWS 35690c26386SDavid Marchand NO_ARG(TESTPMD_OPT_MLOCKALL), 35790c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_MLOCKALL), 35890c26386SDavid Marchand #endif 35990c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_MP_ALLOC), 36090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TX_IP), 36190c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_TX_UDP), 36290c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_TX_SW_BUFFER_SIZE), 36390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_TX_SW_BUFFER_FLUSHTIME), 36490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_LKUP_MEMORY), 36590c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_LKUP_NUM_WRITES), 36690c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_LKUP_NUM_READS), 36790c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_LKUP_NUM_READS_WRITES), 36890c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NOISY_FORWARD_MODE), 36990c26386SDavid Marchand NO_ARG(TESTPMD_OPT_NO_IOVA_CONTIG), 37090c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_RX_MQ_MODE), 37190c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RECORD_CORE_CYCLES), 37290c26386SDavid Marchand NO_ARG(TESTPMD_OPT_RECORD_BURST_STATS), 37390c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_NUM_PROCS), 37490c26386SDavid Marchand REQUIRED_ARG(TESTPMD_OPT_PROC_ID), 37590c26386SDavid Marchand { 0, 0, NULL, 0 } 37690c26386SDavid Marchand }; 37790c26386SDavid Marchand #undef NO_ARG 37890c26386SDavid Marchand #undef REQUIRED_ARG 37990c26386SDavid Marchand #undef OPTIONAL_ARG 38090c26386SDavid Marchand 381af75078fSIntel static void 382af75078fSIntel usage(char* progname) 383af75078fSIntel { 384c6d527a1SThomas Monjalon printf("\nUsage: %s [EAL options] -- [testpmd options]\n\n", 385af75078fSIntel progname); 3863be52ffcSIntel printf(" --interactive: run in interactive mode.\n"); 38781ef862bSAllain Legacy printf(" --cmdline-file: execute cli commands before startup.\n"); 388ca7feb22SCyril Chemparathy printf(" --auto-start: start forwarding on init " 389ca7feb22SCyril Chemparathy "[always when non-interactive].\n"); 3903be52ffcSIntel printf(" --help: display this message and quit.\n"); 39199cabef0SPablo de Lara printf(" --tx-first: start forwarding sending a burst first " 39299cabef0SPablo de Lara "(only if interactive is disabled).\n"); 393cfea1f30SPablo de Lara printf(" --stats-period=PERIOD: statistics will be shown " 394cfea1f30SPablo de Lara "every PERIOD seconds (only if interactive is disabled).\n"); 39563b72657SIvan Ilchenko printf(" --display-xstats xstat_name1[,...]: comma-separated list of " 39663b72657SIvan Ilchenko "extended statistics to show. Used with --stats-period " 39763b72657SIvan Ilchenko "specified or interactive commands that show Rx/Tx statistics " 39863b72657SIvan Ilchenko "(i.e. 'show port stats').\n"); 39948588943SHuisong Li printf(" --num-procs=N: set the total number of multi-process instances.\n"); 40048588943SHuisong Li printf(" --proc-id=id: set the id of the current process from " 40148588943SHuisong Li "multi-process instances (0 <= id < num-procs).\n"); 4023be52ffcSIntel printf(" --nb-cores=N: set the number of forwarding cores " 4033be52ffcSIntel "(1 <= N <= %d).\n", nb_lcores); 4043be52ffcSIntel printf(" --nb-ports=N: set the number of forwarding ports " 4053be52ffcSIntel "(1 <= N <= %d).\n", nb_ports); 406af75078fSIntel printf(" --coremask=COREMASK: hexadecimal bitmask of cores running " 407cb056611SStephen Hemminger "the packet forwarding test. The main lcore is reserved for " 4083be52ffcSIntel "command line parsing only, and cannot be masked on for " 4093be52ffcSIntel "packet forwarding.\n"); 410af75078fSIntel printf(" --portmask=PORTMASK: hexadecimal bitmask of ports used " 4113be52ffcSIntel "by the packet forwarding test.\n"); 4122df00d56SHariprasad Govindharajan printf(" --portlist=PORTLIST: list of forwarding ports\n"); 413af75078fSIntel printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of " 4143be52ffcSIntel "RX memory buffers (mbufs).\n"); 415c6d527a1SThomas Monjalon printf(" --no-numa: disable NUMA-aware allocation.\n"); 416b6ea6408SIntel printf(" --port-numa-config=(port,socket)[,(port,socket)]: " 417b6ea6408SIntel "specify the socket on which the memory pool " 418b6ea6408SIntel "used by the port will be allocated.\n"); 419b6ea6408SIntel printf(" --ring-numa-config=(port,flag,socket)[,(port,flag,socket)]: " 420b6ea6408SIntel "specify the socket on which the TX/RX rings for " 421b6ea6408SIntel "the port will be allocated " 422b6ea6408SIntel "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n"); 423b6ea6408SIntel printf(" --socket-num=N: set socket from which all memory is allocated " 424b6ea6408SIntel "in NUMA mode.\n"); 42526cbb419SViacheslav Ovsiienko printf(" --mbuf-size=N,[N1[,..Nn]: set the data size of mbuf to " 42626cbb419SViacheslav Ovsiienko "N bytes. If multiple numbers are specified the extra pools " 427a4bf5421SHanumanth Pothula "will be created to receive packets based on the features " 428a4bf5421SHanumanth Pothula "supported, like packet split, multi-rx-mempool.\n"); 4293be52ffcSIntel printf(" --total-num-mbufs=N: set the number of mbufs to be allocated " 4303be52ffcSIntel "in mbuf pools.\n"); 4313be52ffcSIntel printf(" --max-pkt-len=N: set the maximum size of packet to N bytes.\n"); 4324a729092SDekel Peled printf(" --max-lro-pkt-size=N: set the maximum LRO aggregated packet " 4334a729092SDekel Peled "size to N bytes.\n"); 4343be52ffcSIntel printf(" --eth-peers-configfile=name: config file with ethernet addresses " 4353be52ffcSIntel "of peer ports.\n"); 4363be52ffcSIntel printf(" --eth-peer=X,M:M:M:M:M:M: set the MAC address of the X peer " 4373be52ffcSIntel "port (0 <= X < %d).\n", RTE_MAX_ETHPORTS); 43879dd163fSJeff Guo printf(" --disable-crc-strip: disable CRC stripping by hardware.\n"); 439c6d527a1SThomas Monjalon printf(" --enable-scatter: enable scattered Rx.\n"); 4404c3ea508SOlivier Matz printf(" --enable-lro: enable large receive offload.\n"); 4413be52ffcSIntel printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n"); 442912267a3SRaslan Darawsheh printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n"); 4438b9bd0efSMoti Haimovsky printf(" --enable-hw-vlan: enable hardware vlan.\n"); 4448b9bd0efSMoti Haimovsky printf(" --enable-hw-vlan-filter: enable hardware vlan filter.\n"); 4458b9bd0efSMoti Haimovsky printf(" --enable-hw-vlan-strip: enable hardware vlan strip.\n"); 4468b9bd0efSMoti Haimovsky printf(" --enable-hw-vlan-extend: enable hardware vlan extend.\n"); 447b8577876SVivek Sharma printf(" --enable-hw-qinq-strip: enable hardware qinq strip.\n"); 4483be52ffcSIntel printf(" --enable-drop-en: enable per queue packet drop.\n"); 4493be52ffcSIntel printf(" --disable-rss: disable rss.\n"); 450e71df49eSCiara Power printf(" --port-topology=<paired|chained|loop>: set port topology (paired " 451e71df49eSCiara Power "is default).\n"); 452769ce6b1SThomas Monjalon printf(" --forward-mode=N: set forwarding mode (N: %s).\n", 453769ce6b1SThomas Monjalon list_pkt_forwarding_modes()); 4542564abdaSShiri Kuzin printf(" --forward-mode=5tswap: set forwarding mode to " 4552564abdaSShiri Kuzin "swap L2,L3,L4 for MAC, IPv4/IPv6 and TCP/UDP only.\n"); 4563be52ffcSIntel printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n"); 4573be52ffcSIntel printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n"); 45894198f40SKiran Kumar K printf(" --rss-level-inner: set RSS hash level to innermost\n"); 45994198f40SKiran Kumar K printf(" --rss-level-outer: set RSS hash level to outermost\n"); 4603be52ffcSIntel printf(" --rxq=N: set the number of RX queues per port to N.\n"); 4613be52ffcSIntel printf(" --rxd=N: set the number of descriptors in RX rings to N.\n"); 4623be52ffcSIntel printf(" --txq=N: set the number of TX queues per port to N.\n"); 4633be52ffcSIntel printf(" --txd=N: set the number of descriptors in TX rings to N.\n"); 4641c69df45SOri Kam printf(" --hairpinq=N: set the number of hairpin queues per port to " 4651c69df45SOri Kam "N.\n"); 4663be52ffcSIntel printf(" --burst=N: set the number of packets per burst to N.\n"); 4676c02043eSIgor Russkikh printf(" --flowgen-clones=N: set the number of single packet clones to send in flowgen mode. Should be less than burst value.\n"); 468861e7684SZhihong Wang printf(" --flowgen-flows=N: set the number of flows in flowgen mode to N (1 <= N <= INT32_MAX).\n"); 4693be52ffcSIntel printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n"); 47057af3415SPablo de Lara printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n"); 47157af3415SPablo de Lara printf(" --rxht=N: set the host threshold register of RX rings to N.\n"); 4723be52ffcSIntel printf(" --rxfreet=N: set the free threshold of RX descriptors to N " 4733be52ffcSIntel "(0 <= N < value of rxd).\n"); 47457af3415SPablo de Lara printf(" --rxwt=N: set the write-back threshold register of RX rings to N.\n"); 47557af3415SPablo de Lara printf(" --txpt=N: set the prefetch threshold register of TX rings to N.\n"); 47657af3415SPablo de Lara printf(" --txht=N: set the nhost threshold register of TX rings to N.\n"); 47757af3415SPablo de Lara printf(" --txwt=N: set the write-back threshold register of TX rings to N.\n"); 4783be52ffcSIntel printf(" --txfreet=N: set the transmit free threshold of TX rings to N " 4793be52ffcSIntel "(0 <= N <= value of txd).\n"); 4803be52ffcSIntel printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " 4813be52ffcSIntel "(0 <= N <= value of txd).\n"); 4825e2ee196SIntel printf(" --no-flush-rx: Don't flush RX streams before forwarding." 4835e2ee196SIntel " Used mainly with PCAP drivers.\n"); 48491c78e09SViacheslav Ovsiienko printf(" --rxoffs=X[,Y]*: set RX segment offsets for split.\n"); 4850f2096d7SViacheslav Ovsiienko printf(" --rxpkts=X[,Y]*: set RX segment sizes to split.\n"); 48652e2e7edSYuan Wang printf(" --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n"); 4872ebacaa7SMaciej Czekaj printf(" --txpkts=X[,Y]*: set TX segment sizes" 4882ebacaa7SMaciej Czekaj " or total packet length.\n"); 489a4bf5421SHanumanth Pothula printf(" --multi-rx-mempool: enable multi-rx-mempool support\n"); 49082010ef5SYongseok Koh printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n"); 491c6d527a1SThomas Monjalon printf(" --tx-ip=src,dst: IP addresses in Tx-only mode\n"); 492c6d527a1SThomas Monjalon printf(" --tx-udp=src[,dst]: UDP ports in Tx-only mode\n"); 493b7b78a08SAjit Khaparde printf(" --eth-link-speed: force link speed.\n"); 494f4d178c1SXueming Li printf(" --rxq-share=X: number of ports per shared Rx queue groups, defaults to UINT32_MAX (1 group)\n"); 495bc202406SDavid Marchand printf(" --disable-link-check: disable check on link status when " 496bc202406SDavid Marchand "starting/stopping ports.\n"); 4976937d210SStephen Hemminger printf(" --disable-device-start: do not automatically start port\n"); 4988ea656f8SGaetan Rivet printf(" --no-lsc-interrupt: disable link status change interrupt.\n"); 499e25e6c70SRemy Horton printf(" --no-rmv-interrupt: disable device removal interrupt.\n"); 500e96491cbSStephen Hemminger #ifdef RTE_LIB_BITRATESTATS 501e25e6c70SRemy Horton printf(" --bitrate-stats=N: set the logical core N to perform " 502e25e6c70SRemy Horton "bit-rate calculation.\n"); 503e96491cbSStephen Hemminger #endif 504e96491cbSStephen Hemminger #ifdef RTE_LIB_LATENCYSTATS 505e96491cbSStephen Hemminger printf(" --latencystats=N: enable latency and jitter statistics " 506e96491cbSStephen Hemminger "monitoring on forwarding lcore id N.\n"); 507e96491cbSStephen Hemminger #endif 508eb0d471aSKalesh AP printf(" --print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|err_recovering|recovery_success|recovery_failed|all>: " 509776ecd42SWenzhuo Lu "enable print of designated event or all of them.\n"); 510eb0d471aSKalesh AP printf(" --mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|flow_aged|err_recovering|recovery_success|recovery_failed||all>: " 511776ecd42SWenzhuo Lu "disable print of designated event or all of them.\n"); 5127ee3e944SVasily Philipov printf(" --flow-isolate-all: " 513776ecd42SWenzhuo Lu "requests flow API isolated mode on all ports at initialization time.\n"); 514543df472SChengwen Feng printf(" --disable-flow-flush: disable port flow flush when stop port.\n"); 515fd8c20aaSShahaf Shuler printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); 516fb1a5a0fSVivek Sharma printf(" --rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads\n"); 517fb73e096SJeff Guo printf(" --hot-plug: enable hot plug for device.\n"); 51839e5e20fSXueming Li printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n"); 5192f60c649SOphir Munk printf(" --geneve-parsed-port=N: UPD port to parse GENEVE tunnel protocol\n"); 520761f7ae1SJie Zhou #ifndef RTE_EXEC_ENV_WINDOWS 521e505d84cSAnatoly Burakov printf(" --mlockall: lock all memory\n"); 522e505d84cSAnatoly Burakov printf(" --no-mlockall: do not lock all memory\n"); 523761f7ae1SJie Zhou #endif 524c7f5dba7SAnatoly Burakov printf(" --mp-alloc <native|anon|xmem|xmemhuge>: mempool allocation method.\n" 525c7f5dba7SAnatoly Burakov " native: use regular DPDK memory to create and populate mempool\n" 526c7f5dba7SAnatoly Burakov " anon: use regular DPDK memory to create and anonymous memory to populate mempool\n" 527c7f5dba7SAnatoly Burakov " xmem: use anonymous memory to create and populate mempool\n" 528c7f5dba7SAnatoly Burakov " xmemhuge: use anonymous hugepage memory to create and populate mempool\n"); 5291d343c19SMike Pattrick printf(" --noisy-forward-mode=<io|mac|macswap|5tswap>: set the sub-fwd mode, defaults to io\n"); 5303c156061SJens Freimann printf(" --noisy-tx-sw-buffer-size=N: size of FIFO buffer\n"); 5313c156061SJens Freimann printf(" --noisy-tx-sw-buffer-flushtime=N: flush FIFO after N ms\n"); 5323c156061SJens Freimann printf(" --noisy-lkup-memory=N: allocate N MB of VNF memory\n"); 5333c156061SJens Freimann printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n"); 5343c156061SJens Freimann printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n"); 535c6d527a1SThomas Monjalon printf(" --noisy-lkup-num-reads-writes=N: do N random reads and writes per packet\n"); 53659fcf854SShahaf Shuler printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. " 53759fcf854SShahaf Shuler "valid only with --mp-alloc=anon\n"); 538f9295aa2SXiaoyu Min printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be " 539f9295aa2SXiaoyu Min "enabled\n"); 540bc700b67SDharmik Thakkar printf(" --record-core-cycles: enable measurement of CPU cycles.\n"); 5410e4b1963SDharmik Thakkar printf(" --record-burst-stats: enable display of RX and TX bursts.\n"); 54201817b10SBing Zhao printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n" 54301817b10SBing Zhao " 0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n" 54401817b10SBing Zhao " 0x01 - hairpin ports loop, 0x00 - hairpin port self\n"); 545af75078fSIntel } 546af75078fSIntel 547af75078fSIntel static int 548761f7ae1SJie Zhou init_peer_eth_addrs(const char *config_filename) 549af75078fSIntel { 550af75078fSIntel FILE *config_file; 551af75078fSIntel portid_t i; 552af75078fSIntel char buf[50]; 553af75078fSIntel 554af75078fSIntel config_file = fopen(config_filename, "r"); 555af75078fSIntel if (config_file == NULL) { 5563be52ffcSIntel perror("Failed to open eth config file\n"); 557af75078fSIntel return -1; 558af75078fSIntel } 559af75078fSIntel 560af75078fSIntel for (i = 0; i < RTE_MAX_ETHPORTS; i++) { 561af75078fSIntel 562af75078fSIntel if (fgets(buf, sizeof(buf), config_file) == NULL) 563af75078fSIntel break; 564af75078fSIntel 565b5ddce89SStephen Hemminger if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) { 56661a3b0e5SAndrew Rybchenko fprintf(stderr, "Bad MAC address format on line %d\n", 56761a3b0e5SAndrew Rybchenko i + 1); 568af75078fSIntel fclose(config_file); 569af75078fSIntel return -1; 570af75078fSIntel } 571af75078fSIntel } 572af75078fSIntel fclose(config_file); 573af75078fSIntel nb_peer_eth_addrs = (portid_t) i; 574af75078fSIntel return 0; 575af75078fSIntel } 576af75078fSIntel 577af75078fSIntel /* 578af75078fSIntel * Parse the coremask given as argument (hexadecimal string) and set 579af75078fSIntel * the global configuration of forwarding cores. 580af75078fSIntel */ 581af75078fSIntel static void 582af75078fSIntel parse_fwd_coremask(const char *coremask) 583af75078fSIntel { 584af75078fSIntel char *end; 585af75078fSIntel unsigned long long int cm; 586af75078fSIntel 587af75078fSIntel /* parse hexadecimal string */ 588af75078fSIntel end = NULL; 589af75078fSIntel cm = strtoull(coremask, &end, 16); 590af75078fSIntel if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0')) 591af75078fSIntel rte_exit(EXIT_FAILURE, "Invalid fwd core mask\n"); 592013af9b6SIntel else if (set_fwd_lcores_mask((uint64_t) cm) < 0) 593013af9b6SIntel rte_exit(EXIT_FAILURE, "coremask is not valid\n"); 594af75078fSIntel } 595af75078fSIntel 596af75078fSIntel /* 597af75078fSIntel * Parse the coremask given as argument (hexadecimal string) and set 598af75078fSIntel * the global configuration of forwarding cores. 599af75078fSIntel */ 600af75078fSIntel static void 601af75078fSIntel parse_fwd_portmask(const char *portmask) 602af75078fSIntel { 603af75078fSIntel char *end; 604af75078fSIntel unsigned long long int pm; 605af75078fSIntel 606af75078fSIntel /* parse hexadecimal string */ 607af75078fSIntel end = NULL; 608af75078fSIntel pm = strtoull(portmask, &end, 16); 609af75078fSIntel if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) 610af75078fSIntel rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n"); 611af75078fSIntel else 612af75078fSIntel set_fwd_ports_mask((uint64_t) pm); 613af75078fSIntel } 614af75078fSIntel 615c9cafcc8SShahaf Shuler static void 616c9cafcc8SShahaf Shuler print_invalid_socket_id_error(void) 617c9cafcc8SShahaf Shuler { 618c9cafcc8SShahaf Shuler unsigned int i = 0; 619c9cafcc8SShahaf Shuler 62061a3b0e5SAndrew Rybchenko fprintf(stderr, "Invalid socket id, options are: "); 621c9cafcc8SShahaf Shuler for (i = 0; i < num_sockets; i++) { 62261a3b0e5SAndrew Rybchenko fprintf(stderr, "%u%s", socket_ids[i], 623c9cafcc8SShahaf Shuler (i == num_sockets - 1) ? "\n" : ","); 624c9cafcc8SShahaf Shuler } 625c9cafcc8SShahaf Shuler } 626c9cafcc8SShahaf Shuler 627b6ea6408SIntel static int 628b6ea6408SIntel parse_portnuma_config(const char *q_arg) 629b6ea6408SIntel { 630b6ea6408SIntel char s[256]; 631b6ea6408SIntel const char *p, *p0 = q_arg; 632b6ea6408SIntel char *end; 633d1f1a0fdSLi Han uint8_t i, socket_id; 634d1f1a0fdSLi Han portid_t port_id; 635b6ea6408SIntel unsigned size; 636b6ea6408SIntel enum fieldnames { 637b6ea6408SIntel FLD_PORT = 0, 638b6ea6408SIntel FLD_SOCKET, 639b6ea6408SIntel _NUM_FLD 640b6ea6408SIntel }; 641b6ea6408SIntel unsigned long int_fld[_NUM_FLD]; 642b6ea6408SIntel char *str_fld[_NUM_FLD]; 643b6ea6408SIntel 644b6ea6408SIntel /* reset from value set at definition */ 645b6ea6408SIntel while ((p = strchr(p0,'(')) != NULL) { 646b6ea6408SIntel ++p; 647b6ea6408SIntel if((p0 = strchr(p,')')) == NULL) 648b6ea6408SIntel return -1; 649b6ea6408SIntel 650b6ea6408SIntel size = p0 - p; 651b6ea6408SIntel if(size >= sizeof(s)) 652b6ea6408SIntel return -1; 653b6ea6408SIntel 6546f41fe75SStephen Hemminger snprintf(s, sizeof(s), "%.*s", size, p); 655b6ea6408SIntel if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) 656b6ea6408SIntel return -1; 657b6ea6408SIntel for (i = 0; i < _NUM_FLD; i++) { 658b6ea6408SIntel errno = 0; 659b6ea6408SIntel int_fld[i] = strtoul(str_fld[i], &end, 0); 660b6ea6408SIntel if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) 661b6ea6408SIntel return -1; 662b6ea6408SIntel } 663d1f1a0fdSLi Han port_id = (portid_t)int_fld[FLD_PORT]; 664d1f1a0fdSLi Han if (port_id_is_invalid(port_id, ENABLED_WARN) || 665d1f1a0fdSLi Han port_id == (portid_t)RTE_PORT_ALL) { 6668f3c4176SMatan Azrad print_valid_ports(); 667b6ea6408SIntel return -1; 668b6ea6408SIntel } 669b6ea6408SIntel socket_id = (uint8_t)int_fld[FLD_SOCKET]; 670c9cafcc8SShahaf Shuler if (new_socket_id(socket_id)) { 671a569af24SPhil Yang if (num_sockets >= RTE_MAX_NUMA_NODES) { 672c9cafcc8SShahaf Shuler print_invalid_socket_id_error(); 673b6ea6408SIntel return -1; 674b6ea6408SIntel } 675a569af24SPhil Yang socket_ids[num_sockets++] = socket_id; 676a569af24SPhil Yang } 677b6ea6408SIntel port_numa[port_id] = socket_id; 678b6ea6408SIntel } 679b6ea6408SIntel 680b6ea6408SIntel return 0; 681b6ea6408SIntel } 682b6ea6408SIntel 683b6ea6408SIntel static int 684b6ea6408SIntel parse_ringnuma_config(const char *q_arg) 685b6ea6408SIntel { 686b6ea6408SIntel char s[256]; 687b6ea6408SIntel const char *p, *p0 = q_arg; 688b6ea6408SIntel char *end; 689d1f1a0fdSLi Han uint8_t i, ring_flag, socket_id; 690d1f1a0fdSLi Han portid_t port_id; 691b6ea6408SIntel unsigned size; 692b6ea6408SIntel enum fieldnames { 693b6ea6408SIntel FLD_PORT = 0, 694b6ea6408SIntel FLD_FLAG, 695b6ea6408SIntel FLD_SOCKET, 696b6ea6408SIntel _NUM_FLD 697b6ea6408SIntel }; 698b6ea6408SIntel unsigned long int_fld[_NUM_FLD]; 699b6ea6408SIntel char *str_fld[_NUM_FLD]; 700b6ea6408SIntel #define RX_RING_ONLY 0x1 701b6ea6408SIntel #define TX_RING_ONLY 0x2 702b6ea6408SIntel #define RXTX_RING 0x3 703b6ea6408SIntel 704b6ea6408SIntel /* reset from value set at definition */ 705b6ea6408SIntel while ((p = strchr(p0,'(')) != NULL) { 706b6ea6408SIntel ++p; 707b6ea6408SIntel if((p0 = strchr(p,')')) == NULL) 708b6ea6408SIntel return -1; 709b6ea6408SIntel 710b6ea6408SIntel size = p0 - p; 711b6ea6408SIntel if(size >= sizeof(s)) 712b6ea6408SIntel return -1; 713b6ea6408SIntel 7146f41fe75SStephen Hemminger snprintf(s, sizeof(s), "%.*s", size, p); 715b6ea6408SIntel if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) 716b6ea6408SIntel return -1; 717b6ea6408SIntel for (i = 0; i < _NUM_FLD; i++) { 718b6ea6408SIntel errno = 0; 719b6ea6408SIntel int_fld[i] = strtoul(str_fld[i], &end, 0); 720b6ea6408SIntel if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) 721b6ea6408SIntel return -1; 722b6ea6408SIntel } 723d1f1a0fdSLi Han port_id = (portid_t)int_fld[FLD_PORT]; 724d1f1a0fdSLi Han if (port_id_is_invalid(port_id, ENABLED_WARN) || 725d1f1a0fdSLi Han port_id == (portid_t)RTE_PORT_ALL) { 7268f3c4176SMatan Azrad print_valid_ports(); 727b6ea6408SIntel return -1; 728b6ea6408SIntel } 729b6ea6408SIntel socket_id = (uint8_t)int_fld[FLD_SOCKET]; 730c9cafcc8SShahaf Shuler if (new_socket_id(socket_id)) { 731a569af24SPhil Yang if (num_sockets >= RTE_MAX_NUMA_NODES) { 732c9cafcc8SShahaf Shuler print_invalid_socket_id_error(); 733b6ea6408SIntel return -1; 734b6ea6408SIntel } 735a569af24SPhil Yang socket_ids[num_sockets++] = socket_id; 736a569af24SPhil Yang } 737b6ea6408SIntel ring_flag = (uint8_t)int_fld[FLD_FLAG]; 738b6ea6408SIntel if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) { 73961a3b0e5SAndrew Rybchenko fprintf(stderr, 74061a3b0e5SAndrew Rybchenko "Invalid ring-flag=%d config for port =%d\n", 741b6ea6408SIntel ring_flag,port_id); 742b6ea6408SIntel return -1; 743b6ea6408SIntel } 744b6ea6408SIntel 745b6ea6408SIntel switch (ring_flag & RXTX_RING) { 746b6ea6408SIntel case RX_RING_ONLY: 747b6ea6408SIntel rxring_numa[port_id] = socket_id; 748b6ea6408SIntel break; 749b6ea6408SIntel case TX_RING_ONLY: 750b6ea6408SIntel txring_numa[port_id] = socket_id; 751b6ea6408SIntel break; 752b6ea6408SIntel case RXTX_RING: 753b6ea6408SIntel rxring_numa[port_id] = socket_id; 754b6ea6408SIntel txring_numa[port_id] = socket_id; 755b6ea6408SIntel break; 756b6ea6408SIntel default: 75761a3b0e5SAndrew Rybchenko fprintf(stderr, 75861a3b0e5SAndrew Rybchenko "Invalid ring-flag=%d config for port=%d\n", 759b6ea6408SIntel ring_flag,port_id); 760b6ea6408SIntel break; 761b6ea6408SIntel } 762b6ea6408SIntel } 763b6ea6408SIntel 764b6ea6408SIntel return 0; 765b6ea6408SIntel } 766ed30d9b6SIntel 7673af72783SGaetan Rivet static int 7683af72783SGaetan Rivet parse_event_printing_config(const char *optarg, int enable) 7693af72783SGaetan Rivet { 7703af72783SGaetan Rivet uint32_t mask = 0; 7713af72783SGaetan Rivet 7723af72783SGaetan Rivet if (!strcmp(optarg, "unknown")) 7733af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN; 7743af72783SGaetan Rivet else if (!strcmp(optarg, "intr_lsc")) 7753af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_LSC; 7763af72783SGaetan Rivet else if (!strcmp(optarg, "queue_state")) 7773af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE; 7783af72783SGaetan Rivet else if (!strcmp(optarg, "intr_reset")) 7793af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET; 7803af72783SGaetan Rivet else if (!strcmp(optarg, "vf_mbox")) 7813af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_VF_MBOX; 782badb87c1SAnoob Joseph else if (!strcmp(optarg, "ipsec")) 783badb87c1SAnoob Joseph mask = UINT32_C(1) << RTE_ETH_EVENT_IPSEC; 7843af72783SGaetan Rivet else if (!strcmp(optarg, "macsec")) 7853af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC; 7863af72783SGaetan Rivet else if (!strcmp(optarg, "intr_rmv")) 7873af72783SGaetan Rivet mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV; 7884fb82244SMatan Azrad else if (!strcmp(optarg, "dev_probed")) 7894fb82244SMatan Azrad mask = UINT32_C(1) << RTE_ETH_EVENT_NEW; 7904fb82244SMatan Azrad else if (!strcmp(optarg, "dev_released")) 7914fb82244SMatan Azrad mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY; 7920e459ffaSDong Zhou else if (!strcmp(optarg, "flow_aged")) 7930e459ffaSDong Zhou mask = UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED; 794eb0d471aSKalesh AP else if (!strcmp(optarg, "err_recovering")) 795eb0d471aSKalesh AP mask = UINT32_C(1) << RTE_ETH_EVENT_ERR_RECOVERING; 796eb0d471aSKalesh AP else if (!strcmp(optarg, "recovery_success")) 797eb0d471aSKalesh AP mask = UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_SUCCESS; 798eb0d471aSKalesh AP else if (!strcmp(optarg, "recovery_failed")) 799eb0d471aSKalesh AP mask = UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_FAILED; 800b6b63dfdSGaetan Rivet else if (!strcmp(optarg, "all")) 801b6b63dfdSGaetan Rivet mask = ~UINT32_C(0); 8023af72783SGaetan Rivet else { 8033af72783SGaetan Rivet fprintf(stderr, "Invalid event: %s\n", optarg); 8043af72783SGaetan Rivet return -1; 8053af72783SGaetan Rivet } 8063af72783SGaetan Rivet if (enable) 8073af72783SGaetan Rivet event_print_mask |= mask; 8083af72783SGaetan Rivet else 8093af72783SGaetan Rivet event_print_mask &= ~mask; 8103af72783SGaetan Rivet return 0; 8113af72783SGaetan Rivet } 8123af72783SGaetan Rivet 813b7b78a08SAjit Khaparde static int 81463b72657SIvan Ilchenko parse_xstats_list(const char *in_str, struct rte_eth_xstat_name **xstats, 81563b72657SIvan Ilchenko unsigned int *xstats_num) 81663b72657SIvan Ilchenko { 81763b72657SIvan Ilchenko int max_names_nb, names_nb, nonempty_names_nb; 81863b72657SIvan Ilchenko int name, nonempty_name; 81963b72657SIvan Ilchenko int stringlen; 82063b72657SIvan Ilchenko char **names; 82163b72657SIvan Ilchenko char *str; 82263b72657SIvan Ilchenko int ret; 82363b72657SIvan Ilchenko int i; 82463b72657SIvan Ilchenko 82563b72657SIvan Ilchenko names = NULL; 82663b72657SIvan Ilchenko str = strdup(in_str); 82763b72657SIvan Ilchenko if (str == NULL) { 82863b72657SIvan Ilchenko ret = -ENOMEM; 82963b72657SIvan Ilchenko goto out; 83063b72657SIvan Ilchenko } 83163b72657SIvan Ilchenko stringlen = strlen(str); 83263b72657SIvan Ilchenko 83363b72657SIvan Ilchenko for (i = 0, max_names_nb = 1; str[i] != '\0'; i++) { 83463b72657SIvan Ilchenko if (str[i] == ',') 83563b72657SIvan Ilchenko max_names_nb++; 83663b72657SIvan Ilchenko } 83763b72657SIvan Ilchenko 83863b72657SIvan Ilchenko names = calloc(max_names_nb, sizeof(*names)); 83963b72657SIvan Ilchenko if (names == NULL) { 84063b72657SIvan Ilchenko ret = -ENOMEM; 84163b72657SIvan Ilchenko goto out; 84263b72657SIvan Ilchenko } 84363b72657SIvan Ilchenko 84463b72657SIvan Ilchenko names_nb = rte_strsplit(str, stringlen, names, max_names_nb, ','); 84563b72657SIvan Ilchenko if (names_nb < 0) { 84663b72657SIvan Ilchenko ret = -EINVAL; 84763b72657SIvan Ilchenko goto out; 84863b72657SIvan Ilchenko } 84963b72657SIvan Ilchenko 85063b72657SIvan Ilchenko nonempty_names_nb = 0; 85163b72657SIvan Ilchenko for (i = 0; i < names_nb; i++) { 85263b72657SIvan Ilchenko if (names[i][0] == '\0') 85363b72657SIvan Ilchenko continue; 85463b72657SIvan Ilchenko nonempty_names_nb++; 85563b72657SIvan Ilchenko } 85663b72657SIvan Ilchenko *xstats = calloc(nonempty_names_nb, sizeof(**xstats)); 85763b72657SIvan Ilchenko if (*xstats == NULL) { 85863b72657SIvan Ilchenko ret = -ENOMEM; 85963b72657SIvan Ilchenko goto out; 86063b72657SIvan Ilchenko } 86163b72657SIvan Ilchenko 86263b72657SIvan Ilchenko for (name = nonempty_name = 0; name < names_nb; name++) { 86363b72657SIvan Ilchenko if (names[name][0] == '\0') 86463b72657SIvan Ilchenko continue; 86563b72657SIvan Ilchenko rte_strscpy((*xstats)[nonempty_name].name, names[name], 86663b72657SIvan Ilchenko sizeof((*xstats)[nonempty_name].name)); 86763b72657SIvan Ilchenko nonempty_name++; 86863b72657SIvan Ilchenko } 86963b72657SIvan Ilchenko 87063b72657SIvan Ilchenko *xstats_num = nonempty_names_nb; 87163b72657SIvan Ilchenko ret = 0; 87263b72657SIvan Ilchenko 87363b72657SIvan Ilchenko out: 87463b72657SIvan Ilchenko free(names); 87563b72657SIvan Ilchenko free(str); 87663b72657SIvan Ilchenko return ret; 87763b72657SIvan Ilchenko } 87863b72657SIvan Ilchenko 87963b72657SIvan Ilchenko static int 880b7b78a08SAjit Khaparde parse_link_speed(int n) 881b7b78a08SAjit Khaparde { 882295968d1SFerruh Yigit uint32_t speed = RTE_ETH_LINK_SPEED_FIXED; 883b7b78a08SAjit Khaparde 884b7b78a08SAjit Khaparde switch (n) { 885b7b78a08SAjit Khaparde case 1000: 886295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_1G; 887b7b78a08SAjit Khaparde break; 888d54c7f15SJulien Aube case 2500: 889d54c7f15SJulien Aube speed |= RTE_ETH_LINK_SPEED_2_5G; 890d54c7f15SJulien Aube break; 891d54c7f15SJulien Aube case 5000: 892d54c7f15SJulien Aube speed |= RTE_ETH_LINK_SPEED_5G; 893d54c7f15SJulien Aube break; 894b7b78a08SAjit Khaparde case 10000: 895295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_10G; 896b7b78a08SAjit Khaparde break; 897b7b78a08SAjit Khaparde case 25000: 898295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_25G; 899b7b78a08SAjit Khaparde break; 900b7b78a08SAjit Khaparde case 40000: 901295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_40G; 902b7b78a08SAjit Khaparde break; 903b7b78a08SAjit Khaparde case 50000: 904295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_50G; 905b7b78a08SAjit Khaparde break; 906b7b78a08SAjit Khaparde case 100000: 907295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_100G; 908b7b78a08SAjit Khaparde break; 909b7b78a08SAjit Khaparde case 200000: 910295968d1SFerruh Yigit speed |= RTE_ETH_LINK_SPEED_200G; 911b7b78a08SAjit Khaparde break; 912a131d9ecSThomas Monjalon case 400000: 913a131d9ecSThomas Monjalon speed |= RTE_ETH_LINK_SPEED_400G; 914a131d9ecSThomas Monjalon break; 915b7b78a08SAjit Khaparde case 100: 916b7b78a08SAjit Khaparde case 10: 917b7b78a08SAjit Khaparde default: 91861a3b0e5SAndrew Rybchenko fprintf(stderr, "Unsupported fixed speed\n"); 919b7b78a08SAjit Khaparde return 0; 920b7b78a08SAjit Khaparde } 921b7b78a08SAjit Khaparde 922b7b78a08SAjit Khaparde return speed; 923b7b78a08SAjit Khaparde } 924b7b78a08SAjit Khaparde 925af75078fSIntel void 926af75078fSIntel launch_args_parse(int argc, char** argv) 927af75078fSIntel { 928af75078fSIntel int n, opt; 929af75078fSIntel int opt_idx; 9303f7311baSWei Dai portid_t pid; 931013af9b6SIntel enum { TX, RX }; 932fd8c20aaSShahaf Shuler /* Default offloads for all ports. */ 9330074d02fSShahaf Shuler uint64_t rx_offloads = rx_mode.offloads; 934fd8c20aaSShahaf Shuler uint64_t tx_offloads = tx_mode.offloads; 9358599ed31SRemy Horton struct rte_eth_dev_info dev_info; 9368599ed31SRemy Horton uint16_t rec_nb_pkts; 9376f51deb9SIvan Ilchenko int ret; 938013af9b6SIntel 93990c26386SDavid Marchand while ((opt = getopt_long(argc, argv, short_options, long_options, 94090c26386SDavid Marchand &opt_idx)) != EOF) { 941af75078fSIntel switch (opt) { 942af75078fSIntel case 'i': 943af75078fSIntel printf("Interactive-mode selected\n"); 944af75078fSIntel interactive = 1; 945af75078fSIntel break; 946ca7feb22SCyril Chemparathy case 'a': 947ca7feb22SCyril Chemparathy printf("Auto-start selected\n"); 948ca7feb22SCyril Chemparathy auto_start = 1; 949ca7feb22SCyril Chemparathy break; 95090c26386SDavid Marchand case 'h': 951af75078fSIntel usage(argv[0]); 952487cfc24SThomas Monjalon exit(EXIT_SUCCESS); 95390c26386SDavid Marchand break; 95490c26386SDavid Marchand case TESTPMD_OPT_CMDLINE_FILE_NUM: 95581ef862bSAllain Legacy printf("CLI commands to be read from %s\n", 95681ef862bSAllain Legacy optarg); 957c022cb40SBruce Richardson strlcpy(cmdline_filename, optarg, 958c022cb40SBruce Richardson sizeof(cmdline_filename)); 95990c26386SDavid Marchand break; 96090c26386SDavid Marchand case TESTPMD_OPT_TX_FIRST_NUM: 96199cabef0SPablo de Lara printf("Ports to start sending a burst of " 96299cabef0SPablo de Lara "packets first\n"); 96399cabef0SPablo de Lara tx_first = 1; 96490c26386SDavid Marchand break; 96590c26386SDavid Marchand case TESTPMD_OPT_STATS_PERIOD_NUM: { 966cfea1f30SPablo de Lara char *end = NULL; 967cfea1f30SPablo de Lara unsigned int n; 968cfea1f30SPablo de Lara 969cfea1f30SPablo de Lara n = strtoul(optarg, &end, 10); 970cfea1f30SPablo de Lara if ((optarg[0] == '\0') || (end == NULL) || 971cfea1f30SPablo de Lara (*end != '\0')) 9722ae06c57SDavid Marchand rte_exit(EXIT_FAILURE, "Invalid stats-period value\n"); 973cfea1f30SPablo de Lara 974cfea1f30SPablo de Lara stats_period = n; 975cfea1f30SPablo de Lara break; 976cfea1f30SPablo de Lara } 97790c26386SDavid Marchand case TESTPMD_OPT_DISPLAY_XSTATS_NUM: { 97863b72657SIvan Ilchenko char rc; 97963b72657SIvan Ilchenko 98063b72657SIvan Ilchenko rc = parse_xstats_list(optarg, &xstats_display, 98163b72657SIvan Ilchenko &xstats_display_num); 98263b72657SIvan Ilchenko if (rc != 0) 98363b72657SIvan Ilchenko rte_exit(EXIT_FAILURE, 98463b72657SIvan Ilchenko "Failed to parse display-xstats argument: %d\n", 98563b72657SIvan Ilchenko rc); 98690c26386SDavid Marchand break; 98763b72657SIvan Ilchenko } 98890c26386SDavid Marchand case TESTPMD_OPT_ETH_PEERS_CONFIGFILE_NUM: 989af75078fSIntel if (init_peer_eth_addrs(optarg) != 0) 990af75078fSIntel rte_exit(EXIT_FAILURE, 991af75078fSIntel "Cannot open logfile\n"); 99290c26386SDavid Marchand break; 99390c26386SDavid Marchand case TESTPMD_OPT_ETH_PEER_NUM: { 994af75078fSIntel char *port_end; 995af75078fSIntel 996af75078fSIntel errno = 0; 997af75078fSIntel n = strtoul(optarg, &port_end, 10); 998af75078fSIntel if (errno != 0 || port_end == optarg || *port_end++ != ',') 999af75078fSIntel rte_exit(EXIT_FAILURE, 1000af75078fSIntel "Invalid eth-peer: %s", optarg); 1001af75078fSIntel if (n >= RTE_MAX_ETHPORTS) 1002af75078fSIntel rte_exit(EXIT_FAILURE, 1003af75078fSIntel "eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n", 1004af75078fSIntel n, RTE_MAX_ETHPORTS); 1005af75078fSIntel 1006b5ddce89SStephen Hemminger if (rte_ether_unformat_addr(port_end, 1007b5ddce89SStephen Hemminger &peer_eth_addrs[n]) < 0) 1008af75078fSIntel rte_exit(EXIT_FAILURE, 1009af75078fSIntel "Invalid ethernet address: %s\n", 1010af75078fSIntel port_end); 1011af75078fSIntel nb_peer_eth_addrs++; 101290c26386SDavid Marchand break; 1013af75078fSIntel } 101490c26386SDavid Marchand case TESTPMD_OPT_TX_IP_NUM: { 1015bf5b2126SStephen Hemminger struct in_addr in; 1016bf5b2126SStephen Hemminger char *end; 1017bf5b2126SStephen Hemminger 1018bf5b2126SStephen Hemminger end = strchr(optarg, ','); 1019bf5b2126SStephen Hemminger if (end == optarg || !end) 1020bf5b2126SStephen Hemminger rte_exit(EXIT_FAILURE, 1021bf5b2126SStephen Hemminger "Invalid tx-ip: %s", optarg); 1022bf5b2126SStephen Hemminger 1023bf5b2126SStephen Hemminger *end++ = 0; 1024761f7ae1SJie Zhou if (inet_pton(AF_INET, optarg, &in) == 0) 1025bf5b2126SStephen Hemminger rte_exit(EXIT_FAILURE, 1026bf5b2126SStephen Hemminger "Invalid source IP address: %s\n", 1027bf5b2126SStephen Hemminger optarg); 1028bf5b2126SStephen Hemminger tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr); 1029bf5b2126SStephen Hemminger 1030761f7ae1SJie Zhou if (inet_pton(AF_INET, end, &in) == 0) 1031bf5b2126SStephen Hemminger rte_exit(EXIT_FAILURE, 1032bf5b2126SStephen Hemminger "Invalid destination IP address: %s\n", 1033bf5b2126SStephen Hemminger optarg); 1034bf5b2126SStephen Hemminger tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr); 103590c26386SDavid Marchand break; 1036bf5b2126SStephen Hemminger } 103790c26386SDavid Marchand case TESTPMD_OPT_TX_UDP_NUM: { 1038bf5b2126SStephen Hemminger char *end = NULL; 1039bf5b2126SStephen Hemminger 1040bf5b2126SStephen Hemminger errno = 0; 1041bf5b2126SStephen Hemminger n = strtoul(optarg, &end, 10); 1042bf5b2126SStephen Hemminger if (errno != 0 || end == optarg || 1043bf5b2126SStephen Hemminger n > UINT16_MAX || 1044bf5b2126SStephen Hemminger !(*end == '\0' || *end == ',')) 1045bf5b2126SStephen Hemminger rte_exit(EXIT_FAILURE, 1046bf5b2126SStephen Hemminger "Invalid UDP port: %s\n", 1047bf5b2126SStephen Hemminger optarg); 1048bf5b2126SStephen Hemminger tx_udp_src_port = n; 1049bf5b2126SStephen Hemminger if (*end == ',') { 1050bf5b2126SStephen Hemminger char *dst = end + 1; 1051bf5b2126SStephen Hemminger 1052bf5b2126SStephen Hemminger n = strtoul(dst, &end, 10); 1053bf5b2126SStephen Hemminger if (errno != 0 || end == dst || 1054bf5b2126SStephen Hemminger n > UINT16_MAX || *end) 1055bf5b2126SStephen Hemminger rte_exit(EXIT_FAILURE, 1056bf5b2126SStephen Hemminger "Invalid destination UDP port: %s\n", 1057bf5b2126SStephen Hemminger dst); 1058bf5b2126SStephen Hemminger tx_udp_dst_port = n; 1059bf5b2126SStephen Hemminger } else { 1060bf5b2126SStephen Hemminger tx_udp_dst_port = n; 1061bf5b2126SStephen Hemminger } 106290c26386SDavid Marchand break; 1063bf5b2126SStephen Hemminger } 106490c26386SDavid Marchand case TESTPMD_OPT_NB_PORTS_NUM: 1065af75078fSIntel n = atoi(optarg); 10660a530f0dSYong Liu if (n > 0 && n <= nb_ports) 1067f8244c63SZhiyong Yang nb_fwd_ports = n; 1068af75078fSIntel else 1069af75078fSIntel rte_exit(EXIT_FAILURE, 1070edab33b1STetsuya Mukawa "Invalid port %d\n", n); 107190c26386SDavid Marchand break; 107290c26386SDavid Marchand case TESTPMD_OPT_NB_CORES_NUM: 1073af75078fSIntel n = atoi(optarg); 1074*2bf44dd1SSivaprasad Tummala if (n > 0 && (lcoreid_t)n <= nb_lcores) 1075*2bf44dd1SSivaprasad Tummala nb_fwd_lcores = (lcoreid_t) n; 1076af75078fSIntel else 1077af75078fSIntel rte_exit(EXIT_FAILURE, 1078af75078fSIntel "nb-cores should be > 0 and <= %d\n", 1079af75078fSIntel nb_lcores); 108090c26386SDavid Marchand break; 108190c26386SDavid Marchand case TESTPMD_OPT_COREMASK_NUM: 1082af75078fSIntel parse_fwd_coremask(optarg); 108390c26386SDavid Marchand break; 108490c26386SDavid Marchand case TESTPMD_OPT_PORTMASK_NUM: 1085af75078fSIntel parse_fwd_portmask(optarg); 108690c26386SDavid Marchand break; 108790c26386SDavid Marchand case TESTPMD_OPT_PORTLIST_NUM: 10882df00d56SHariprasad Govindharajan parse_fwd_portlist(optarg); 108990c26386SDavid Marchand break; 109090c26386SDavid Marchand case TESTPMD_OPT_NO_NUMA_NUM: 1091999b2ee0SBruce Richardson numa_support = 0; 109290c26386SDavid Marchand break; 109390c26386SDavid Marchand case TESTPMD_OPT_NUMA_NUM: 1094af75078fSIntel numa_support = 1; 109590c26386SDavid Marchand break; 109690c26386SDavid Marchand case TESTPMD_OPT_MP_ANON_NUM: 1097c7f5dba7SAnatoly Burakov mp_alloc_type = MP_ALLOC_ANON; 109890c26386SDavid Marchand break; 109990c26386SDavid Marchand case TESTPMD_OPT_MP_ALLOC_NUM: 1100c7f5dba7SAnatoly Burakov if (!strcmp(optarg, "native")) 1101c7f5dba7SAnatoly Burakov mp_alloc_type = MP_ALLOC_NATIVE; 1102c7f5dba7SAnatoly Burakov else if (!strcmp(optarg, "anon")) 1103c7f5dba7SAnatoly Burakov mp_alloc_type = MP_ALLOC_ANON; 1104c7f5dba7SAnatoly Burakov else if (!strcmp(optarg, "xmem")) 1105c7f5dba7SAnatoly Burakov mp_alloc_type = MP_ALLOC_XMEM; 1106c7f5dba7SAnatoly Burakov else if (!strcmp(optarg, "xmemhuge")) 1107c7f5dba7SAnatoly Burakov mp_alloc_type = MP_ALLOC_XMEM_HUGE; 110872512e18SViacheslav Ovsiienko else if (!strcmp(optarg, "xbuf")) 110972512e18SViacheslav Ovsiienko mp_alloc_type = MP_ALLOC_XBUF; 1110c7f5dba7SAnatoly Burakov else 1111c7f5dba7SAnatoly Burakov rte_exit(EXIT_FAILURE, 1112c7f5dba7SAnatoly Burakov "mp-alloc %s invalid - must be: " 1113c7f5dba7SAnatoly Burakov "native, anon, xmem or xmemhuge\n", 1114c7f5dba7SAnatoly Burakov optarg); 111590c26386SDavid Marchand break; 111690c26386SDavid Marchand case TESTPMD_OPT_PORT_NUMA_CONFIG_NUM: 1117b6ea6408SIntel if (parse_portnuma_config(optarg)) 1118b6ea6408SIntel rte_exit(EXIT_FAILURE, 1119b6ea6408SIntel "invalid port-numa configuration\n"); 112090c26386SDavid Marchand break; 112190c26386SDavid Marchand case TESTPMD_OPT_RING_NUMA_CONFIG_NUM: 1122b6ea6408SIntel if (parse_ringnuma_config(optarg)) 1123b6ea6408SIntel rte_exit(EXIT_FAILURE, 1124b6ea6408SIntel "invalid ring-numa configuration\n"); 112590c26386SDavid Marchand break; 112690c26386SDavid Marchand case TESTPMD_OPT_SOCKET_NUM_NUM: 1127b6ea6408SIntel n = atoi(optarg); 1128c9cafcc8SShahaf Shuler if (!new_socket_id((uint8_t)n)) { 1129b6ea6408SIntel socket_num = (uint8_t)n; 1130c9cafcc8SShahaf Shuler } else { 1131c9cafcc8SShahaf Shuler print_invalid_socket_id_error(); 1132b6ea6408SIntel rte_exit(EXIT_FAILURE, 1133c9cafcc8SShahaf Shuler "Invalid socket id"); 1134c9cafcc8SShahaf Shuler } 113590c26386SDavid Marchand break; 113690c26386SDavid Marchand case TESTPMD_OPT_MBUF_SIZE_NUM: { 113726cbb419SViacheslav Ovsiienko unsigned int mb_sz[MAX_SEGS_BUFFER_SPLIT]; 113826cbb419SViacheslav Ovsiienko unsigned int nb_segs, i; 113926cbb419SViacheslav Ovsiienko 114026cbb419SViacheslav Ovsiienko nb_segs = parse_item_list(optarg, "mbuf-size", 114126cbb419SViacheslav Ovsiienko MAX_SEGS_BUFFER_SPLIT, mb_sz, 0); 114226cbb419SViacheslav Ovsiienko if (nb_segs <= 0) 1143af75078fSIntel rte_exit(EXIT_FAILURE, 114426cbb419SViacheslav Ovsiienko "bad mbuf-size\n"); 114526cbb419SViacheslav Ovsiienko for (i = 0; i < nb_segs; i++) { 114626cbb419SViacheslav Ovsiienko if (mb_sz[i] <= 0 || mb_sz[i] > 0xFFFF) 114726cbb419SViacheslav Ovsiienko rte_exit(EXIT_FAILURE, 114826cbb419SViacheslav Ovsiienko "mbuf-size should be " 114926cbb419SViacheslav Ovsiienko "> 0 and < 65536\n"); 115026cbb419SViacheslav Ovsiienko mbuf_data_size[i] = (uint16_t) mb_sz[i]; 115126cbb419SViacheslav Ovsiienko } 115226cbb419SViacheslav Ovsiienko mbuf_data_size_n = nb_segs; 115390c26386SDavid Marchand break; 1154af75078fSIntel } 115590c26386SDavid Marchand case TESTPMD_OPT_TOTAL_NUM_MBUFS_NUM: 1156c8798818SIntel n = atoi(optarg); 115757d91f5bSMingxia Liu if (n > MIN_TOTAL_NUM_MBUFS) 115890c26386SDavid Marchand param_total_num_mbufs = (unsigned int)n; 1159c8798818SIntel else 1160c8798818SIntel rte_exit(EXIT_FAILURE, 116157d91f5bSMingxia Liu "total-num-mbufs should be > %d\n", 116257d91f5bSMingxia Liu MIN_TOTAL_NUM_MBUFS); 116390c26386SDavid Marchand break; 116490c26386SDavid Marchand case TESTPMD_OPT_MAX_PKT_LEN_NUM: 1165af75078fSIntel n = atoi(optarg); 1166761c4d66SSteve Yang if (n >= RTE_ETHER_MIN_LEN) 11671bb4a528SFerruh Yigit max_rx_pkt_len = n; 1168761c4d66SSteve Yang else 1169af75078fSIntel rte_exit(EXIT_FAILURE, 1170af75078fSIntel "Invalid max-pkt-len=%d - should be > %d\n", 117135b2d13fSOlivier Matz n, RTE_ETHER_MIN_LEN); 117290c26386SDavid Marchand break; 117390c26386SDavid Marchand case TESTPMD_OPT_MAX_LRO_PKT_SIZE_NUM: 11744a729092SDekel Peled n = atoi(optarg); 11754a729092SDekel Peled rx_mode.max_lro_pkt_size = (uint32_t) n; 117690c26386SDavid Marchand break; 1177a8d0d473SBruce Richardson #ifdef RTE_LIB_LATENCYSTATS 117890c26386SDavid Marchand case TESTPMD_OPT_LATENCYSTATS_NUM: 117962d3216dSReshma Pattan n = atoi(optarg); 118062d3216dSReshma Pattan if (n >= 0) { 118162d3216dSReshma Pattan latencystats_lcore_id = (lcoreid_t) n; 118262d3216dSReshma Pattan latencystats_enabled = 1; 118362d3216dSReshma Pattan } else 118462d3216dSReshma Pattan rte_exit(EXIT_FAILURE, 118562d3216dSReshma Pattan "invalid lcore id %d for latencystats" 118662d3216dSReshma Pattan " must be >= 0\n", n); 118790c26386SDavid Marchand 118890c26386SDavid Marchand break; 118962d3216dSReshma Pattan #endif 1190a8d0d473SBruce Richardson #ifdef RTE_LIB_BITRATESTATS 119190c26386SDavid Marchand case TESTPMD_OPT_BITRATE_STATS_NUM: 1192e25e6c70SRemy Horton n = atoi(optarg); 1193e25e6c70SRemy Horton if (n >= 0) { 1194e25e6c70SRemy Horton bitrate_lcore_id = (lcoreid_t) n; 1195e25e6c70SRemy Horton bitrate_enabled = 1; 1196e25e6c70SRemy Horton } else 1197e25e6c70SRemy Horton rte_exit(EXIT_FAILURE, 1198e25e6c70SRemy Horton "invalid lcore id %d for bitrate stats" 1199e25e6c70SRemy Horton " must be >= 0\n", n); 120090c26386SDavid Marchand break; 1201e25e6c70SRemy Horton #endif 120290c26386SDavid Marchand case TESTPMD_OPT_DISABLE_CRC_STRIP_NUM: 1203295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_KEEP_CRC; 120490c26386SDavid Marchand break; 120590c26386SDavid Marchand case TESTPMD_OPT_ENABLE_LRO_NUM: 1206295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_TCP_LRO; 120790c26386SDavid Marchand break; 120890c26386SDavid Marchand case TESTPMD_OPT_ENABLE_SCATTER_NUM: 1209295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_SCATTER; 121090c26386SDavid Marchand break; 121190c26386SDavid Marchand case TESTPMD_OPT_ENABLE_RX_CKSUM_NUM: 1212295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_CHECKSUM; 121390c26386SDavid Marchand break; 121490c26386SDavid Marchand case TESTPMD_OPT_ENABLE_RX_TIMESTAMP_NUM: 1215295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_TIMESTAMP; 121690c26386SDavid Marchand break; 121790c26386SDavid Marchand case TESTPMD_OPT_ENABLE_HW_VLAN_NUM: 1218295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_VLAN; 121990c26386SDavid Marchand break; 122090c26386SDavid Marchand case TESTPMD_OPT_ENABLE_HW_VLAN_FILTER_NUM: 1221295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER; 122290c26386SDavid Marchand break; 122390c26386SDavid Marchand case TESTPMD_OPT_ENABLE_HW_VLAN_STRIP_NUM: 1224295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP; 122590c26386SDavid Marchand break; 122690c26386SDavid Marchand case TESTPMD_OPT_ENABLE_HW_VLAN_EXTEND_NUM: 1227295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_VLAN_EXTEND; 122890c26386SDavid Marchand break; 122990c26386SDavid Marchand case TESTPMD_OPT_ENABLE_HW_QINQ_STRIP_NUM: 1230295968d1SFerruh Yigit rx_offloads |= RTE_ETH_RX_OFFLOAD_QINQ_STRIP; 123190c26386SDavid Marchand break; 123290c26386SDavid Marchand case TESTPMD_OPT_ENABLE_DROP_EN_NUM: 1233ce8d5614SIntel rx_drop_en = 1; 123490c26386SDavid Marchand break; 123590c26386SDavid Marchand case TESTPMD_OPT_DISABLE_RSS_NUM: 1236af75078fSIntel rss_hf = 0; 123790c26386SDavid Marchand break; 123890c26386SDavid Marchand case TESTPMD_OPT_PORT_TOPOLOGY_NUM: 1239af75078fSIntel if (!strcmp(optarg, "paired")) 1240af75078fSIntel port_topology = PORT_TOPOLOGY_PAIRED; 1241af75078fSIntel else if (!strcmp(optarg, "chained")) 1242af75078fSIntel port_topology = PORT_TOPOLOGY_CHAINED; 12433e2006d6SCyril Chemparathy else if (!strcmp(optarg, "loop")) 12443e2006d6SCyril Chemparathy port_topology = PORT_TOPOLOGY_LOOP; 1245af75078fSIntel else 1246af75078fSIntel rte_exit(EXIT_FAILURE, "port-topology %s invalid -" 124775358833SPablo de Lara " must be: paired, chained or loop\n", 1248af75078fSIntel optarg); 124990c26386SDavid Marchand break; 125090c26386SDavid Marchand case TESTPMD_OPT_FORWARD_MODE_NUM: 1251ce9b9fb0SCyril Chemparathy set_pkt_forwarding_mode(optarg); 125290c26386SDavid Marchand break; 125390c26386SDavid Marchand case TESTPMD_OPT_RSS_IP_NUM: 1254295968d1SFerruh Yigit rss_hf = RTE_ETH_RSS_IP; 125590c26386SDavid Marchand break; 125690c26386SDavid Marchand case TESTPMD_OPT_RSS_UDP_NUM: 1257295968d1SFerruh Yigit rss_hf = RTE_ETH_RSS_UDP; 125890c26386SDavid Marchand break; 125990c26386SDavid Marchand case TESTPMD_OPT_RSS_LEVEL_INNER_NUM: 1260295968d1SFerruh Yigit rss_hf |= RTE_ETH_RSS_LEVEL_INNERMOST; 126190c26386SDavid Marchand break; 126290c26386SDavid Marchand case TESTPMD_OPT_RSS_LEVEL_OUTER_NUM: 1263295968d1SFerruh Yigit rss_hf |= RTE_ETH_RSS_LEVEL_OUTERMOST; 126490c26386SDavid Marchand break; 126590c26386SDavid Marchand case TESTPMD_OPT_RXQ_NUM: 1266af75078fSIntel n = atoi(optarg); 12673f7311baSWei Dai if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) 1268af75078fSIntel nb_rxq = (queueid_t) n; 1269af75078fSIntel else 1270af75078fSIntel rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" 12713f7311baSWei Dai " >= 0 && <= %u\n", n, 12723f7311baSWei Dai get_allowed_max_nb_rxq(&pid)); 127390c26386SDavid Marchand break; 127490c26386SDavid Marchand case TESTPMD_OPT_TXQ_NUM: 1275af75078fSIntel n = atoi(optarg); 127636db4f6cSWei Dai if (n >= 0 && check_nb_txq((queueid_t)n) == 0) 1277af75078fSIntel nb_txq = (queueid_t) n; 1278af75078fSIntel else 1279af75078fSIntel rte_exit(EXIT_FAILURE, "txq %d invalid - must be" 128036db4f6cSWei Dai " >= 0 && <= %u\n", n, 128136db4f6cSWei Dai get_allowed_max_nb_txq(&pid)); 128290c26386SDavid Marchand break; 128390c26386SDavid Marchand case TESTPMD_OPT_HAIRPINQ_NUM: 12841c69df45SOri Kam n = atoi(optarg); 12851c69df45SOri Kam if (n >= 0 && 12861c69df45SOri Kam check_nb_hairpinq((queueid_t)n) == 0) 12871c69df45SOri Kam nb_hairpinq = (queueid_t) n; 12881c69df45SOri Kam else 12891c69df45SOri Kam rte_exit(EXIT_FAILURE, "txq %d invalid - must be" 12901c69df45SOri Kam " >= 0 && <= %u\n", n, 12911c69df45SOri Kam get_allowed_max_nb_hairpinq 12921c69df45SOri Kam (&pid)); 12931c69df45SOri Kam if ((n + nb_txq) < 0 || 12941c69df45SOri Kam check_nb_txq((queueid_t)(n + nb_txq)) != 0) 12951c69df45SOri Kam rte_exit(EXIT_FAILURE, "txq + hairpinq " 12961c69df45SOri Kam "%d invalid - must be" 12971c69df45SOri Kam " >= 0 && <= %u\n", 12981c69df45SOri Kam n + nb_txq, 12991c69df45SOri Kam get_allowed_max_nb_txq(&pid)); 13001c69df45SOri Kam if ((n + nb_rxq) < 0 || 13011c69df45SOri Kam check_nb_rxq((queueid_t)(n + nb_rxq)) != 0) 13021c69df45SOri Kam rte_exit(EXIT_FAILURE, "rxq + hairpinq " 13031c69df45SOri Kam "%d invalid - must be" 13041c69df45SOri Kam " >= 0 && <= %u\n", 13051c69df45SOri Kam n + nb_rxq, 13061c69df45SOri Kam get_allowed_max_nb_rxq(&pid)); 130790c26386SDavid Marchand break; 130890c26386SDavid Marchand case TESTPMD_OPT_HAIRPIN_MODE_NUM: { 130901817b10SBing Zhao char *end = NULL; 131001817b10SBing Zhao unsigned int n; 131101817b10SBing Zhao 131201817b10SBing Zhao errno = 0; 131301817b10SBing Zhao n = strtoul(optarg, &end, 0); 131401817b10SBing Zhao if (errno != 0 || end == optarg) 131501817b10SBing Zhao rte_exit(EXIT_FAILURE, "hairpin mode invalid\n"); 131601817b10SBing Zhao else 131723095155SDariusz Sosnowski hairpin_mode = (uint32_t)n; 131890c26386SDavid Marchand break; 131901817b10SBing Zhao } 132090c26386SDavid Marchand case TESTPMD_OPT_BURST_NUM: 1321af75078fSIntel n = atoi(optarg); 13228599ed31SRemy Horton if (n == 0) { 13238599ed31SRemy Horton /* A burst size of zero means that the 13248599ed31SRemy Horton * PMD should be queried for 13258599ed31SRemy Horton * recommended Rx burst size. Since 13268599ed31SRemy Horton * testpmd uses a single size for all 13278599ed31SRemy Horton * ports, port 0 is queried for the 13288599ed31SRemy Horton * value, on the assumption that all 13298599ed31SRemy Horton * ports are of the same NIC model. 13308599ed31SRemy Horton */ 13316f51deb9SIvan Ilchenko ret = eth_dev_info_get_print_err( 13326f51deb9SIvan Ilchenko 0, 13336f51deb9SIvan Ilchenko &dev_info); 13346f51deb9SIvan Ilchenko if (ret != 0) 13356fa896aeSDavid Marchand rte_exit(EXIT_FAILURE, "Failed to get driver " 13366fa896aeSDavid Marchand "recommended burst size, please provide a " 13376fa896aeSDavid Marchand "value between 1 and %d\n", MAX_PKT_BURST); 13386f51deb9SIvan Ilchenko 13398599ed31SRemy Horton rec_nb_pkts = dev_info 13408599ed31SRemy Horton .default_rxportconf.burst_size; 13418599ed31SRemy Horton 13428599ed31SRemy Horton if (rec_nb_pkts == 0) 1343af75078fSIntel rte_exit(EXIT_FAILURE, 13448599ed31SRemy Horton "PMD does not recommend a burst size. " 13458599ed31SRemy Horton "Provided value must be between " 13468599ed31SRemy Horton "1 and %d\n", MAX_PKT_BURST); 13478599ed31SRemy Horton else if (rec_nb_pkts > MAX_PKT_BURST) 13488599ed31SRemy Horton rte_exit(EXIT_FAILURE, 13498599ed31SRemy Horton "PMD recommended burst size of %d" 13508599ed31SRemy Horton " exceeds maximum value of %d\n", 13518599ed31SRemy Horton rec_nb_pkts, MAX_PKT_BURST); 13528599ed31SRemy Horton printf("Using PMD-provided burst value of %d\n", 13538599ed31SRemy Horton rec_nb_pkts); 13548599ed31SRemy Horton nb_pkt_per_burst = rec_nb_pkts; 13558599ed31SRemy Horton } else if (n > MAX_PKT_BURST) 13568599ed31SRemy Horton rte_exit(EXIT_FAILURE, 13578599ed31SRemy Horton "burst must be between1 and %d\n", 1358af75078fSIntel MAX_PKT_BURST); 13598599ed31SRemy Horton else 13608599ed31SRemy Horton nb_pkt_per_burst = (uint16_t) n; 136190c26386SDavid Marchand break; 136290c26386SDavid Marchand case TESTPMD_OPT_FLOWGEN_CLONES_NUM: 13636c02043eSIgor Russkikh n = atoi(optarg); 13646c02043eSIgor Russkikh if (n >= 0) 13656c02043eSIgor Russkikh nb_pkt_flowgen_clones = (uint16_t) n; 13666c02043eSIgor Russkikh else 13676c02043eSIgor Russkikh rte_exit(EXIT_FAILURE, 13686c02043eSIgor Russkikh "clones must be >= 0 and <= current burst\n"); 136990c26386SDavid Marchand break; 137090c26386SDavid Marchand case TESTPMD_OPT_FLOWGEN_FLOWS_NUM: 1371861e7684SZhihong Wang n = atoi(optarg); 1372861e7684SZhihong Wang if (n > 0) 1373861e7684SZhihong Wang nb_flows_flowgen = (int) n; 1374861e7684SZhihong Wang else 1375861e7684SZhihong Wang rte_exit(EXIT_FAILURE, 1376861e7684SZhihong Wang "flows must be >= 1\n"); 137790c26386SDavid Marchand break; 137890c26386SDavid Marchand case TESTPMD_OPT_MBCACHE_NUM: 1379af75078fSIntel n = atoi(optarg); 1380af75078fSIntel if ((n >= 0) && 1381af75078fSIntel (n <= RTE_MEMPOOL_CACHE_MAX_SIZE)) 1382af75078fSIntel mb_mempool_cache = (uint16_t) n; 1383af75078fSIntel else 1384af75078fSIntel rte_exit(EXIT_FAILURE, 1385af75078fSIntel "mbcache must be >= 0 and <= %d\n", 1386af75078fSIntel RTE_MEMPOOL_CACHE_MAX_SIZE); 138790c26386SDavid Marchand break; 138890c26386SDavid Marchand case TESTPMD_OPT_TXFREET_NUM: 1389af75078fSIntel n = atoi(optarg); 1390af75078fSIntel if (n >= 0) 1391f2c5125aSPablo de Lara tx_free_thresh = (int16_t)n; 1392af75078fSIntel else 1393af75078fSIntel rte_exit(EXIT_FAILURE, "txfreet must be >= 0\n"); 139490c26386SDavid Marchand break; 139590c26386SDavid Marchand case TESTPMD_OPT_TXRST_NUM: 1396af75078fSIntel n = atoi(optarg); 1397af75078fSIntel if (n >= 0) 1398f2c5125aSPablo de Lara tx_rs_thresh = (int16_t)n; 1399af75078fSIntel else 1400af75078fSIntel rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); 140190c26386SDavid Marchand break; 140290c26386SDavid Marchand case TESTPMD_OPT_RXD_NUM: 1403af75078fSIntel n = atoi(optarg); 1404af75078fSIntel if (n > 0) { 1405af75078fSIntel if (rx_free_thresh >= n) 1406af75078fSIntel rte_exit(EXIT_FAILURE, 1407af75078fSIntel "rxd must be > " 1408af75078fSIntel "rx_free_thresh(%d)\n", 1409af75078fSIntel (int)rx_free_thresh); 1410af75078fSIntel else 1411af75078fSIntel nb_rxd = (uint16_t) n; 1412af75078fSIntel } else 1413af75078fSIntel rte_exit(EXIT_FAILURE, 1414af75078fSIntel "rxd(%d) invalid - must be > 0\n", 1415af75078fSIntel n); 141690c26386SDavid Marchand break; 141790c26386SDavid Marchand case TESTPMD_OPT_TXD_NUM: 1418af75078fSIntel n = atoi(optarg); 1419af75078fSIntel if (n > 0) 1420af75078fSIntel nb_txd = (uint16_t) n; 1421af75078fSIntel else 1422af75078fSIntel rte_exit(EXIT_FAILURE, "txd must be in > 0\n"); 142390c26386SDavid Marchand break; 142490c26386SDavid Marchand case TESTPMD_OPT_TXPT_NUM: 1425af75078fSIntel n = atoi(optarg); 1426af75078fSIntel if (n >= 0) 1427f2c5125aSPablo de Lara tx_pthresh = (int8_t)n; 1428af75078fSIntel else 1429af75078fSIntel rte_exit(EXIT_FAILURE, "txpt must be >= 0\n"); 143090c26386SDavid Marchand break; 143190c26386SDavid Marchand case TESTPMD_OPT_TXHT_NUM: 1432af75078fSIntel n = atoi(optarg); 1433af75078fSIntel if (n >= 0) 1434f2c5125aSPablo de Lara tx_hthresh = (int8_t)n; 1435af75078fSIntel else 1436af75078fSIntel rte_exit(EXIT_FAILURE, "txht must be >= 0\n"); 143790c26386SDavid Marchand break; 143890c26386SDavid Marchand case TESTPMD_OPT_TXWT_NUM: 1439af75078fSIntel n = atoi(optarg); 1440af75078fSIntel if (n >= 0) 1441f2c5125aSPablo de Lara tx_wthresh = (int8_t)n; 1442af75078fSIntel else 1443af75078fSIntel rte_exit(EXIT_FAILURE, "txwt must be >= 0\n"); 144490c26386SDavid Marchand break; 144590c26386SDavid Marchand case TESTPMD_OPT_RXPT_NUM: 1446af75078fSIntel n = atoi(optarg); 1447af75078fSIntel if (n >= 0) 1448f2c5125aSPablo de Lara rx_pthresh = (int8_t)n; 1449af75078fSIntel else 1450af75078fSIntel rte_exit(EXIT_FAILURE, "rxpt must be >= 0\n"); 145190c26386SDavid Marchand break; 145290c26386SDavid Marchand case TESTPMD_OPT_RXHT_NUM: 1453af75078fSIntel n = atoi(optarg); 1454af75078fSIntel if (n >= 0) 1455f2c5125aSPablo de Lara rx_hthresh = (int8_t)n; 1456af75078fSIntel else 1457af75078fSIntel rte_exit(EXIT_FAILURE, "rxht must be >= 0\n"); 145890c26386SDavid Marchand break; 145990c26386SDavid Marchand case TESTPMD_OPT_RXWT_NUM: 1460af75078fSIntel n = atoi(optarg); 1461af75078fSIntel if (n >= 0) 1462f2c5125aSPablo de Lara rx_wthresh = (int8_t)n; 1463af75078fSIntel else 1464af75078fSIntel rte_exit(EXIT_FAILURE, "rxwt must be >= 0\n"); 146590c26386SDavid Marchand break; 146690c26386SDavid Marchand case TESTPMD_OPT_RXFREET_NUM: 1467af75078fSIntel n = atoi(optarg); 1468af75078fSIntel if (n >= 0) 1469f2c5125aSPablo de Lara rx_free_thresh = (int16_t)n; 1470af75078fSIntel else 1471af75078fSIntel rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n"); 147290c26386SDavid Marchand break; 147390c26386SDavid Marchand case TESTPMD_OPT_RXOFFS_NUM: { 147491c78e09SViacheslav Ovsiienko unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT]; 147591c78e09SViacheslav Ovsiienko unsigned int nb_offs; 147691c78e09SViacheslav Ovsiienko 147791c78e09SViacheslav Ovsiienko nb_offs = parse_item_list 147891c78e09SViacheslav Ovsiienko (optarg, "rxpkt offsets", 147991c78e09SViacheslav Ovsiienko MAX_SEGS_BUFFER_SPLIT, 148091c78e09SViacheslav Ovsiienko seg_off, 0); 148191c78e09SViacheslav Ovsiienko if (nb_offs > 0) 148291c78e09SViacheslav Ovsiienko set_rx_pkt_offsets(seg_off, nb_offs); 148391c78e09SViacheslav Ovsiienko else 148491c78e09SViacheslav Ovsiienko rte_exit(EXIT_FAILURE, "bad rxoffs\n"); 148590c26386SDavid Marchand break; 148691c78e09SViacheslav Ovsiienko } 148790c26386SDavid Marchand case TESTPMD_OPT_RXPKTS_NUM: { 14880f2096d7SViacheslav Ovsiienko unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT]; 14890f2096d7SViacheslav Ovsiienko unsigned int nb_segs; 149090c26386SDavid Marchand 14910f2096d7SViacheslav Ovsiienko nb_segs = parse_item_list 14920f2096d7SViacheslav Ovsiienko (optarg, "rxpkt segments", 14930f2096d7SViacheslav Ovsiienko MAX_SEGS_BUFFER_SPLIT, 14940f2096d7SViacheslav Ovsiienko seg_len, 0); 14950f2096d7SViacheslav Ovsiienko if (nb_segs > 0) 14960f2096d7SViacheslav Ovsiienko set_rx_pkt_segments(seg_len, nb_segs); 14970f2096d7SViacheslav Ovsiienko else 14980f2096d7SViacheslav Ovsiienko rte_exit(EXIT_FAILURE, "bad rxpkts\n"); 149990c26386SDavid Marchand break; 15000f2096d7SViacheslav Ovsiienko } 150190c26386SDavid Marchand case TESTPMD_OPT_RXHDRS_NUM: { 150252e2e7edSYuan Wang unsigned int seg_hdrs[MAX_SEGS_BUFFER_SPLIT]; 150352e2e7edSYuan Wang unsigned int nb_segs; 150452e2e7edSYuan Wang 150552e2e7edSYuan Wang nb_segs = parse_hdrs_list 150652e2e7edSYuan Wang (optarg, "rxpkt segments", 150752e2e7edSYuan Wang MAX_SEGS_BUFFER_SPLIT, 150823f2dfd3SYuan Wang seg_hdrs); 150952e2e7edSYuan Wang if (nb_segs > 0) 151052e2e7edSYuan Wang set_rx_pkt_hdrs(seg_hdrs, nb_segs); 151152e2e7edSYuan Wang else 151252e2e7edSYuan Wang rte_exit(EXIT_FAILURE, "bad rxpkts\n"); 151390c26386SDavid Marchand break; 151452e2e7edSYuan Wang } 151590c26386SDavid Marchand case TESTPMD_OPT_TXPKTS_NUM: { 151690c26386SDavid Marchand unsigned int seg_lengths[RTE_MAX_SEGS_PER_PKT]; 1517a7e7bb4eSCyril Chemparathy unsigned int nb_segs; 1518a7e7bb4eSCyril Chemparathy 1519950d1516SBruce Richardson nb_segs = parse_item_list(optarg, "txpkt segments", 1520950d1516SBruce Richardson RTE_MAX_SEGS_PER_PKT, seg_lengths, 0); 1521a7e7bb4eSCyril Chemparathy if (nb_segs > 0) 1522a7e7bb4eSCyril Chemparathy set_tx_pkt_segments(seg_lengths, nb_segs); 1523a7e7bb4eSCyril Chemparathy else 1524a7e7bb4eSCyril Chemparathy rte_exit(EXIT_FAILURE, "bad txpkts\n"); 152590c26386SDavid Marchand break; 1526a7e7bb4eSCyril Chemparathy } 152790c26386SDavid Marchand case TESTPMD_OPT_MULTI_RX_MEMPOOL_NUM: 1528a4bf5421SHanumanth Pothula multi_rx_mempool = 1; 152990c26386SDavid Marchand break; 153090c26386SDavid Marchand case TESTPMD_OPT_TXONLY_MULTI_FLOW_NUM: 153182010ef5SYongseok Koh txonly_multi_flow = 1; 153290c26386SDavid Marchand break; 153390c26386SDavid Marchand case TESTPMD_OPT_RXQ_SHARE_NUM: 1534f4d178c1SXueming Li if (optarg == NULL) { 1535f4d178c1SXueming Li rxq_share = UINT32_MAX; 1536f4d178c1SXueming Li } else { 1537f4d178c1SXueming Li n = atoi(optarg); 1538f4d178c1SXueming Li if (n >= 0) 1539f4d178c1SXueming Li rxq_share = (uint32_t)n; 1540f4d178c1SXueming Li else 1541f4d178c1SXueming Li rte_exit(EXIT_FAILURE, "rxq-share must be >= 0\n"); 1542f4d178c1SXueming Li } 154390c26386SDavid Marchand break; 154490c26386SDavid Marchand case TESTPMD_OPT_NO_FLUSH_RX_NUM: 15457741e4cfSIntel no_flush_rx = 1; 154690c26386SDavid Marchand break; 154790c26386SDavid Marchand case TESTPMD_OPT_ETH_LINK_SPEED_NUM: 1548b7b78a08SAjit Khaparde n = atoi(optarg); 1549b7b78a08SAjit Khaparde if (n >= 0 && parse_link_speed(n) > 0) 1550b7b78a08SAjit Khaparde eth_link_speed = parse_link_speed(n); 155190c26386SDavid Marchand break; 155290c26386SDavid Marchand case TESTPMD_OPT_DISABLE_LINK_CHECK_NUM: 1553bc202406SDavid Marchand no_link_check = 1; 155490c26386SDavid Marchand break; 155590c26386SDavid Marchand case TESTPMD_OPT_DISABLE_DEVICE_START_NUM: 15566937d210SStephen Hemminger no_device_start = 1; 155790c26386SDavid Marchand break; 155890c26386SDavid Marchand case TESTPMD_OPT_NO_LSC_INTERRUPT_NUM: 15598ea656f8SGaetan Rivet lsc_interrupt = 0; 156090c26386SDavid Marchand break; 156190c26386SDavid Marchand case TESTPMD_OPT_NO_RMV_INTERRUPT_NUM: 1562284c908cSGaetan Rivet rmv_interrupt = 0; 156390c26386SDavid Marchand break; 156490c26386SDavid Marchand case TESTPMD_OPT_FLOW_ISOLATE_ALL_NUM: 15657ee3e944SVasily Philipov flow_isolate_all = 1; 156690c26386SDavid Marchand break; 156790c26386SDavid Marchand case TESTPMD_OPT_DISABLE_FLOW_FLUSH_NUM: 1568543df472SChengwen Feng no_flow_flush = 1; 156990c26386SDavid Marchand break; 157090c26386SDavid Marchand case TESTPMD_OPT_TX_OFFLOADS_NUM: { 1571fd8c20aaSShahaf Shuler char *end = NULL; 157290c26386SDavid Marchand 1573fd8c20aaSShahaf Shuler n = strtoull(optarg, &end, 16); 1574fd8c20aaSShahaf Shuler if (n >= 0) 1575fd8c20aaSShahaf Shuler tx_offloads = (uint64_t)n; 1576fd8c20aaSShahaf Shuler else 1577fd8c20aaSShahaf Shuler rte_exit(EXIT_FAILURE, 1578fd8c20aaSShahaf Shuler "tx-offloads must be >= 0\n"); 157990c26386SDavid Marchand break; 1580fd8c20aaSShahaf Shuler } 158190c26386SDavid Marchand case TESTPMD_OPT_RX_OFFLOADS_NUM: { 1582fb1a5a0fSVivek Sharma char *end = NULL; 158390c26386SDavid Marchand 1584fb1a5a0fSVivek Sharma n = strtoull(optarg, &end, 16); 1585fb1a5a0fSVivek Sharma if (n >= 0) 1586fb1a5a0fSVivek Sharma rx_offloads = (uint64_t)n; 1587fb1a5a0fSVivek Sharma else 1588fb1a5a0fSVivek Sharma rte_exit(EXIT_FAILURE, 1589fb1a5a0fSVivek Sharma "rx-offloads must be >= 0\n"); 159090c26386SDavid Marchand break; 1591fb1a5a0fSVivek Sharma } 159290c26386SDavid Marchand case TESTPMD_OPT_VXLAN_GPE_PORT_NUM: 159339e5e20fSXueming Li n = atoi(optarg); 159439e5e20fSXueming Li if (n >= 0) 159539e5e20fSXueming Li vxlan_gpe_udp_port = (uint16_t)n; 159639e5e20fSXueming Li else 159739e5e20fSXueming Li rte_exit(EXIT_FAILURE, 159839e5e20fSXueming Li "vxlan-gpe-port must be >= 0\n"); 159990c26386SDavid Marchand break; 160090c26386SDavid Marchand case TESTPMD_OPT_GENEVE_PARSED_PORT_NUM: 16012f60c649SOphir Munk n = atoi(optarg); 16022f60c649SOphir Munk if (n >= 0) 16032f60c649SOphir Munk geneve_udp_port = (uint16_t)n; 16042f60c649SOphir Munk else 16052f60c649SOphir Munk rte_exit(EXIT_FAILURE, 16062f60c649SOphir Munk "geneve-parsed-port must be >= 0\n"); 160790c26386SDavid Marchand break; 160890c26386SDavid Marchand case TESTPMD_OPT_PRINT_EVENT_NUM: 16093af72783SGaetan Rivet if (parse_event_printing_config(optarg, 1)) { 16103af72783SGaetan Rivet rte_exit(EXIT_FAILURE, 16113af72783SGaetan Rivet "invalid print-event argument\n"); 16123af72783SGaetan Rivet } 161390c26386SDavid Marchand break; 161490c26386SDavid Marchand case TESTPMD_OPT_MASK_EVENT_NUM: 16153af72783SGaetan Rivet if (parse_event_printing_config(optarg, 0)) { 16163af72783SGaetan Rivet rte_exit(EXIT_FAILURE, 16173af72783SGaetan Rivet "invalid mask-event argument\n"); 16183af72783SGaetan Rivet } 161990c26386SDavid Marchand break; 162090c26386SDavid Marchand case TESTPMD_OPT_HOT_PLUG_NUM: 1621fb73e096SJeff Guo hot_plug = 1; 162290c26386SDavid Marchand break; 162390c26386SDavid Marchand case TESTPMD_OPT_MLOCKALL_NUM: 1624e505d84cSAnatoly Burakov do_mlockall = 1; 162590c26386SDavid Marchand break; 162690c26386SDavid Marchand case TESTPMD_OPT_NO_MLOCKALL_NUM: 1627e505d84cSAnatoly Burakov do_mlockall = 0; 162890c26386SDavid Marchand break; 162990c26386SDavid Marchand case TESTPMD_OPT_NOISY_TX_SW_BUFFER_SIZE_NUM: 16303c156061SJens Freimann n = atoi(optarg); 16313c156061SJens Freimann if (n >= 0) 16323c156061SJens Freimann noisy_tx_sw_bufsz = n; 16333c156061SJens Freimann else 16343c156061SJens Freimann rte_exit(EXIT_FAILURE, 16353c156061SJens Freimann "noisy-tx-sw-buffer-size must be >= 0\n"); 163690c26386SDavid Marchand break; 163790c26386SDavid Marchand case TESTPMD_OPT_NOISY_TX_SW_BUFFER_FLUSHTIME_NUM: 16383c156061SJens Freimann n = atoi(optarg); 16393c156061SJens Freimann if (n >= 0) 16403c156061SJens Freimann noisy_tx_sw_buf_flush_time = n; 16413c156061SJens Freimann else 16423c156061SJens Freimann rte_exit(EXIT_FAILURE, 16433c156061SJens Freimann "noisy-tx-sw-buffer-flushtime must be >= 0\n"); 164490c26386SDavid Marchand break; 164590c26386SDavid Marchand case TESTPMD_OPT_NOISY_LKUP_MEMORY_NUM: 16463c156061SJens Freimann n = atoi(optarg); 16473c156061SJens Freimann if (n >= 0) 16483c156061SJens Freimann noisy_lkup_mem_sz = n; 16493c156061SJens Freimann else 16503c156061SJens Freimann rte_exit(EXIT_FAILURE, 16513c156061SJens Freimann "noisy-lkup-memory must be >= 0\n"); 165290c26386SDavid Marchand break; 165390c26386SDavid Marchand case TESTPMD_OPT_NOISY_LKUP_NUM_WRITES_NUM: 16543c156061SJens Freimann n = atoi(optarg); 16553c156061SJens Freimann if (n >= 0) 16563c156061SJens Freimann noisy_lkup_num_writes = n; 16573c156061SJens Freimann else 16583c156061SJens Freimann rte_exit(EXIT_FAILURE, 16593c156061SJens Freimann "noisy-lkup-num-writes must be >= 0\n"); 166090c26386SDavid Marchand break; 166190c26386SDavid Marchand case TESTPMD_OPT_NOISY_LKUP_NUM_READS_NUM: 16623c156061SJens Freimann n = atoi(optarg); 16633c156061SJens Freimann if (n >= 0) 16643c156061SJens Freimann noisy_lkup_num_reads = n; 16653c156061SJens Freimann else 16663c156061SJens Freimann rte_exit(EXIT_FAILURE, 16673c156061SJens Freimann "noisy-lkup-num-reads must be >= 0\n"); 166890c26386SDavid Marchand break; 166990c26386SDavid Marchand case TESTPMD_OPT_NOISY_LKUP_NUM_READS_WRITES_NUM: 16703c156061SJens Freimann n = atoi(optarg); 16713c156061SJens Freimann if (n >= 0) 16723c156061SJens Freimann noisy_lkup_num_reads_writes = n; 16733c156061SJens Freimann else 16743c156061SJens Freimann rte_exit(EXIT_FAILURE, 16753c156061SJens Freimann "noisy-lkup-num-reads-writes must be >= 0\n"); 167690c26386SDavid Marchand break; 167790c26386SDavid Marchand case TESTPMD_OPT_NOISY_FORWARD_MODE_NUM: { 167890c26386SDavid Marchand unsigned int i; 167990c26386SDavid Marchand 168090c26386SDavid Marchand for (i = 0; i < NOISY_FWD_MODE_MAX; i++) { 16811d343c19SMike Pattrick if (!strcmp(optarg, noisy_fwd_mode_desc[i])) { 16821d343c19SMike Pattrick noisy_fwd_mode = i; 16831d343c19SMike Pattrick break; 16841d343c19SMike Pattrick } 168590c26386SDavid Marchand } 16861d343c19SMike Pattrick if (i == NOISY_FWD_MODE_MAX) 16871d343c19SMike Pattrick rte_exit(EXIT_FAILURE, "noisy-forward-mode %s invalid," 16881d343c19SMike Pattrick " must be a valid noisy-forward-mode value\n", 16891d343c19SMike Pattrick optarg); 169090c26386SDavid Marchand break; 16911d343c19SMike Pattrick } 169290c26386SDavid Marchand case TESTPMD_OPT_NO_IOVA_CONTIG_NUM: 1693c47d7b90SAndrew Rybchenko mempool_flags = RTE_MEMPOOL_F_NO_IOVA_CONTIG; 169490c26386SDavid Marchand break; 169590c26386SDavid Marchand case TESTPMD_OPT_RX_MQ_MODE_NUM: { 1696f9295aa2SXiaoyu Min char *end = NULL; 169790c26386SDavid Marchand 1698f9295aa2SXiaoyu Min n = strtoul(optarg, &end, 16); 1699295968d1SFerruh Yigit if (n >= 0 && n <= RTE_ETH_MQ_RX_VMDQ_DCB_RSS) 1700f9295aa2SXiaoyu Min rx_mq_mode = (enum rte_eth_rx_mq_mode)n; 1701f9295aa2SXiaoyu Min else 1702f9295aa2SXiaoyu Min rte_exit(EXIT_FAILURE, 1703f9295aa2SXiaoyu Min "rx-mq-mode must be >= 0 and <= %d\n", 1704295968d1SFerruh Yigit RTE_ETH_MQ_RX_VMDQ_DCB_RSS); 1705af75078fSIntel break; 170690c26386SDavid Marchand } 170790c26386SDavid Marchand case TESTPMD_OPT_RECORD_CORE_CYCLES_NUM: 170890c26386SDavid Marchand record_core_cycles = 1; 170990c26386SDavid Marchand break; 171090c26386SDavid Marchand case TESTPMD_OPT_RECORD_BURST_STATS_NUM: 171190c26386SDavid Marchand record_burst_stats = 1; 171290c26386SDavid Marchand break; 171390c26386SDavid Marchand case TESTPMD_OPT_NUM_PROCS_NUM: 171490c26386SDavid Marchand num_procs = atoi(optarg); 171590c26386SDavid Marchand break; 171690c26386SDavid Marchand case TESTPMD_OPT_PROC_ID_NUM: 171790c26386SDavid Marchand proc_id = atoi(optarg); 1718af75078fSIntel break; 1719af75078fSIntel default: 1720af75078fSIntel usage(argv[0]); 1721c25382faSDavid Marchand fprintf(stderr, "Invalid option: %s\n", argv[optind - 1]); 1722af75078fSIntel rte_exit(EXIT_FAILURE, 1723af75078fSIntel "Command line is incomplete or incorrect\n"); 1724af75078fSIntel break; 1725af75078fSIntel } 1726af75078fSIntel } 17270074d02fSShahaf Shuler 17288fad2e5aSDavid Marchand if (optind != argc) { 17298fad2e5aSDavid Marchand usage(argv[0]); 173061a3b0e5SAndrew Rybchenko fprintf(stderr, "Invalid parameter: %s\n", argv[optind]); 17318fad2e5aSDavid Marchand rte_exit(EXIT_FAILURE, "Command line is incorrect\n"); 17328fad2e5aSDavid Marchand } 17338fad2e5aSDavid Marchand 17345388be6eSHaiyue Wang if (proc_id >= (int)num_procs) 17355388be6eSHaiyue Wang rte_exit(EXIT_FAILURE, 17365388be6eSHaiyue Wang "The multi-process option '%s(%d)' should be less than '%s(%u)'\n", 173790c26386SDavid Marchand TESTPMD_OPT_PROC_ID, proc_id, 173890c26386SDavid Marchand TESTPMD_OPT_NUM_PROCS, num_procs); 17395388be6eSHaiyue Wang 17400074d02fSShahaf Shuler /* Set offload configuration from command line parameters. */ 17410074d02fSShahaf Shuler rx_mode.offloads = rx_offloads; 1742fd8c20aaSShahaf Shuler tx_mode.offloads = tx_offloads; 174359fcf854SShahaf Shuler 1744c47d7b90SAndrew Rybchenko if (mempool_flags & RTE_MEMPOOL_F_NO_IOVA_CONTIG && 174559fcf854SShahaf Shuler mp_alloc_type != MP_ALLOC_ANON) { 174659fcf854SShahaf Shuler TESTPMD_LOG(WARNING, "cannot use no-iova-contig without " 174759fcf854SShahaf Shuler "mp-alloc=anon. mempool no-iova-contig is " 174859fcf854SShahaf Shuler "ignored\n"); 174959fcf854SShahaf Shuler mempool_flags = 0; 175059fcf854SShahaf Shuler } 1751af75078fSIntel } 1752