20 #include <vpp/app/version.h> 35 lacpdu->actor.port_info = mif->
actor;
38 lacpdu->partner.port_info = mif->
partner;
49 ethernet_lacp_pdu_t *h0;
143 u8 actor_state, partner_state;
148 if (mif->port_enabled == 0)
151 actor_state = mif->actor.state;
152 partner_state = mif->partner.state;
153 if (lacp_timer_is_running (mif->current_while_timer) &&
154 lacp_timer_is_expired (vm, mif->current_while_timer))
156 lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
157 LACP_RX_EVENT_TIMER_EXPIRED, &mif->rx_state);
163 lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
164 LACP_PTX_EVENT_TIMER_EXPIRED, &mif->ptx_state);
170 lacp_stop_timer (&mif->wait_while_timer);
171 lacp_selection_logic (vm, mif);
173 if (actor_state != mif->
actor.state)
175 bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
176 stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
177 [mif->sw_if_index].actor_state,
180 if (partner_state != mif->
partner.state)
182 bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
183 stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
184 [mif->sw_if_index].partner_state,
222 .format =
"lacp-int-en-dis: BUG lacp_int == 0",
241 ethernet_lacp_pdu_t
h;
242 ethernet_marker_pdu_t m;
243 u8 dst[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02 };
252 memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
256 h.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
262 h.lacp.actor.tlv_type = LACP_ACTOR_INFORMATION;
263 h.lacp.actor.tlv_length =
sizeof (lacp_actor_partner_t);
266 h.lacp.partner.tlv_type = LACP_PARTNER_INFORMATION;
267 h.lacp.partner.tlv_length =
sizeof (lacp_actor_partner_t);
270 h.lacp.collector.tlv_type = LACP_COLLECTOR_INFORMATION;
271 h.lacp.collector.tlv_length =
sizeof (lacp_collector_t);
272 h.lacp.collector.max_delay = 0;
275 h.lacp.terminator.tlv_type = LACP_TERMINATOR_INFORMATION;
276 h.lacp.terminator.tlv_length = 0;
289 memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
293 m.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
298 m.marker.marker_info.tlv_length =
sizeof (marker_information_t);
301 m.marker.terminator.tlv_type = MARKER_TERMINATOR_INFORMATION;
302 m.marker.terminator.tlv_length = 0;
324 LACP_DBG2 (mif, event, *state, machine, transition);
327 rc = (*transition->
action) ((
void *)
vm, (
void *) mif);
351 mif->
selected = LACP_PORT_UNSELECTED;
352 mif->
actor.state = LACP_STATE_AGGREGATION;
354 mif->
actor.state |= LACP_STATE_LACP_TIMEOUT;
356 mif->
actor.state |= LACP_STATE_LACP_ACTIVITY;
359 mif->
actor.key = htons (group);
360 mif->
actor.port_number = htons (port_number);
364 mif->
partner.key = htons (group);
365 mif->
partner.port_number = htons (port_number);
458 .version = VPP_BUILD_VER,
459 .description =
"Link Aggregation Control Protocol (LACP)",
void lacp_init_ptx_machine(vlib_main_t *vm, member_if_t *mif)
vlib_main_t vlib_global_main
vl_api_wireguard_peer_flags_t flags
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
void lacp_init_state_machines(vlib_main_t *vm, member_if_t *mif)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static bond_if_t * bond_get_bond_if_by_dev_instance(u32 dev_instance)
u16 current_length
Nbytes between current data and the end of this buffer.
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
lacp_port_info_t partner_admin
static uword vnet_sw_interface_is_link_up(vnet_main_t *vnm, u32 sw_if_index)
lacp_fsm_state_t * state_table
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define clib_memcpy(d, s, n)
static void bond_register_callback(lacp_enable_disable_func func)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
static u8 lacp_timer_is_running(f64 timer)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(lacp_sw_interface_up_down)
vlib_packet_template_t packet_templates[LACP_N_PACKET_TEMPLATES]
f64 last_lacpdu_recd_time
static u8 lacp_timer_is_expired(vlib_main_t *vm, f64 timer)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
void lacp_create_periodic_process(void)
void lacp_init_mux_machine(vlib_main_t *vm, member_if_t *mif)
#define LACP_DEFAULT_SYSTEM_PRIORITY
void lacp_periodic(vlib_main_t *vm)
void lacp_init_tx_machine(vlib_main_t *vm, member_if_t *mif)
void vlib_packet_template_init(vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_alloc, char *fmt,...)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void lacp_stop_timer(f64 *timer)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
f64 last_lacpdu_sent_time
#define LACP_SHORT_TIMOUT_TIME
#define MARKER_PROTOCOL_VERSION
static void lacp_send_ethernet_lacp_pdu(vlib_main_t *vm, member_if_t *mif)
static clib_error_t * lacp_periodic_init(vlib_main_t *vm)
#define LACP_DEFAULT_PORT_PRIORITY
f64 last_marker_pdu_sent_time
#define ELOG_TYPE_DECLARE(f)
clib_error_t * lacp_plugin_api_hookup(vlib_main_t *vm)
void lacp_send_lacp_pdu(vlib_main_t *vm, member_if_t *mif)
#define LACP_DBG2(n, e, s, m, t)
static member_if_t * bond_get_member_by_sw_if_index(u32 sw_if_index)
static clib_error_t * lacp_hw_interface_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
vlib_packet_template_t marker_packet_templates[MARKER_N_PACKET_TEMPLATES]
void lacp_init_neighbor(member_if_t *mif, u8 *hw_address, u16 port_number, u32 group)
static void lacp_interface_enable_disable(vlib_main_t *vm, bond_if_t *bif, member_if_t *mif, u8 enable)
static void lacp_fill_pdu(lacp_pdu_t *lacpdu, member_if_t *mif)
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
u32 lacp_process_node_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
lacp_port_info_t actor_admin
VLIB buffer representation.
uword * port_number_bitmap
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(lacp_hw_interface_up_down)
static int lacp_pick_packet_template(member_if_t *mif)
int lacp_machine_dispatch(lacp_machine_t *machine, vlib_main_t *vm, member_if_t *mif, int event, int *state)
vl_api_dhcp_client_state_t state
f64 last_marker_pdu_recd_time
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
void lacp_init_rx_machine(vlib_main_t *vm, member_if_t *mif)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
lacp_fsm_machine_t * tables
static clib_error_t * lacp_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
vl_api_interface_index_t sw_if_index
void stat_segment_set_state_counter(u32 index, u64 value)
#define LACP_ACTOR_LACP_VERSION