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.