Thread (36 messages) 36 messages, 5 authors, 2016-01-27

Re: [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2015-12-31 02:09:02

On Thu, 31 Dec 2015 01:44:20 +0000
"Wang, Zhihong" [off-list ref] wrote:
quoted
quoted
+#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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help