Line data Source code
1 : /*
2 : * Copyright (c) 2017 Cisco and/or its affiliates.
3 : * Licensed under the Apache License, Version 2.0 (the "License");
4 : * you may not use this file except in compliance with the License.
5 : * You may obtain a copy of the License at:
6 : *
7 : * http://www.apache.org/licenses/LICENSE-2.0
8 : *
9 : * Unless required by applicable law or agreed to in writing, software
10 : * distributed under the License is distributed on an "AS IS" BASIS,
11 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : * See the License for the specific language governing permissions and
13 : * limitations under the License.
14 : */
15 :
16 : #ifndef __LACP_MUX_MACHINE_H__
17 : #define __LACP_MUX_MACHINE_H__
18 :
19 : #include <stdint.h>
20 : #include <lacp/machine.h>
21 :
22 : #define foreach_lacp_mux_event \
23 : _(0, BEGIN, "begin") \
24 : _(1, SELECTED, "selected") \
25 : _(2, STANDBY, "standby") \
26 : _(3, UNSELECTED, "unselected") \
27 : _(4, READY, "ready") \
28 : _(5, SYNC, "sync")
29 :
30 : typedef enum
31 : {
32 : #define _(a, b, c) LACP_MUX_EVENT_##b = (a),
33 : foreach_lacp_mux_event
34 : #undef _
35 : } lacp_mux_event_t;
36 :
37 : #define foreach_lacp_mux_sm_state \
38 : _(0, DETACHED, "detached") \
39 : _(1, WAITING, "waiting") \
40 : _(2, ATTACHED, "attached") \
41 : _(3, COLLECTING_DISTRIBUTING, "collecting distributing")
42 :
43 : typedef enum
44 : {
45 : #define _(a, b, c) LACP_MUX_STATE_##b = (a),
46 : foreach_lacp_mux_sm_state
47 : #undef _
48 : } lacp_mux_sm_state_t;
49 :
50 : extern lacp_machine_t lacp_mux_machine;
51 :
52 : int lacp_mux_action_detached (void *p1, void *p2);
53 : int lacp_mux_action_attached (void *p1, void *p2);
54 : int lacp_mux_action_waiting (void *p1, void *p2);
55 : int lacp_mux_action_collecting_distributing (void *p1, void *p2);
56 : void lacp_mux_debug_func (member_if_t * mif, int event, int state,
57 : lacp_fsm_state_t * transition);
58 :
59 : #define LACP_ACTION_DETACHED LACP_ACTION_ROUTINE(lacp_mux_action_detached)
60 : #define LACP_ACTION_ATTACHED LACP_ACTION_ROUTINE(lacp_mux_action_attached)
61 : #define LACP_ACTION_WAITING LACP_ACTION_ROUTINE(lacp_mux_action_waiting)
62 : #define LACP_ACTION_COLLECTING_DISTRIBUTING \
63 : LACP_ACTION_ROUTINE(lacp_mux_action_collecting_distributing)
64 :
65 : static inline void
66 5 : lacp_start_wait_while_timer (vlib_main_t * vm, member_if_t * mif,
67 : u8 expiration)
68 : {
69 5 : mif->wait_while_timer = vlib_time_now (vm) + expiration;
70 5 : }
71 :
72 : #endif /* __LACP_MUX_MACHINE_H__ */
73 :
74 : /*
75 : * fd.io coding-style-patch-verification: ON
76 : *
77 : * Local Variables:
78 : * eval: (c-set-style "gnu")
79 : * End:
80 : */
|