FD.io VPP  v19.01.1-17-ge106252
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 (slave_if_t * sif, 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  sif->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  */
static void lacp_start_wait_while_timer(vlib_main_t *vm, slave_if_t *sif, u8 expiration)
Definition: mux_machine.h:66
int lacp_mux_action_collecting_distributing(void *p1, void *p2)
Definition: mux_machine.c:170
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:232
#define foreach_lacp_mux_sm_state
Definition: mux_machine.h:37
unsigned char u8
Definition: types.h:56
int lacp_mux_action_attached(void *p1, void *p2)
Definition: mux_machine.c:122
void lacp_mux_debug_func(slave_if_t *sif, int event, int state, lacp_fsm_state_t *transition)
Definition: mux_machine.c:213
lacp_mux_sm_state_t
Definition: mux_machine.h:43
vhost_vring_state_t state
Definition: vhost_user.h:120
#define foreach_lacp_mux_event
Definition: mux_machine.h:22
lacp_machine_t lacp_mux_machine
Definition: mux_machine.c:77
vlib_main_t * vm
Definition: buffer.c:301
int lacp_mux_action_waiting(void *p1, void *p2)
Definition: mux_machine.c:148
lacp_mux_event_t
Definition: mux_machine.h:30
int lacp_mux_action_detached(void *p1, void *p2)
Definition: mux_machine.c:97
f64 wait_while_timer
Definition: node.h:278