> -----Original Message----- > From: Stephen Hemminger [mailto:stephen at networkplumber.org] > Sent: Thursday, December 31, 2015 10:09 AM > To: Wang, Zhihong <zhihong.wang at intel.com> > Cc: Ananyev, Konstantin <konstantin.ananyev at intel.com>; dev at dpdk.org; > Qiu, > Michael <michael.qiu at intel.com> > Subject: Re: [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in > l3fwd > > On Thu, 31 Dec 2015 01:44:20 +0000 > "Wang, Zhihong" <zhihong.wang at intel.com> 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.
Thanks for the suggestions! I'll send the v5 combining your comments and Konstantin's together to make it simpler.