24 lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->
last_rx_pkt;
27 return LACP_ERROR_UNSUPPORTED;
33 if ((lacpdu->actor.tlv_length != sizeof (lacp_actor_partner_t)) ||
34 (lacpdu->partner.tlv_length !=
sizeof (lacp_actor_partner_t)) ||
35 (lacpdu->collector.tlv_length !=
sizeof (lacp_collector_t)) ||
36 (lacpdu->terminator.tlv_length != 0))
37 return (LACP_ERROR_BAD_TLV);
40 LACP_RX_EVENT_PDU_RECEIVED, &sif->
rx_state);
42 return LACP_ERROR_NONE;
50 marker->marker_info = pkt->marker_info;
51 marker->marker_info.tlv_type = MARKER_RESPONSE_INFORMATION;
57 marker->marker_info.tlv_type = MARKER_INFORMATION;
58 marker->marker_info.requester_port = sif->
actor.port_number;
60 marker->marker_info.requester_transaction_id = sif->
marker_tx_id;
69 ethernet_marker_pdu_t *h0;
125 if ((marker->marker_info.tlv_length != sizeof (marker_information_t)) ||
126 (marker->terminator.tlv_length != 0))
127 return (LACP_ERROR_BAD_TLV);
131 return LACP_ERROR_NONE;
145 marker_pdu_t *marker;
146 uword last_packet_signature;
151 if ((sif == 0) || (sif->
mode != BOND_MODE_LACP))
153 return LACP_ERROR_DISABLED;
167 if (nbytes <
sizeof (lacp_pdu_t))
170 return LACP_ERROR_TOO_SMALL;
199 if (nbytes <
sizeof (lacp_pdu_t))
202 return LACP_ERROR_TOO_SMALL;
205 last_packet_signature =
214 e = LACP_ERROR_CACHE_HIT;
250 .runs_after =
VLIB_INITS(
"lacp_periodic_init"),
274 if (t->
len >= sizeof (lacp_pdu_t))
276 switch (lacpdu->subtype)
280 s =
format (s,
" Markerv1\n");
282 s =
format (s,
" Subtype %u, Version %u\n", marker->subtype,
283 marker->version_number);
284 s =
format (s,
" Marker Information TLV: type %u\n",
285 marker->marker_info.tlv_type);
286 s =
format (s,
" Marker Information TLV: length %u\n",
287 marker->marker_info.tlv_length);
288 s =
format (s,
" Requester port: %u\n",
289 marker->marker_info.requester_port);
291 marker->marker_info.requester_system);
292 s =
format (s,
" Requester transaction ID: %u\n",
293 marker->marker_info.requester_transaction_id);
298 s =
format (s,
" LACPv1\n");
300 s =
format (s,
" Subtype %u, Version %u\n", lacpdu->subtype,
301 lacpdu->version_number);
302 s =
format (s,
" Actor Information TLV: length %u\n",
303 lacpdu->actor.tlv_length);
305 lacpdu->actor.port_info.system);
306 s =
format (s,
" System priority %u\n",
307 ntohs (lacpdu->actor.port_info.system_priority));
308 s =
format (s,
" Key %u\n", ntohs (lacpdu->actor.port_info.key));
309 s =
format (s,
" Port priority %u\n",
310 ntohs (lacpdu->actor.port_info.port_priority));
311 s =
format (s,
" Port number %u\n",
312 ntohs (lacpdu->actor.port_info.port_number));
313 s =
format (s,
" State 0x%x\n", lacpdu->actor.port_info.state);
315 while (state_entry->
str)
317 if (lacpdu->actor.port_info.state & (1 << state_entry->
bit))
318 s =
format (s,
" %s (%d)\n", state_entry->
str,
323 s =
format (s,
" Partner Information TLV: length %u\n",
324 lacpdu->partner.tlv_length);
326 lacpdu->partner.port_info.system);
327 s =
format (s,
" System priority %u\n",
328 ntohs (lacpdu->partner.port_info.system_priority));
330 format (s,
" Key %u\n", ntohs (lacpdu->partner.port_info.key));
332 format (s,
" Port priority %u\n",
333 ntohs (lacpdu->partner.port_info.port_priority));
335 format (s,
" Port number %u\n",
336 ntohs (lacpdu->partner.port_info.port_number));
337 s =
format (s,
" State 0x%x\n", lacpdu->partner.port_info.state);
339 while (state_entry->
str)
341 if (lacpdu->partner.port_info.state & (1 << state_entry->
bit))
342 s =
format (s,
" %s (%d)\n", state_entry->
str,
353 if (t->
len > sizeof (lacp_pdu_t))
354 len =
sizeof (lacp_pdu_t);
358 for (i = 0; i <
len; i++)
364 s =
format (s,
" 0x%04x: ", i);
368 s =
format (s,
"%02x", p[i]);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u8 last_packet_signature_valid
vnet_main_t * vnet_get_main(void)
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 f64 vlib_time_now(vlib_main_t *vm)
u16 current_length
Nbytes between current data and the end of this buffer.
lacp_state_struct lacp_state_array[]
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
format_function_t format_vnet_sw_if_index_name
#define clib_memcpy(d, s, n)
u8 * format_ethernet_address(u8 *s, va_list *args)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
f64 last_marker_pdu_recd_time
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
f64 last_marker_pdu_sent_time
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define MARKER_PROTOCOL_VERSION
static uword vlib_buffer_contents(vlib_main_t *vm, u32 buffer_index, u8 *contents)
Copy buffer contents to memory.
vlib_main_t vlib_node_runtime_t * node
static bond_if_t * bond_get_master_by_dev_instance(u32 dev_instance)
uword hash_memory(void *p, word n_bytes, uword state)
vlib_packet_template_t marker_packet_templates[MARKER_N_PACKET_TEMPLATES]
lacp_machine_t lacp_rx_machine
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void lacp_start_current_while_timer(vlib_main_t *vm, slave_if_t *sif, u8 expiration)
#define LACP_STEADY_STATE
static slave_if_t * bond_get_slave_by_sw_if_index(u32 sw_if_index)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
uword last_packet_signature
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u64 marker_bad_pdu_received
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