From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com
 [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id 6637169C8
 for <dev@dpdk.org>; Wed, 30 Dec 2015 18:37:49 +0100 (CET)
Received: by mail-pf0-f179.google.com with SMTP id 78so144622763pfw.2
 for <dev@dpdk.org>; Wed, 30 Dec 2015 09:37:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-type:content-transfer-encoding;
 bh=urD1b8mKsvxyDelG4nCc276+/M18DjJOK98iGVRhClU=;
 b=cesOMTJgM3ZrGVrlk1vMawcvcyukFskABSh+76R3dRbIGOTe3Hb2tsCIxDHQRhcr0e
 oxzQr7bhZTQLQYe1bqyBj9y8pK5/0712GV76FedsiCZNbIKB4+LXE1kgtnexTSdy5rGr
 dFBBNyIImExm9AEEzulfInXrq7xjMPdLVv06XpzrDwR8B4ZnKC1OnFwiTx4BcaAW+S2c
 VjYarYoBrXFApXJrZK14GELw9DRwu2wOSbKjcf4pjut9bVvgVIGDDkOF4EmlnBYtrijr
 aZyAuJBwtKHGAU1UlJu6fS1KW1RIHLvcuuGybRA/6Ijw089MSnXc0EjTB6CvwUJVybVQ
 OkSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-type:content-transfer-encoding;
 bh=urD1b8mKsvxyDelG4nCc276+/M18DjJOK98iGVRhClU=;
 b=NWPmLyvki6pxAbMgdk8F27B312/tcN0fmU48J8LqSNu/tigpZ9AkeaZF+TI9DNB6Pp
 VBso7IpeDjf44qzU68cOohUZE4W2LMsCS48rc2AMwyfOJeNDiOotIMgvl5C+34d38p6g
 8zKkY7TvQhSfE+IVovUIbc5iU8rZjKj3BqZvDwck6zhAjv7+6/P2n96OkBtD08QE2fY8
 RaMVrX7Wm7m7RAow4hQgMcV7TqhO5TIfsdNd94iQ4z1Gyy0uf1y7ChTLmAt0UMUQQ3v/
 Jhu+IjHHvUtuNqYg6nZfL0aiGMFOGxr+IKP9oddSjse1GZStPlJ6XnTY+9Zrsnl20Whq
 dZLQ==
X-Gm-Message-State: ALoCoQkGUGMhkZfC0sca2Ee1wN8MK41YU/UTzjyQxTvBmxR3D7MzvhwFx0i2iQVfLHY+pnco1ymMjjU7xVNsvMqhfoYlVGPxfQ==
X-Received: by 10.98.42.149 with SMTP id q143mr95489724pfq.75.1451497068817;
 Wed, 30 Dec 2015 09:37:48 -0800 (PST)
Received: from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net.
 [50.53.82.155])
 by smtp.gmail.com with ESMTPSA id d8sm20053511pas.14.2015.12.30.09.37.48
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 30 Dec 2015 09:37:48 -0800 (PST)
Date: Wed, 30 Dec 2015 09:37:58 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Zhihong Wang <zhihong.wang@intel.com>
Message-ID: <20151230093758.1b700c1a@xeon-e3>
In-Reply-To: <1451352032-105576-4-git-send-email-zhihong.wang@intel.com>
References: <1451011032-83106-1-git-send-email-zhihong.wang@intel.com>
 <1451352032-105576-1-git-send-email-zhihong.wang@intel.com>
 <1451352032-105576-4-git-send-email-zhihong.wang@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 3/3] examples/l3fwd: Handle SIGINT and
 SIGTERM in l3fwd
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Dec 2015 17:37:49 -0000

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

> Handle SIGINT and SIGTERM in l3fwd.
> 
> Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
> Acked-by: Michael Qiu <michael.qiu@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.