[dpdk-dev] [PATCH v3 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd

Stephen Hemminger stephen at networkplumber.org
Wed Dec 30 18:37:58 CET 2015


On Mon, 28 Dec 2015 20:20:32 -0500
Zhihong Wang <zhihong.wang at intel.com> wrote:

> Handle SIGINT and SIGTERM in l3fwd.
> 
> Signed-off-by: Zhihong Wang <zhihong.wang at intel.com>
> Acked-by: Michael Qiu <michael.qiu at intel.com>
> ---
>  examples/l3fwd/main.c | 129 +++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 107 insertions(+), 22 deletions(-)
> 
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 5b0c2dd..c766cf5 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -41,6 +41,9 @@
>  #include <stdarg.h>
>  #include <errno.h>
>  #include <getopt.h>
> +#include <signal.h>
> +#include <unistd.h>
> +#include <stdbool.h>
>  
>  #include <rte_common.h>
>  #include <rte_vect.h>
> @@ -75,6 +78,10 @@
>  #include <cmdline_parse.h>
>  #include <cmdline_parse_etheraddr.h>
>  
> +static volatile bool port_started;
> +static volatile bool force_quit;
> +static volatile int signo_quit;

I don't think you need the port_started or signo_quit logic.

The port_started logic is racy, and if you write the loops
correctly, is unnecessary.

The signo_quit logic is unnecessary, since exit code of interrupted
program doesn't matter. 


More information about the dev mailing list