The Tx buffer may overflow when there is more than one port.
Fixes:
002ade70e933 ("app/test: measure cycles per packet in Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
static int
exec_burst(uint32_t flags, int lcore)
{
static int
exec_burst(uint32_t flags, int lcore)
{
- unsigned i, portid, nb_tx = 0;
+ unsigned int portid, nb_tx = 0;
struct lcore_conf *conf;
uint32_t pkt_per_port;
struct lcore_conf *conf;
uint32_t pkt_per_port;
int diff_tsc;
conf = &lcore_conf[lcore];
int diff_tsc;
conf = &lcore_conf[lcore];
rte_atomic64_set(&start, 1);
/* start xmit */
rte_atomic64_set(&start, 1);
/* start xmit */
while (num) {
nb_tx = RTE_MIN(MAX_PKT_BURST, num);
while (num) {
nb_tx = RTE_MIN(MAX_PKT_BURST, num);
- for (i = 0; i < conf->nb_ports; i++) {
- portid = conf->portlist[i];
- nb_tx = rte_eth_tx_burst(portid, 0,
- &tx_burst[idx], nb_tx);
- idx += nb_tx;
- num -= nb_tx;
- }
-
+ portid = conf->portlist[i];
+ nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx);
+ idx += nb_tx;
+ num -= nb_tx;
+ i = (i >= conf->nb_ports - 1) ? 0 : (i + 1);