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;
110 if (sif->
mode != BOND_MODE_LACP)
147 if (sif->port_enabled == 0)
150 if (lacp_timer_is_running (sif->current_while_timer) &&
151 lacp_timer_is_expired (lm->vlib_main, sif->current_while_timer))
153 lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
154 LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
160 lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
161 LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
167 lacp_stop_timer (&sif->wait_while_timer);
168 lacp_selection_logic (vm, sif);
211 ethernet_lacp_pdu_t
h;
212 ethernet_marker_pdu_t m;
213 u8 dst[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02 };
222 memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
226 h.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
232 h.lacp.actor.tlv_type = LACP_ACTOR_INFORMATION;
233 h.lacp.actor.tlv_length =
sizeof (lacp_actor_partner_t);
236 h.lacp.partner.tlv_type = LACP_PARTNER_INFORMATION;
237 h.lacp.partner.tlv_length =
sizeof (lacp_actor_partner_t);
240 h.lacp.collector.tlv_type = LACP_COLLECTOR_INFORMATION;
241 h.lacp.collector.tlv_length =
sizeof (lacp_collector_t);
242 h.lacp.collector.max_delay = 0;
245 h.lacp.terminator.tlv_type = LACP_TERMINATOR_INFORMATION;
246 h.lacp.terminator.tlv_length = 0;
259 memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
263 m.ethernet.type = htons (ETHERNET_TYPE_SLOW_PROTOCOLS);
268 m.marker.marker_info.tlv_length =
sizeof (marker_information_t);
271 m.marker.terminator.tlv_type = MARKER_TERMINATOR_INFORMATION;
272 m.marker.terminator.tlv_length = 0;
294 LACP_DBG2 (sif, event, *state, machine, transition);
297 rc = (*transition->
action) ((
void *)
vm, (
void *) sif);
321 sif->
selected = LACP_PORT_UNSELECTED;
322 sif->
actor.state = LACP_STATE_AGGREGATION;
324 sif->
actor.state |= LACP_STATE_LACP_TIMEOUT;
326 sif->
actor.state |= LACP_STATE_LACP_ACTIVITY;
329 sif->
actor.key = htons (group);
330 sif->
actor.port_number = htons (port_number);
334 sif->
partner.key = htons (group);
335 sif->
partner.port_number = htons (port_number);
337 sif->
partner.key = htons (group);
414 .version = VPP_BUILD_VER,
415 .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)
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)
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. ...
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
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_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)
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,...)
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)
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 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 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)
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)
#define LACP_ACTOR_LACP_VERSION