app/testpmd: add option for number of flows in flowgen
Make number of flows in flowgen configurable by setting parameter --flowgen-flows=N. Signed-off-by: Zhihong Wang <wangzhihong.wzh@bytedance.com> Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
This commit is contained in:
parent
1b7ca7d165
commit
861e768459
@ -40,8 +40,6 @@
|
||||
|
||||
#include "testpmd.h"
|
||||
|
||||
/* hardcoded configuration (for now) */
|
||||
static unsigned cfg_n_flows = 1024;
|
||||
static uint32_t cfg_ip_src = RTE_IPV4(10, 254, 0, 0);
|
||||
static uint32_t cfg_ip_dst = RTE_IPV4(10, 253, 0, 0);
|
||||
static uint16_t cfg_udp_src = 1000;
|
||||
@ -76,6 +74,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
|
||||
uint64_t ol_flags = 0;
|
||||
uint16_t nb_rx;
|
||||
uint16_t nb_tx;
|
||||
uint16_t nb_dropped;
|
||||
uint16_t nb_pkt;
|
||||
uint16_t nb_clones = nb_pkt_flowgen_clones;
|
||||
uint16_t i;
|
||||
@ -165,7 +164,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
|
||||
}
|
||||
pkts_burst[nb_pkt] = pkt;
|
||||
|
||||
if (++next_flow >= (int)cfg_n_flows)
|
||||
if (++next_flow >= nb_flows_flowgen)
|
||||
next_flow = 0;
|
||||
}
|
||||
|
||||
@ -184,13 +183,14 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
|
||||
fs->tx_packets += nb_tx;
|
||||
|
||||
inc_tx_burst_stats(fs, nb_tx);
|
||||
if (unlikely(nb_tx < nb_pkt)) {
|
||||
nb_dropped = nb_pkt - nb_tx;
|
||||
if (unlikely(nb_dropped > 0)) {
|
||||
/* Back out the flow counter. */
|
||||
next_flow -= (nb_pkt - nb_tx);
|
||||
next_flow -= nb_dropped;
|
||||
while (next_flow < 0)
|
||||
next_flow += cfg_n_flows;
|
||||
next_flow += nb_flows_flowgen;
|
||||
|
||||
fs->fwd_dropped += nb_pkt - nb_tx;
|
||||
fs->fwd_dropped += nb_dropped;
|
||||
do {
|
||||
rte_pktmbuf_free(pkts_burst[nb_tx]);
|
||||
} while (++nb_tx < nb_pkt);
|
||||
@ -201,9 +201,15 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
|
||||
get_end_cycles(fs, start_tsc);
|
||||
}
|
||||
|
||||
static void
|
||||
flowgen_begin(portid_t pi)
|
||||
{
|
||||
printf(" number of flows for port %u: %d\n", pi, nb_flows_flowgen);
|
||||
}
|
||||
|
||||
struct fwd_engine flow_gen_engine = {
|
||||
.fwd_mode_name = "flowgen",
|
||||
.port_fwd_begin = NULL,
|
||||
.port_fwd_begin = flowgen_begin,
|
||||
.port_fwd_end = NULL,
|
||||
.packet_fwd = pkt_burst_flow_gen,
|
||||
};
|
||||
|
@ -143,6 +143,7 @@ usage(char* progname)
|
||||
"N.\n");
|
||||
printf(" --burst=N: set the number of packets per burst to N.\n");
|
||||
printf(" --flowgen-clones=N: set the number of single packet clones to send in flowgen mode. Should be less than burst value.\n");
|
||||
printf(" --flowgen-flows=N: set the number of flows in flowgen mode to N (1 <= N <= INT32_MAX).\n");
|
||||
printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n");
|
||||
printf(" --rxpt=N: set prefetch threshold register of RX rings to N.\n");
|
||||
printf(" --rxht=N: set the host threshold register of RX rings to N.\n");
|
||||
@ -586,6 +587,7 @@ launch_args_parse(int argc, char** argv)
|
||||
{ "hairpin-mode", 1, 0, 0 },
|
||||
{ "burst", 1, 0, 0 },
|
||||
{ "flowgen-clones", 1, 0, 0 },
|
||||
{ "flowgen-flows", 1, 0, 0 },
|
||||
{ "mbcache", 1, 0, 0 },
|
||||
{ "txpt", 1, 0, 0 },
|
||||
{ "txht", 1, 0, 0 },
|
||||
@ -1122,6 +1124,14 @@ launch_args_parse(int argc, char** argv)
|
||||
rte_exit(EXIT_FAILURE,
|
||||
"clones must be >= 0 and <= current burst\n");
|
||||
}
|
||||
if (!strcmp(lgopts[opt_idx].name, "flowgen-flows")) {
|
||||
n = atoi(optarg);
|
||||
if (n > 0)
|
||||
nb_flows_flowgen = (int) n;
|
||||
else
|
||||
rte_exit(EXIT_FAILURE,
|
||||
"flows must be >= 1\n");
|
||||
}
|
||||
if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
|
||||
n = atoi(optarg);
|
||||
if ((n >= 0) &&
|
||||
|
@ -246,6 +246,7 @@ uint32_t tx_pkt_times_intra;
|
||||
|
||||
uint16_t nb_pkt_per_burst = DEF_PKT_BURST; /**< Number of packets per burst. */
|
||||
uint16_t nb_pkt_flowgen_clones; /**< Number of Tx packet clones to send in flowgen mode. */
|
||||
int nb_flows_flowgen = 1024; /**< Number of flows in flowgen mode. */
|
||||
uint16_t mb_mempool_cache = DEF_MBUF_CACHE; /**< Size of mbuf mempool cache. */
|
||||
|
||||
/* current configuration is in DCB or not,0 means it is not in DCB mode */
|
||||
|
@ -479,6 +479,7 @@ extern uint8_t txonly_multi_flow;
|
||||
|
||||
extern uint16_t nb_pkt_per_burst;
|
||||
extern uint16_t nb_pkt_flowgen_clones;
|
||||
extern int nb_flows_flowgen;
|
||||
extern uint16_t mb_mempool_cache;
|
||||
extern int8_t rx_pthresh;
|
||||
extern int8_t rx_hthresh;
|
||||
|
@ -306,6 +306,11 @@ The command line options are:
|
||||
in testing extreme speeds or maxing out Tx packet performance.
|
||||
N should be not zero, but less than 'burst' parameter.
|
||||
|
||||
* ``--flowgen-flows=N``
|
||||
|
||||
Set the number of flows to be generated in `flowgen` mode, where
|
||||
1 <= N <= INT32_MAX.
|
||||
|
||||
* ``--mbcache=N``
|
||||
|
||||
Set the cache of mbuf memory pools to N, where 0 <= N <= 512.
|
||||
|
Loading…
x
Reference in New Issue
Block a user