Skip to contentSkip to conversation

app/testpmd: fix stats period can't quit normally in container

PATCH New Phil Yang 1 participant 1 message Sep 18, 2017

lore
Share & tools
lore

Phil Yang

author
#0 lore raw

PATCH 1/1 app/testpmd: fix stats period can't quit normally in container

While running testpmd in container with stats-period option, it can't quit normally after received SIGINT.

---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +4 -1
index e097ee0..a4da9ea 100644
@@ -183,6 +183,7 @@ uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
 uint16_t stats_period; /**< Period to show statistics (disabled by default) */
+uint8_t  f_quit = 0; /* Receive LSC INTERRUPTION to stop show statistics periodically */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2285,6 +2286,8 @@ init_port(void)
 static void
 force_quit(void)
 {
+	f_quit = 1;
+
 	pmd_test_exit();
 	prompt_exit();
 }
@@ -2444,7 +2447,7 @@ main(int argc, char** argv)
 			/* Convert to number of cycles */
 			timer_period = stats_period * rte_get_timer_hz();
 
-			while (1) {
+			while (!f_quit) {
 				cur_time = rte_get_timer_cycles();
 				diff_time += cur_time - prev_time;
 
Signature · 1 line
2.7.4