20 #include <vpp/app/version.h> 34 lacpdu->actor.port_info = sif->
actor;
37 lacpdu->partner.port_info = sif->
partner;
48 ethernet_lacp_pdu_t *h0;
109 if (sif->
mode != BOND_MODE_LACP)
146 if (sif->port_enabled == 0)
149 if (lacp_timer_is_running (sif->current_while_timer) &&
150 lacp_timer_is_expired (lm->vlib_main, sif->current_while_timer))
152 lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
153 LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
159 lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
160 LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
166 lacp_stop_timer (&sif->wait_while_timer);
167 lacp_selection_logic (vm, sif);
210 ethernet_lacp_pdu_t
h;
211 ethernet_marker_pdu_t m;
212 u8 dst[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02 };
219 memset (&h, 0,
sizeof (h));
221 memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
225 h.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
231 h.lacp.actor.tlv_type = LACP_ACTOR_INFORMATION;
232 h.lacp.actor.tlv_length =
sizeof (lacp_actor_partner_t);
235 h.lacp.partner.tlv_type = LACP_PARTNER_INFORMATION;
236 h.lacp.partner.tlv_length =
sizeof (lacp_actor_partner_t);
239 h.lacp.collector.tlv_type = LACP_COLLECTOR_INFORMATION;
240 h.lacp.collector.tlv_length =
sizeof (lacp_collector_t);
241 h.lacp.collector.max_delay = 0;
244 h.lacp.terminator.tlv_type = LACP_TERMINATOR_INFORMATION;
245 h.lacp.terminator.tlv_length = 0;
256 memset (&m, 0,
sizeof (m));
258 memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
262 m.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
267 m.marker.marker_info.tlv_length =
sizeof (marker_information_t);
270 m.marker.terminator.tlv_type = MARKER_TERMINATOR_INFORMATION;
271 m.marker.terminator.tlv_length = 0;
293 LACP_DBG2 (sif, event, *state, machine, transition);
296 rc = (*transition->
action) ((
void *)
vm, (
void *) sif);
317 sif->
selected = LACP_PORT_UNSELECTED;
318 sif->
actor.state = LACP_STATE_AGGREGATION;
320 sif->
actor.state |= LACP_STATE_LACP_TIMEOUT;
322 sif->
actor.state |= LACP_STATE_LACP_ACTIVITY;
325 sif->
actor.key = htons (group);
326 sif->
actor.port_number = htons (port_number);
330 sif->
partner.key = htons (group);
331 sif->
partner.port_number = htons (port_number);
333 sif->
partner.key = htons (group);
334 sif->
partner.state = LACP_STATE_LACP_ACTIVITY;
410 .version = VPP_BUILD_VER,
411 .description =
"Link Aggregation Control Protocol",
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)
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)
static void lacp_send_ethernet_lacp_pdu(slave_if_t *sif)
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)
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. ...
#define VNET_HW_INTERFACE_FLAG_LINK_UP
lacp_fsm_state_t * state_table
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void bond_register_callback(lacp_enable_disable_func func)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
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]
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)
vhost_vring_state_t state
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,...)
u16 current_length
Nbytes between current data and the end of this buffer.
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)
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
#define clib_memcpy(a, b, c)
void lacp_init_rx_machine(vlib_main_t *vm, slave_if_t *sif)
clib_error_t * lacp_plugin_api_hookup(vlib_main_t *vm)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define LACP_DBG2(n, e, s, m, t)
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_tx_machine(vlib_main_t *vm, slave_if_t *sif)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
u32 lacp_process_node_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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)
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.
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)
#define LACP_ACTOR_LACP_VERSION