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 if (!(sif->
partner.state & LACP_STATE_LACP_ACTIVITY) &&
216 (lacpdu->actor.port_info.state & LACP_STATE_LACP_ACTIVITY))
219 sif->
partner = lacpdu->actor.port_info;
220 sif->
actor.state &= ~LACP_STATE_DEFAULTED;
221 if (match && (lacpdu->actor.port_info.state & LACP_STATE_SYNCHRONIZATION))
222 sif->
partner.state |= LACP_STATE_SYNCHRONIZATION;
224 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
234 LACP_RX_EVENT_PORT_MOVED, &sif->
rx_state);
237 LACP_RX_EVENT_PORT_DISABLED, &sif->
rx_state);
248 sif->
actor.state &= ~LACP_STATE_EXPIRED;
252 LACP_RX_EVENT_BEGIN, &sif->
rx_state);
263 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
267 LACP_RX_EVENT_PORT_MOVED, &sif->
rx_state);
273 LACP_RX_EVENT_LACP_ENABLED, &sif->
rx_state);
276 LACP_RX_EVENT_LACP_DISABLED, &sif->
rx_state);
290 sif->
partner.state &= ~LACP_STATE_SYNCHRONIZATION;
291 sif->
partner.state |= LACP_STATE_LACP_TIMEOUT;
299 sif->
actor.state |= LACP_STATE_EXPIRED;
302 LACP_RX_EVENT_TIMER_EXPIRED, &sif->
rx_state);
305 LACP_RX_EVENT_PDU_RECEIVED, &sif->
rx_state);
318 sif->
partner.state &= ~LACP_STATE_AGGREGATION;
319 sif->
actor.state &= ~LACP_STATE_EXPIRED;
333 sif->
actor.state &= ~LACP_STATE_EXPIRED;
336 LACP_RX_EVENT_PDU_RECEIVED, &sif->
rx_state);
346 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
351 if ((sif != sif2) && (sif2->
rx_state == LACP_RX_STATE_PORT_DISABLED) &&
353 lacpdu->partner.port_info.system, 6) &&
354 (sif2->
partner.port_number == lacpdu->partner.port_info.port_number))
374 sif->
actor.state &= ~LACP_STATE_EXPIRED;
386 #define _(b, s, n) {.bit = b, .str = #s, }, 391 int e = va_arg (*args,
int);
394 if (e >= (
sizeof (lacp_rx_event_array) /
sizeof (*event_entry)))
395 s =
format (s,
"Bad event %d", e);
397 s =
format (s,
"%s", event_entry[e].str);
433 LACP_RX_EVENT_LACP_ENABLED, &sif->
rx_state);
#define LACP_ACTION_LACP_DISABLED
static lacp_fsm_machine_t lacp_rx_fsm_table[]
vlib_main_t vlib_global_main
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)
static void lacp_record_pdu(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.
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
vlib_worker_thread_t * vlib_worker_threads
static void lacp_stop_timer(f64 *timer)
#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)
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 ELOG_TYPE_DECLARE(f)
#define LACP_ACTION_PORT_DISABLED
#define ELOG_TRACK_DATA(em, f, track)
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)
u32 elog_string(elog_main_t *em, char *fmt,...)
add a string to the event-log string table
#define LACP_ACTION_DEFAULTED
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void lacp_update_ntt(vlib_main_t *vm, slave_if_t *sif)
lacp_port_info_t partner_admin
static_always_inline uword os_get_thread_index(void)
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 void lacp_ptx_post_short_timeout_event(vlib_main_t *vm, 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)