100 {lacp_rx_state_initialize},
101 {lacp_rx_state_port_disabled},
102 {lacp_rx_state_expired},
103 {lacp_rx_state_lacp_disabled},
104 {lacp_rx_state_defaulted},
105 {lacp_rx_state_current},
116 sif->
selected = LACP_PORT_UNSELECTED;
120 case LACP_MUX_STATE_DETACHED:
122 case LACP_MUX_STATE_WAITING:
124 case LACP_MUX_STATE_ATTACHED:
127 case LACP_MUX_STATE_COLLECTING_DISTRIBUTING:
128 if (sif->
partner.state & LACP_STATE_SYNCHRONIZATION)
135 LACP_MUX_EVENT_UNSELECTED, &sif->
mux_state);
142 (sif->
partner.state & LACP_STATE_AGGREGATION) ||
154 sif->
actor.state |= LACP_STATE_DEFAULTED;
160 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
162 if ((lacpdu->actor.port_info.state & LACP_STATE_AGGREGATION) !=
163 (sif->
partner.state & LACP_STATE_AGGREGATION) ||
164 memcmp (&sif->
partner, &lacpdu->actor.port_info,
174 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
175 u8 states = LACP_STATE_LACP_ACTIVITY | LACP_STATE_LACP_TIMEOUT |
176 LACP_STATE_SYNCHRONIZATION | LACP_STATE_AGGREGATION;
179 if ((states & lacpdu->partner.port_info.state) !=
180 (states & sif->
actor.state)
181 || memcmp (&sif->
actor, &lacpdu->partner.port_info,
182 sizeof (sif->
actor) -
sizeof (sif->
actor.state)))
196 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
198 if ((!memcmp (&sif->
partner, &lacpdu->actor.port_info,
200 ((sif->
actor.state & LACP_STATE_AGGREGATION) ==
201 (lacpdu->partner.port_info.state & LACP_STATE_AGGREGATION))) ||
202 ((lacpdu->actor.port_info.state & LACP_STATE_AGGREGATION) == 0))
211 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
215 sif->
partner = lacpdu->actor.port_info;
216 sif->
actor.state &= ~LACP_STATE_DEFAULTED;
217 if (match && (lacpdu->actor.port_info.state & LACP_STATE_SYNCHRONIZATION))
218 sif->
partner.state |= LACP_STATE_SYNCHRONIZATION;
220 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
230 LACP_RX_EVENT_PORT_MOVED, &sif->
rx_state);
233 LACP_RX_EVENT_PORT_DISABLED, &sif->
rx_state);
244 sif->
actor.state &= ~LACP_STATE_EXPIRED;
248 LACP_RX_EVENT_BEGIN, &sif->
rx_state);
259 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
263 LACP_RX_EVENT_PORT_MOVED, &sif->
rx_state);
269 LACP_RX_EVENT_LACP_ENABLED, &sif->
rx_state);
272 LACP_RX_EVENT_LACP_DISABLED, &sif->
rx_state);
286 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
287 sif->
partner.state |= LACP_STATE_LACP_TIMEOUT;
289 LACP_PTX_EVENT_SHORT_TIMEOUT, &sif->
ptx_state);
296 sif->
actor.state |= LACP_STATE_EXPIRED;
299 LACP_RX_EVENT_TIMER_EXPIRED, &sif->
rx_state);
302 LACP_RX_EVENT_PDU_RECEIVED, &sif->
rx_state);
315 sif->
partner.state &= ~LACP_STATE_AGGREGATION;
316 sif->
actor.state &= ~LACP_STATE_EXPIRED;
329 sif->
actor.state &= ~LACP_STATE_EXPIRED;
332 LACP_RX_EVENT_PDU_RECEIVED, &sif->
rx_state);
342 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
347 if ((sif != sif2) && (sif2->
rx_state == LACP_RX_STATE_PORT_DISABLED) &&
349 lacpdu->partner.port_info.system, 6) &&
350 (sif2->
partner.port_number == lacpdu->partner.port_info.port_number))
370 sif->
actor.state &= ~LACP_STATE_EXPIRED;
382 #define _(b, s, n) {.bit = b, .str = #s, }, 387 int e = va_arg (*args,
int);
391 if (e >= (
sizeof (lacp_rx_event_array) /
sizeof (*event_entry)))
392 s =
format (s,
"Bad event %d", e);
394 s =
format (s,
"%s", event_entry[e].str);
403 clib_warning (
"%U-RX: event %U, old state %U, new state %U",
416 LACP_RX_EVENT_LACP_ENABLED, &sif->
rx_state);
#define LACP_ACTION_LACP_DISABLED
static lacp_fsm_machine_t lacp_rx_fsm_table[]
vnet_main_t * vnet_get_main(void)
static void lacp_update_default_selected(vlib_main_t *vm, slave_if_t *sif)
void lacp_init_rx_machine(vlib_main_t *vm, slave_if_t *sif)
format_function_t format_vnet_sw_if_index_name
static u8 * format_rx_event(u8 *s, va_list *args)
#define LACP_ACTION_EXPIRED
static u8 * format_rx_sm_state(u8 *s, va_list *args)
static u8 lacp_timer_is_running(f64 timer)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void lacp_record_pdu(slave_if_t *sif)
int lacp_rx_action_current(void *p1, void *p2)
int lacp_rx_action_expired(void *p1, void *p2)
static u8 lacp_timer_is_expired(vlib_main_t *vm, f64 timer)
static void lacp_set_port_moved(vlib_main_t *vm, slave_if_t *sif, u8 val)
vhost_vring_state_t state
#define LACP_ACTION_INITIALIZE
int lacp_rx_action_defaulted(void *p1, void *p2)
#define LACP_ACTION_CURRENT
void lacp_rx_debug_func(slave_if_t *sif, int event, int state, lacp_fsm_state_t *transition)
#define clib_warning(format, args...)
lacp_machine_t lacp_mux_machine
int lacp_rx_action_initialize(void *p1, void *p2)
int lacp_rx_action_lacp_disabled(void *p1, void *p2)
#define LACP_ACTION_PORT_DISABLED
static void lacp_update_selected(vlib_main_t *vm, slave_if_t *sif)
static u8 lacp_compare_partner(slave_if_t *sif)
void lacp_selection_logic(vlib_main_t *vm, slave_if_t *sif)
#define LACP_ACTION_DEFAULTED
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
lacp_machine_t lacp_ptx_machine
static void lacp_update_ntt(vlib_main_t *vm, slave_if_t *sif)
lacp_port_info_t partner_admin
static void lacp_start_periodic_timer(vlib_main_t *vm, slave_if_t *sif, u8 expiration)
int lacp_rx_action_port_disabled(void *p1, void *p2)
static void lacp_start_current_while_timer(vlib_main_t *vm, slave_if_t *sif, u8 expiration)
static void lacp_set_port_unselected(vlib_main_t *vm, slave_if_t *sif)
static void lacp_record_default(slave_if_t *sif)
static int lacp_port_is_moved(vlib_main_t *vm, slave_if_t *sif)
int lacp_machine_dispatch(lacp_machine_t *machine, vlib_main_t *vm, slave_if_t *sif, int event, int *state)