• Jon Paul Maloy's avatar
    tipc: merge link->exec_mode and link->state into one FSM · 662921cd
    Jon Paul Maloy authored
    Until now, we have been handling link failover and synchronization
    by using an additional link state variable, "exec_mode". This variable
    is not independent of the link FSM state, something causing a risk of
    inconsistencies, apart from the fact that it clutters the code.
    
    The conditions are now in place to define a new link FSM that covers
    all existing use cases, including failover and synchronization, and
    eliminate the "exec_mode" field altogether. The FSM must also support
    non-atomic resetting of links, which will be introduced later.
    
    The new link FSM is shown below, with 7 states and 8 events.
    Only events leading to state change are shown as edges.
    
    +------------------------------------+
    |RESET_EVT                           |
    |                                    |
    |                             +--------------+
    |           +-----------------|   SYNCHING   |-----------------+
    |           |FAILURE_EVT      +--------------+   PEER_RESET_EVT|
    |           |                  A            |                  |
    |           |                  |            |                  |
    |           |                  |            |                  |
    |           |                  |SYNCH_      |SYNCH_            |
    |           |                  |BEGIN_EVT   |END_EVT           |
    |           |                  |            |                  |
    |           V                  |            V                  V
    |    +-------------+          +--------------+          +------------+
    |    |  RESETTING  |<---------|  ESTABLISHED |--------->| PEER_RESET |
    |    +-------------+ FAILURE_ +--------------+ PEER_    +------------+
    |           |        EVT        |    A         RESET_EVT       |
    |           |                   |    |                         |
    |           |                   |    |                         |
    |           |    +--------------+    |                         |
    |  RESET_EVT|    |RESET_EVT          |ESTABLISH_EVT            |
    |           |    |                   |                         |
    |           |    |                   |                         |
    |           V    V                   |                         |
    |    +-------------+          +--------------+        RESET_EVT|
    +--->|    RESET    |--------->| ESTABLISHING |<----------------+
         +-------------+ PEER_    +--------------+
          |           A  RESET_EVT       |
          |           |                  |
          |           |                  |
          |FAILOVER_  |FAILOVER_         |FAILOVER_
          |BEGIN_EVT  |END_EVT           |BEGIN_EVT
          |           |                  |
          V           |                  |
         +-------------+                 |
         | FAILINGOVER |<----------------+
         +-------------+
    
    These changes are fully backwards compatible.
    Tested-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    662921cd
node.c 31.1 KB