#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;
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;
}
pkts_burst[nb_pkt] = pkt;
- if (++next_flow >= (int)cfg_n_flows)
+ if (++next_flow >= nb_flows_flowgen)
next_flow = 0;
}
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);
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,
};
"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");
{ "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 },
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) &&
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 */
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;
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.