From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd Date: Wed, 30 Dec 2015 18:09:11 -0800 Message-ID: <20151230180911.2a14218b@xeon-e3> References: <1451011032-83106-1-git-send-email-zhihong.wang@intel.com> <1451431644-98362-1-git-send-email-zhihong.wang@intel.com> <1451431644-98362-4-git-send-email-zhihong.wang@intel.com> <2601191342CEEE43887BDE71AB97725836ADF284@irsmsx105.ger.corp.intel.com> <8F6C2BD409508844A0EFC19955BE094186474F@SHSMSX103.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" To: "Wang, Zhihong" Return-path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 76A4268A5 for ; Thu, 31 Dec 2015 03:09:02 +0100 (CET) Received: by mail-pa0-f48.google.com with SMTP id uo6so124147794pac.1 for ; Wed, 30 Dec 2015 18:09:02 -0800 (PST) In-Reply-To: <8F6C2BD409508844A0EFC19955BE094186474F@SHSMSX103.ccr.corp.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 31 Dec 2015 01:44:20 +0000 "Wang, Zhihong" wrote: > > > +#define PORT_IDLE 0 > > > +#define PORT_INIT 1 > > > +#define PORT_WORK 2 > > > +#define PORT_STOP 3 > > > +#define PORT_QUIT 4 > > > > Seems ok, but over-complicated. > > I think all you need is just IDLE, INIT, QUIT. > > Yes for l2/l3fwd 3 states are enough. > I implement a full state machine so it can also serve as an example on how to do this in other cases, like where stop might be called before or during init. These are examples, it is better to have as little code as necessary to get the job done. That makes the example clearer. Adding extra unnecessary complexity just makes it harder to understand.