20 #include <vpp/app/version.h> 35 lacpdu->actor.port_info = sif->
actor;
38 lacpdu->partner.port_info = sif->
partner;
49 ethernet_lacp_pdu_t *h0;
145 u8 actor_state, partner_state;
150 if (sif->port_enabled == 0)
153 actor_state = sif->actor.state;
154 partner_state = sif->partner.state;
155 if (lacp_timer_is_running (sif->current_while_timer) &&
156 lacp_timer_is_expired (lm->vlib_main, sif->current_while_timer))
158 lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
159 LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
165 lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
166 LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
172 lacp_stop_timer (&sif->wait_while_timer);
173 lacp_selection_logic (vm, sif);
175 if (actor_state != sif->
actor.state)
177 bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
178 stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
179 [sif->sw_if_index].actor_state,
182 if (partner_state != sif->
partner.state)
184 bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
185 stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
186 [sif->sw_if_index].partner_state,
224 .format =
"lacp-int-en-dis: BUG lacp_int == 0",
243 ethernet_lacp_pdu_t
h;
244 ethernet_marker_pdu_t m;
245 u8 dst[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02 };
254 memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
258 h.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
264 h.lacp.actor.tlv_type = LACP_ACTOR_INFORMATION;
265 h.lacp.actor.tlv_length =
sizeof (lacp_actor_partner_t);
268 h.lacp.partner.tlv_type = LACP_PARTNER_INFORMATION;
269 h.lacp.partner.tlv_length =
sizeof (lacp_actor_partner_t);
272 h.lacp.collector.tlv_type = LACP_COLLECTOR_INFORMATION;
273 h.lacp.collector.tlv_length =
sizeof (lacp_collector_t);
274 h.lacp.collector.max_delay = 0;
277 h.lacp.terminator.tlv_type = LACP_TERMINATOR_INFORMATION;
278 h.lacp.terminator.tlv_length = 0;
291 memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
295 m.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
300 m.marker.marker_info.tlv_length =
sizeof (marker_information_t);
303 m.marker.terminator.tlv_type = MARKER_TERMINATOR_INFORMATION;
304 m.marker.terminator.tlv_length = 0;
326 LACP_DBG2 (sif, event, *state, machine, transition);
329 rc = (*transition->
action) ((
void *)
vm, (
void *) sif);
353 sif->
selected = LACP_PORT_UNSELECTED;
354 sif->
actor.state = LACP_STATE_AGGREGATION;
356 sif->
actor.state |= LACP_STATE_LACP_TIMEOUT;
358 sif->
actor.state |= LACP_STATE_LACP_ACTIVITY;
361 sif->
actor.key = htons (group);
362 sif->
actor.port_number = htons (port_number);
366 sif->
partner.key = htons (group);
367 sif->
partner.port_number = htons (port_number);
460 .version = VPP_BUILD_VER,
461 .description =
"Link Aggregation Control Protocol (LACP)",
void lacp_send_lacp_pdu(vlib_main_t *vm, slave_if_t *sif)
void lacp_init_mux_machine(vlib_main_t *vm, slave_if_t *sif)
vlib_main_t vlib_global_main
void lacp_init_ptx_machine(vlib_main_t *vm, slave_if_t *sif)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
f64 last_lacpdu_recd_time
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static void lacp_send_ethernet_lacp_pdu(slave_if_t *sif)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
void lacp_init_neighbor(slave_if_t *sif, u8 *hw_address, u16 port_number, u32 group)
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. ...
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)
void lacp_create_periodic_process(void)
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.
vl_api_interface_index_t sw_if_index
#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_marker_pdu_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)
static void lacp_fill_pdu(lacp_pdu_t *lacpdu, slave_if_t *sif)
#define LACP_DEFAULT_SYSTEM_PRIORITY
void lacp_periodic(vlib_main_t *vm)
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)
f64 last_marker_pdu_sent_time
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)
static void lacp_interface_enable_disable(vlib_main_t *vm, bond_if_t *bif, slave_if_t *sif, u8 enable)
#define LACP_SHORT_TIMOUT_TIME
#define MARKER_PROTOCOL_VERSION
static int lacp_pick_packet_template(slave_if_t *sif)
static clib_error_t * lacp_periodic_init(vlib_main_t *vm)
#define LACP_DEFAULT_PORT_PRIORITY
void lacp_init_rx_machine(vlib_main_t *vm, slave_if_t *sif)
#define ELOG_TYPE_DECLARE(f)
clib_error_t * lacp_plugin_api_hookup(vlib_main_t *vm)
f64 last_lacpdu_sent_time
#define LACP_DBG2(n, e, s, m, t)
static bond_if_t * bond_get_master_by_dev_instance(u32 dev_instance)
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]
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
void lacp_init_tx_machine(vlib_main_t *vm, slave_if_t *sif)
u32 lacp_process_node_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
uword * port_number_bitmap
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
lacp_port_info_t partner_admin
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(lacp_hw_interface_up_down)
vl_api_dhcp_client_state_t state
static slave_if_t * bond_get_slave_by_sw_if_index(u32 sw_if_index)
lacp_port_info_t actor_admin
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_state_machines(vlib_main_t *vm, slave_if_t *sif)
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)
int lacp_machine_dispatch(lacp_machine_t *machine, vlib_main_t *vm, slave_if_t *sif, int event, int *state)
void stat_segment_set_state_counter(u32 index, u64 value)
#define LACP_ACTOR_LACP_VERSION