app/testpmd: make quit flag volatile

Since f_quit is set in a signal handler it needs to be marked
volatile.  Otherwise, compiler is allowed to optimize the loop because
it can assume the value never changes. The flag can also be made local
to the file it is used in.

Fixes: d9a191a00e ("app/testpmd: fix quitting in container")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
This commit is contained in:
Stephen Hemminger 2022-11-08 10:07:43 -08:00 committed by Andrew Rybchenko
parent 7c06f1ab3b
commit 4c243bd4a8

View File

@ -231,7 +231,7 @@ unsigned int xstats_display_num; /**< Size of extended statistics to show */
* 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;
static volatile uint8_t f_quit;
uint8_t cl_quit; /* Quit testpmd from cmdline. */
/*