summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Meunier <julien.meunier@nokia.com>2019-02-20 23:06:08 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-02-22 14:39:49 +0100
commit4c3cd4c294f883a5cf6d75425351b855d5f4be05 (patch)
treee240606af095b33a50f130129fc745913b41c9ed
parent7f949ae391527200266afa59097317ef0047111e (diff)
downloaddpdk-4c3cd4c294f883a5cf6d75425351b855d5f4be05.zip
dpdk-4c3cd4c294f883a5cf6d75425351b855d5f4be05.tar.gz
dpdk-4c3cd4c294f883a5cf6d75425351b855d5f4be05.tar.xz
test/pmd_perf: fix the way to drain the port
If the port has received less than ``pkt_per_port`` packets (for example, the port has missed some packets), the test is in an infinite loop. Instead of expecting a number of packet to receive, let the port to be drained by itself. If no more packets are received, the test can continue. Fixes: 002ade70e933 ("app/test: measure cycles per packet in Rx/Tx") Cc: stable@dpdk.org Signed-off-by: Julien Meunier <julien.meunier@nokia.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--test/test/test_pmd_perf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c
index f5095c8..ed8524a 100644
--- a/test/test/test_pmd_perf.c
+++ b/test/test/test_pmd_perf.c
@@ -493,16 +493,21 @@ main_loop(__rte_unused void *args)
for (i = 0; i < conf->nb_ports; i++) {
portid = conf->portlist[i];
- int nb_free = pkt_per_port;
+ int nb_free = 0;
+ uint64_t timeout = 10000;
do { /* dry out */
nb_rx = rte_eth_rx_burst(portid, 0,
pkts_burst, MAX_PKT_BURST);
nb_tx = 0;
while (nb_tx < nb_rx)
rte_pktmbuf_free(pkts_burst[nb_tx++]);
- nb_free -= nb_rx;
- } while (nb_free != 0);
- printf("free %d mbuf left in port %u\n", pkt_per_port, portid);
+ nb_free += nb_rx;
+
+ if (unlikely(nb_rx == 0))
+ timeout--;
+ } while (nb_free != pkt_per_port && timeout != 0);
+ printf("free %d (expected %d) mbuf left in port %u\n", nb_free,
+ pkt_per_port, portid);
}
if (count == 0)