[dpdk-dev] [PATCH v2 4/8] app/testpmd: reconfigure forwarding after changing portlist

Bernard Iremonger bernard.iremonger at intel.com
Thu May 5 17:39:51 CEST 2016


Set nb_fwd_ports to zero on quit.
Check portlist has been set before displaying forwarding configuration.

Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
Fixes: af75078fece3 ("first public release")

Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
 app/test-pmd/config.c  | 8 ++++++--
 app/test-pmd/testpmd.c | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f434999..10ac768 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config *cfg)
 void
 fwd_config_display(void)
 {
-	fwd_config_setup();
-	pkt_fwd_config_display(&cur_fwd_config);
+	if (cur_fwd_config.nb_fwd_ports)
+		pkt_fwd_config_display(&cur_fwd_config);
+	else
+		printf("Please set portlist first\n");
 }
 
 int
@@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt)
 		       (unsigned int) nb_fwd_ports, nb_pt);
 		nb_fwd_ports = (portid_t) nb_pt;
 	}
+
+	fwd_config_setup();
 }
 
 void
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 11b4cf7..2c58075 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1560,6 +1560,7 @@ pmd_test_exit(void)
 
 	if (ports != NULL) {
 		no_link_check = 1;
+		nb_fwd_ports = 0;
 		FOREACH_PORT(pt_id, ports) {
 			printf("\nShutting down port %d...\n", pt_id);
 			fflush(stdout);
-- 
2.6.3



More information about the dev mailing list