From mboxrd@z Thu Jan 1 00:00:00 1970 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) 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=n26rZOueL868kprXqICjcoektDdx0KypbI9ISIokiq8=; b=Uyolv0oocJdBh8gfFqKyZB3ygP09z7Vw0/M0l3cF24nq/fkghkbJIPX8DHZAwveMyk pKuseIGECX2+yoZMyvxIvgXPy8D5j6+Hjp2tyg8en/OVPqJx5FuwER7mOHb9c1BSSN1C sITYP0QH+ciGrEOTxVDHXGcoeIbBoHCUoGvlLW02NskjArq6E7VA5Pc92C5HTjMqh1PH Zj4oOzoLzfOj3wdbWTxlfECgZ/US+gZHkhnn6euvrBnuYR2MyJwTHfBh8QjyuTu//26I L193/a6VBasSWUxiUKEpZHsYNNZVh0Oi01ofRUNjQ3X1hZIFh2IXBm1irLPjsx8QbD03 00PA== 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=n26rZOueL868kprXqICjcoektDdx0KypbI9ISIokiq8=; b=WfRAPQrrQmUrrWmtc7onwF0oinspB+vakLDHnCN1yo6yFGgoNXpQLb6vEmXh2eLlXT 9/nucbr/9KdTHZVb5sI7W3w7e3MPDNt89AjB1qjbJvKJ1dV9TA9cuGJqGEsHktzWsE6x fplX562yfFrkyTX2hCMYSt0sIrgAtOjQU0DDdNPbwimqBDKfGuLjHM0+Vfka0xScsqZs 6h6sbEJmLsVQ0C4SOigx/aRqCaLB6QNkkakpnm2OWLgj0NxLRiwnllby8NvLFEe5Wd5u RlZncEnEKHqSzDTG7maqyO7zrm7O28VbsZBpBUchoQDuCn/pIEv6NeH7NwFbJCzP89EB VGxg== X-Gm-Message-State: ALoCoQlzzK2OOiWoQrlMVv8ya5nxqqJlJufNKIC6rBp125FRQhm3kfXtZx1gNKxNgyfPzPIw0jlyyFE6c7SSzxZOJgofTTSHfQ== X-Received: by 10.66.250.165 with SMTP id zd5mr24270104pac.9.1451527741861; Wed, 30 Dec 2015 18:09:01 -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 x22sm80110739pfa.82.2015.12.30.18.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Dec 2015 18:09:01 -0800 (PST) Date: Wed, 30 Dec 2015 18:09:11 -0800 From: Stephen Hemminger To: "Wang, Zhihong" Message-ID: <20151230180911.2a14218b@xeon-e3> In-Reply-To: <8F6C2BD409508844A0EFC19955BE094186474F@SHSMSX103.ccr.corp.intel.com> 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" Subject: Re: [dpdk-dev] [PATCH v4 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 02:09:02 -0000 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.