[dpdk-dev] testpmd: stop pkt forwarding when quitting testpmd

Message ID 1425035919-21060-1-git-send-email-pablo.de.lara.guarch@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

De Lara Guarch, Pablo Feb. 27, 2015, 11:18 a.m. UTC
  When user quits testpmd, and there is traffic being forwarded,
that may produce a segmentation fault, due to ports being closed,
while they are still transmitting packets.

This patch prevents the issue from happening,
by stopping packet forwarding before closing the ports.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-pmd/testpmd.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
  

Comments

Thomas Monjalon March 10, 2015, 3:23 p.m. UTC | #1
> When user quits testpmd, and there is traffic being forwarded,
> that may produce a segmentation fault, due to ports being closed,
> while they are still transmitting packets.
> 
> This patch prevents the issue from happening,
> by stopping packet forwarding before closing the ports.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 61291be..7be96ad 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1623,6 +1623,9 @@  pmd_test_exit(void)
 {
 	portid_t pt_id;
 
+	if (test_done == 0)
+		stop_packet_forwarding();
+
 	FOREACH_PORT(pt_id, ports) {
 		printf("Stopping port %d...", pt_id);
 		fflush(stdout);