FD.io VPP  v21.06-3-gbb25fbf28
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 (member_if_t * mif, 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  mif->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  */
lacp_rx_event_t
lacp_rx_event_t
Definition: rx_machine.h:31
lacp_rx_action_lacp_disabled
int lacp_rx_action_lacp_disabled(void *, void *)
Definition: rx_machine.c:309
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_start_current_while_timer
static void lacp_start_current_while_timer(vlib_main_t *vm, member_if_t *mif, u8 expiration)
Definition: rx_machine.h:77
lacp_rx_action_defaulted
int lacp_rx_action_defaulted(void *, void *)
Definition: rx_machine.c:323
lacp_rx_action_current
int lacp_rx_action_current(void *, void *)
Definition: rx_machine.c:362
lacp_rx_sm_state_t
lacp_rx_sm_state_t
Definition: rx_machine.h:46
machine.h
lacp_rx_action_initialize
int lacp_rx_action_initialize(void *, void *)
Definition: rx_machine.c:240
lacp_rx_action_port_disabled
int lacp_rx_action_port_disabled(void *, void *)
Definition: rx_machine.c:257
lacp_rx_machine
lacp_machine_t lacp_rx_machine
Definition: rx_machine.c:108
member_if_t
Definition: node.h:213
member_if_t::current_while_timer
f64 current_while_timer
Definition: node.h:286
lacp_rx_debug_func
void lacp_rx_debug_func(member_if_t *mif, int event, int state, lacp_fsm_state_t *transition)
Definition: rx_machine.c:399
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
foreach_lacp_rx_sm_state
#define foreach_lacp_rx_sm_state
Definition: rx_machine.h:38
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:325
lacp_rx_action_expired
int lacp_rx_action_expired(void *, void *)
Definition: rx_machine.c:282
lacp_rx_action_pdu_received
int lacp_rx_action_pdu_received(void *, void *)
lacp_machine_t
Definition: machine.h:40
foreach_lacp_rx_event
#define foreach_lacp_rx_event
Definition: rx_machine.h:22