FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
mux_machine.h
Go to the documentation of this file.
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),
34 #undef _
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),
47 #undef _
49 
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
67  u8 expiration)
68 {
69  mif->wait_while_timer = vlib_time_now (vm) + expiration;
70 }
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  */
lacp_mux_action_attached
int lacp_mux_action_attached(void *p1, void *p2)
Definition: mux_machine.c:121
member_if_t::wait_while_timer
f64 wait_while_timer
Definition: node.h:310
lacp_mux_action_detached
int lacp_mux_action_detached(void *p1, void *p2)
Definition: mux_machine.c:97
lacp_mux_debug_func
void lacp_mux_debug_func(member_if_t *mif, int event, int state, lacp_fsm_state_t *transition)
Definition: mux_machine.c:207
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
state
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
lacp_fsm_state_t
Definition: machine.h:26
lacp_mux_action_collecting_distributing
int lacp_mux_action_collecting_distributing(void *p1, void *p2)
Definition: mux_machine.c:166
machine.h
foreach_lacp_mux_sm_state
#define foreach_lacp_mux_sm_state
Definition: mux_machine.h:37
lacp_mux_event_t
lacp_mux_event_t
Definition: mux_machine.h:30
lacp_mux_machine
lacp_machine_t lacp_mux_machine
Definition: mux_machine.c:77
member_if_t
Definition: node.h:213
lacp_mux_action_waiting
int lacp_mux_action_waiting(void *p1, void *p2)
Definition: mux_machine.c:146
foreach_lacp_mux_event
#define foreach_lacp_mux_event
Definition: mux_machine.h:22
lacp_start_wait_while_timer
static void lacp_start_wait_while_timer(vlib_main_t *vm, member_if_t *mif, u8 expiration)
Definition: mux_machine.h:66
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:325
lacp_machine_t
Definition: machine.h:40
lacp_mux_sm_state_t
lacp_mux_sm_state_t
Definition: mux_machine.h:43