diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-07-16 16:54:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-20 20:41:15 -0700 |
commit | 6ab30f9cbe134d19559f48dc748587d036529aaf (patch) | |
tree | 8eb7b335d5c29d6c6e629df973b888433dc83442 /net/tipc/link.h | |
parent | 426cc2b86d1813959497d608dcb52c32df2d448a (diff) | |
download | linux-6ab30f9cbe134d19559f48dc748587d036529aaf.tar.bz2 |
tipc: improve link FSM implementation
The link FSM implementation is currently unnecessarily complex.
It sometimes checks for conditional state outside the FSM data
before deciding next state, and often performs actions directly
inside the FSM logics.
In this commit, we create a second, simpler FSM implementation,
that as far as possible acts only on states and events that it is
strictly defined for, and postpone any actions until it is finished
with its decisions. It also returns an event flag field and an a
buffer queue which may potentially contain a protocol message to
be sent by the caller.
Unfortunately, we cannot yet make the FSM "clean", in the sense
that its decisions are only based on FSM state and event, and that
state changes happen only here. That will have to wait until the
activate/reset logics has been cleaned up in a future commit.
We also rename the link states as follows:
WORKING_WORKING -> TIPC_LINK_WORKING
WORKING_UNKNOWN -> TIPC_LINK_PROBING
RESET_UNKNOWN -> TIPC_LINK_RESETTING
RESET_RESET -> TIPC_LINK_ESTABLISHING
The existing FSM function, link_state_event(), is still needed for
a while, so we redesign it to make use of the new function.
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.h')
-rw-r--r-- | net/tipc/link.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/tipc/link.h b/net/tipc/link.h index 0509c6de03cd..ef68424f492d 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h @@ -58,6 +58,13 @@ enum { TIPC_LINK_TUNNEL }; +/* Events occurring at packet reception or at timeout + */ +enum { + TIPC_LINK_UP_EVT = 1, + TIPC_LINK_DOWN_EVT = (1 << 1) +}; + /* Starting value for maximum packet size negotiation on unicast links * (unless bearer MTU is less) */ |