In container, the process cannot be terminated by SIGINT/SIGTERM when
execute with 'stats-period' option.
Fixed by adding a flag to exit stats period loop after received either
SIGINT or SIGTERM.
Fixes:
cfea1f3048d1 ("app/testpmd: print statistics periodically")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
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) */
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.
*/
/*
* Configuration of packet segments used by the "txonly" processing engine.
*/
rte_latencystats_uninit();
#endif
force_quit();
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);
/* exit with the expected status */
signal(signum, SIG_DFL);
kill(getpid(), signum);
printf("No commandline core given, start packet forwarding\n");
start_packet_forwarding(tx_first);
if (stats_period != 0) {
printf("No commandline core given, start packet forwarding\n");
start_packet_forwarding(tx_first);
if (stats_period != 0) {
/* Convert to number of cycles */
timer_period = stats_period * rte_get_timer_hz();
/* Convert to number of cycles */
timer_period = stats_period * rte_get_timer_hz();
cur_time = rte_get_timer_cycles();
diff_time += cur_time - prev_time;
cur_time = rte_get_timer_cycles();
diff_time += cur_time - prev_time;