X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Ftestpmd.c;fp=app%2Ftest-pmd%2Ftestpmd.c;h=667c2286f6d02f50db7abf63f582295fafd152ab;hb=d9a191a00e817739e2a6ecc01178a29918adf199;hp=1f0d8f1afb24663cf5dd5cc5df5000c15733f89d;hpb=65a7360cc3378f5b3edd59f230141462dd98cfe9;p=dpdk.git diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1f0d8f1afb..667c2286f6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -180,6 +180,13 @@ 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) */ + +/* + * In container, it cannot terminate the process which running with 'stats-period' + * option. Set flag to exit stats period loop after received SIGINT/SIGTERM. + */ +uint8_t f_quit; + /* * Configuration of packet segments used by the "txonly" processing engine. */ @@ -2335,6 +2342,8 @@ signal_handler(int signum) rte_latencystats_uninit(); #endif force_quit(); + /* Set flag to indicate the force termination. */ + f_quit = 1; /* exit with the expected status */ signal(signum, SIG_DFL); kill(getpid(), signum); @@ -2457,6 +2466,8 @@ main(int argc, char** argv) char c; int rc; + f_quit = 0; + printf("No commandline core given, start packet forwarding\n"); start_packet_forwarding(tx_first); if (stats_period != 0) { @@ -2466,7 +2477,7 @@ main(int argc, char** argv) /* Convert to number of cycles */ timer_period = stats_period * rte_get_timer_hz(); - while (1) { + while (f_quit == 0) { cur_time = rte_get_timer_cycles(); diff_time += cur_time - prev_time;