DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test: fix crash in pmd_perf_test
@ 2015-11-23 11:45 David Hunt
  2015-12-07  2:41 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: David Hunt @ 2015-11-23 11:45 UTC (permalink / raw)
  To: dev

Fix crash in pmd_perf_test autotest (div by 0) when no packets received
Also fixes the fact that the test passes even if exec_burst fails

To repeat the issue:
  The system must be incorrectly set up so that all packets will be lost, 
  i.e. no loopback cable, etc. This is an edge case, but still the test
  should not crash or pass when failing.
  run the test app
  RTE>> set_rxtx_sc poll_before_xmit
  RTE>> pmd_perf_autotest 
  --snip--
  > Generate 4096 packets @socket 1
  > start to receive total expect 4096
  > 4096 packets lost, IDLE 10000 times
  > Floating point exception (core dumped)

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 app/test/test_pmd_perf.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 8f55640..25b4d09 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -626,7 +626,10 @@ timeout:
 
 	rte_free(pkts_burst);
 
-	return diff_tsc / total;
+	if (total > 0)
+		return diff_tsc / total;
+	else
+		return -1;
 }
 
 static int
@@ -673,8 +676,10 @@ exec_burst(uint32_t flags, int lcore)
 
 	/* wait for polling finished */
 	diff_tsc = rte_eal_wait_lcore(lcore);
-	if (diff_tsc < 0)
+	if (diff_tsc < 0) {
+		printf("exec_burst: Failed to measure cycles per packet\n");
 		return -1;
+	}
 
 	printf("Result: %d cycles per packet\n", diff_tsc);
 
@@ -811,7 +816,8 @@ test_pmd_perf(void)
 			return -1;
 	} else if (sc_flag == SC_BURST_POLL_FIRST ||
 		   sc_flag == SC_BURST_XMIT_FIRST)
-		exec_burst(sc_flag, slave_id);
+		if (exec_burst(sc_flag, slave_id) < 0)
+			return -1;
 
 	/* port tear down */
 	for (portid = 0; portid < nb_ports; portid++) {
-- 
2.1.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] test: fix crash in pmd_perf_test
  2015-11-23 11:45 [dpdk-dev] [PATCH] test: fix crash in pmd_perf_test David Hunt
@ 2015-12-07  2:41 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-12-07  2:41 UTC (permalink / raw)
  To: David Hunt; +Cc: dev

2015-11-23 11:45, David Hunt:
> Fix crash in pmd_perf_test autotest (div by 0) when no packets received
> Also fixes the fact that the test passes even if exec_burst fails
> 
> To repeat the issue:
>   The system must be incorrectly set up so that all packets will be lost, 
>   i.e. no loopback cable, etc. This is an edge case, but still the test
>   should not crash or pass when failing.
>   run the test app
>   RTE>> set_rxtx_sc poll_before_xmit
>   RTE>> pmd_perf_autotest 
>   --snip--
>   > Generate 4096 packets @socket 1
>   > start to receive total expect 4096
>   > 4096 packets lost, IDLE 10000 times
>   > Floating point exception (core dumped)
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 11:45 [dpdk-dev] [PATCH] test: fix crash in pmd_perf_test David Hunt
2015-12-07  2:41 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).