DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Subject: [PATCH v3 2/3] testpmd: use sig_atomic_t for flag
Date: Tue, 14 Mar 2023 10:36:47 -0700	[thread overview]
Message-ID: <20230314173648.69528-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20230314173648.69528-1-stephen@networkplumber.org>

Standard conforming signal handling in applications should use sig_atomic_t
for flags set by signal handler.
 https://www.gnu.org/software/libc/manual/html_node/Atomic-Data-Access.html

This is really just a fancy way of saying ''int'' but adds
to platform portablilty for DPDK.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/testpmd.c | 6 +-----
 app/test-pmd/testpmd.h | 3 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5cb6f9252395..aee926571f53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -228,11 +228,7 @@ struct rte_eth_xstat_name *xstats_display;
 
 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.
- */
-volatile uint8_t f_quit;
+volatile sig_atomic_t f_quit;	/* Quit testpmd from signal */
 uint8_t cl_quit; /* Quit testpmd from cmdline. */
 
 /*
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index bdfbfd36d3c5..5c11d4f86301 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -6,6 +6,7 @@
 #define _TESTPMD_H_
 
 #include <stdbool.h>
+#include <signal.h>
 
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
@@ -34,7 +35,7 @@
 #define RTE_PORT_HANDLING       (uint16_t)3
 
 extern uint8_t cl_quit;
-extern volatile uint8_t f_quit;
+extern volatile sig_atomic_t f_quit;
 
 /*
  * It is used to allocate the memory for hash key.
-- 
2.39.2


  parent reply	other threads:[~2023-03-14 17:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 17:19 [RFT] test-pmd: go back to using cmdline_interact Stephen Hemminger
2023-03-13 21:38 ` [RFT v2] " Stephen Hemminger
2023-03-14  7:06   ` Ling, WeiX
     [not found]   ` <MW4PR12MB56684FA660218F925D64BE09A4BE9@MW4PR12MB5668.namprd12.prod.outlook.com>
2023-03-14 12:07     ` Pier Damouny
2023-03-14 17:36 ` [PATCH v3 0/3] testpmd control C fixes Stephen Hemminger
2023-03-14 17:36   ` [PATCH v3 1/3] testpmd: go back to using cmdline_interact Stephen Hemminger
2023-03-14 17:36   ` Stephen Hemminger [this message]
2023-03-15 16:31     ` [PATCH v3 2/3] testpmd: use sig_atomic_t for flag Stephen Hemminger
2023-03-14 17:36   ` [PATCH v3 3/3] testpmd: enable interrupt in interactive mode Stephen Hemminger
2023-03-14 22:40   ` [PATCH v3 0/3] testpmd control C fixes Stephen Hemminger
2023-03-15  9:46     ` David Marchand
2023-03-15 17:31 ` [PATCH v4 0/2] Fix testpmd interrupt regression Stephen Hemminger
2023-03-15 17:31   ` [PATCH v4 1/2] testpmd: go back to using cmdline_interact Stephen Hemminger
2023-03-17 16:20     ` Olivier Matz
2023-03-17 16:38       ` Stephen Hemminger
2023-03-15 17:31   ` [PATCH v4 2/2] testpmd: enable interrupt in interactive mode Stephen Hemminger
2023-03-17 16:20     ` Olivier Matz
2023-03-17 16:25       ` Stephen Hemminger
2023-03-16  8:16   ` [PATCH v4 0/2] Fix testpmd interrupt regression Pier Damouny
2023-03-16 12:20   ` Ferruh Yigit
2023-03-16 15:31     ` Stephen Hemminger
2023-03-16 17:01       ` Ferruh Yigit
2023-03-16 17:05         ` Thomas Monjalon
2023-03-16 17:36           ` Ferruh Yigit
2023-03-16 17:27   ` [PATCH] app/testpmd: revert cleanup cleanly from signal Ferruh Yigit
2023-03-17 16:59 ` [PATCH v5] testpmd: go back to using cmdline_interact Stephen Hemminger
2023-03-17 21:12   ` Olivier Matz
2023-03-19 23:28     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230314173648.69528-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).