FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
rx_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_RX_MACHINE_H__
17 #define __LACP_RX_MACHINE_H__
18 
19 #include <stdint.h>
20 #include <lacp/machine.h>
21 
22 #define foreach_lacp_rx_event \
23  _(0, BEGIN, "begin") \
24  _(1, PORT_DISABLED, "port disabled") \
25  _(2, PORT_MOVED, "port moved") \
26  _(3, LACP_ENABLED, "lacp enabled") \
27  _(4, LACP_DISABLED, "lacp disabled") \
28  _(5, PDU_RECEIVED, "pdu received") \
29  _(6, TIMER_EXPIRED, "timer expired")
30 
31 typedef enum
32 {
33 #define _(a, b, c) LACP_RX_EVENT_##b = (a),
35 #undef _
37 
38 #define foreach_lacp_rx_sm_state \
39  _(0, INITIALIZE, "initialize") \
40  _(1, PORT_DISABLED, "port disabled") \
41  _(2, EXPIRED, "expired") \
42  _(3, LACP_DISABLED, "lacp disabled") \
43  _(4, DEFAULTED, "defaulted") \
44  _(5, CURRENT, "current")
45 
46 typedef enum
47 {
48 #define _(a, b, c) LACP_RX_STATE_##b = (a),
50 #undef _
52 
54 
55 int lacp_rx_action_initialize (void *, void *);
56 int lacp_rx_action_port_disabled (void *, void *);
57 int lacp_rx_action_pdu_received (void *, void *);
58 int lacp_rx_action_expired (void *, void *);
59 int lacp_rx_action_lacp_disabled (void *, void *);
60 int lacp_rx_action_defaulted (void *, void *);
61 int lacp_rx_action_current (void *, void *);
62 void lacp_rx_debug_func (slave_if_t * sif, int event, int state,
63  lacp_fsm_state_t * transition);
64 
65 #define LACP_ACTION_INITIALIZE \
66  LACP_ACTION_ROUTINE(lacp_rx_action_initialize)
67 #define LACP_ACTION_PORT_DISABLED \
68  LACP_ACTION_ROUTINE(lacp_rx_action_port_disabled)
69 #define LACP_ACTION_EXPIRED \
70  LACP_ACTION_ROUTINE(lacp_rx_action_expired)
71 #define LACP_ACTION_LACP_DISABLED \
72  LACP_ACTION_ROUTINE(lacp_rx_action_lacp_disabled)
73 #define LACP_ACTION_DEFAULTED LACP_ACTION_ROUTINE(lacp_rx_action_defaulted)
74 #define LACP_ACTION_CURRENT LACP_ACTION_ROUTINE(lacp_rx_action_current)
75 
76 static inline void
78  u8 expiration)
79 {
80  sif->current_while_timer = vlib_time_now (vm) + expiration;
81 }
82 
83 #endif /* __LACP_RX_MACHINE_H__ */
84 
85 /*
86  * fd.io coding-style-patch-verification: ON
87  *
88  * Local Variables:
89  * eval: (c-set-style "gnu")
90  * End:
91  */
int lacp_rx_action_lacp_disabled(void *, void *)
Definition: rx_machine.c:308
lacp_machine_t lacp_rx_machine
Definition: rx_machine.c:108
int lacp_rx_action_defaulted(void *, void *)
Definition: rx_machine.c:322
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:227
void lacp_rx_debug_func(slave_if_t *sif, int event, int state, lacp_fsm_state_t *transition)
Definition: rx_machine.c:400
f64 current_while_timer
Definition: node.h:246
#define foreach_lacp_rx_sm_state
Definition: rx_machine.h:38
lacp_rx_sm_state_t
Definition: rx_machine.h:46
int lacp_rx_action_port_disabled(void *, void *)
Definition: rx_machine.c:254
int lacp_rx_action_initialize(void *, void *)
Definition: rx_machine.c:237
vlib_main_t * vm
Definition: buffer.c:294
int lacp_rx_action_expired(void *, void *)
Definition: rx_machine.c:279
vhost_vring_state_t state
Definition: vhost-user.h:82
unsigned char u8
Definition: types.h:56
int lacp_rx_action_pdu_received(void *, void *)
static void lacp_start_current_while_timer(vlib_main_t *vm, slave_if_t *sif, u8 expiration)
Definition: rx_machine.h:77
lacp_rx_event_t
Definition: rx_machine.h:31
#define foreach_lacp_rx_event
Definition: rx_machine.h:22
int lacp_rx_action_current(void *, void *)
Definition: rx_machine.c:360