|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
76 [SRP_MODE_reserved0] = {
78 .error = SRP_ERROR_UNKNOWN_MODE,
80 [SRP_MODE_reserved1] = {
82 .error = SRP_ERROR_UNKNOWN_MODE,
84 [SRP_MODE_reserved2] = {
86 .error = SRP_ERROR_UNKNOWN_MODE,
88 [SRP_MODE_reserved3] = {
90 .error = SRP_ERROR_UNKNOWN_MODE,
92 [SRP_MODE_keep_alive] = {
94 .error = SRP_ERROR_KEEP_ALIVE_DROPPED,
100 [SRP_MODE_control_pass_to_host] = {
103 [SRP_MODE_control_locally_buffered_for_host] = {
137 u32 bi0, bi1, sw_if_index0, sw_if_index1;
139 u8 next0, next1, error0, error1;
184 sw_if_index0 = (s0->mode == SRP_MODE_data
187 sw_if_index1 = (s1->mode == SRP_MODE_data
210 to_next, n_left_to_next,
211 bi0, bi1, next0, next1);
216 u32 bi0, sw_if_index0;
242 sw_if_index0 = (s0->mode == SRP_MODE_data
259 to_next, n_left_to_next,
279 .vector_size =
sizeof (
u32),
301 srp_topology_header_t * t;
305 t = (
void *) *contents;
307 nb = clib_net_to_host_u16 (t->n_bytes_of_data_that_follows);
308 nmb = (nb -
sizeof (t->originator_address)) /
sizeof (mb[0]);
309 if (
vec_len (*contents) <
sizeof (t[0]) + nmb *
sizeof (mb[0]))
310 return SRP_ERROR_TOPOLOGY_BAD_LENGTH;
317 t = (
void *) *contents;
318 t->n_bytes_of_data_that_follows = clib_host_to_net_u16 (nb +
sizeof (mb[0]));
320 mb = t->bindings + nmb;
338 *contents,
vec_len (*contents)))
343 return SRP_ERROR_CONTROL_PACKETS_PROCESSED;
354 return SRP_ERROR_CONTROL_PACKETS_PROCESSED;
368 static u8 * contents;
392 u32 bi0, l2_len0, l3_len0;
410 error0 = SRP_ERROR_CONTROL_PACKETS_PROCESSED;
412 error0 = s0->
control.version != 0 ? SRP_ERROR_CONTROL_VERSION_NON_ZERO : error0;
419 error0 = save0 != computed0 ? SRP_ERROR_CONTROL_BAD_CHECKSUM : error0;
422 if (error0 == SRP_ERROR_CONTROL_PACKETS_PROCESSED)
440 error0 = SRP_ERROR_UNKNOWN_CONTROL;
447 to_next, n_left_to_next,
459 .name =
"srp-control",
461 .vector_size =
sizeof (
u32),
475 u32 x = va_arg (*args,
u32);
479 #define _(f,n) case SRP_IPS_REQUEST_##f: t = #f; break;
483 return format (s,
"unknown 0x%x", x);
490 u32 x = va_arg (*args,
u32);
494 #define _(f,n) case SRP_IPS_STATUS_##f: t = #f; break;
498 return format (s,
"unknown 0x%x", x);
505 u32 x = va_arg (*args,
u32);
509 #define _(f) case SRP_IPS_STATE_##f: t = #f; break;
513 return format (s,
"unknown 0x%x", x);
520 u32 ring = va_arg (*args,
u32);
528 s =
format (s,
"%U, %U, %U, %s-path",
532 h->is_long_path ?
"long" :
"short");
542 s =
format (s,
"address %U, IPS state %U",
547 s =
format (s,
", %U neighbor %U",
556 u32 hw_if_index = va_arg (*args,
u32);
594 i->srp.is_inner_ring = tx_ring;
596 i->srp.mode = SRP_MODE_control_locally_buffered_for_host;
600 i->ethernet.type = clib_host_to_net_u16 (ETHERNET_TYPE_SRP_CONTROL);
603 i->control.version = 0;
604 i->control.type = SRP_CONTROL_PACKET_TYPE_ips;
605 i->control.ttl = 255;
620 u32 * to_next, bi = ~0;
659 [SRP_IPS_REQUEST_forced_switch] = 1,
660 [SRP_IPS_REQUEST_manual_switch] = 1,
661 [SRP_IPS_REQUEST_signal_fail] = 1,
662 [SRP_IPS_REQUEST_signal_degrade] = 1,
684 if (! memcmp (
h->originator_address,
si->my_address, sizeof (
h->originator_address)))
688 if (!
h->is_long_path)
699 switch (
si->current_ips_state)
701 case SRP_IPS_STATE_idle:
705 &&
h->status == SRP_IPS_STATUS_wrapped)
709 si->current_ips_state = SRP_IPS_STATE_wrapped;
714 to_tx[0].request_type = SRP_IPS_REQUEST_idle;
715 to_tx[0].status = SRP_IPS_STATUS_wrapped;
716 to_tx[0].is_long_path = 0;
720 to_tx[1].request_type =
h->request_type;
721 to_tx[1].status = SRP_IPS_STATUS_wrapped;
722 to_tx[1].is_long_path = 1;
727 case SRP_IPS_STATE_wrapped:
728 if (!
h->is_long_path
729 &&
h->request_type == SRP_IPS_REQUEST_idle
730 &&
h->status == SRP_IPS_STATUS_idle)
732 si->current_ips_state = SRP_IPS_STATE_idle;
738 case SRP_IPS_STATE_pass_thru:
759 if (
request == SRP_IPS_REQUEST_wait_to_restore)
761 if (
si->current_ips_state != SRP_IPS_STATE_wrapped)
793 if (!
si->ips_process_enable)
796 if (
si->current_ips_state == SRP_IPS_STATE_wrapped
802 si->current_ips_state = SRP_IPS_STATE_idle;
807 if (
si->current_ips_state != SRP_IPS_STATE_idle)
813 if (
si->current_ips_state == SRP_IPS_STATE_idle)
815 to_tx[0].request_type = to_tx[1].request_type = SRP_IPS_REQUEST_idle;
816 to_tx[0].status = to_tx[1].status = SRP_IPS_STATUS_idle;
817 to_tx[0].is_long_path = to_tx[1].is_long_path = 0;
820 else if (
si->current_ips_state == SRP_IPS_STATE_wrapped)
822 to_tx[0].request_type =
823 (
si->rings[rx_ring ^ 0].waiting_to_restore
824 ? SRP_IPS_REQUEST_wait_to_restore
825 : SRP_IPS_REQUEST_signal_fail);
826 to_tx[1].request_type =
827 (
si->rings[rx_ring ^ 1].waiting_to_restore
828 ? SRP_IPS_REQUEST_wait_to_restore
829 : SRP_IPS_REQUEST_signal_fail);
830 to_tx[0].status = to_tx[1].status = SRP_IPS_STATUS_wrapped;
831 to_tx[0].is_long_path = 0;
832 to_tx[1].is_long_path = 1;
861 .name =
"srp-ips-process",
862 .state = VLIB_NODE_STATE_DISABLED,
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
srp_interface_ring_t rings[SRP_N_RING]
@ foreach_srp_ips_request_type
vlib_node_registration_t srp_ips_process_node
#define foreach_srp_ips_state
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static uword srp_topology_packet(vlib_main_t *vm, u32 sw_if_index, u8 **contents)
uword unformat_pg_srp_header(unformat_input_t *input, va_list *args)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static vlib_node_registration_t srp_input_node
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_srp_input_trace(u8 *s, va_list *va)
static void maybe_send_ips_message(srp_interface_t *si)
u8 * format_ethernet_address(u8 *s, va_list *args)
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
vlib_main_t vlib_node_runtime_t * node
static u8 * format_srp_interface(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static srp_interface_t * srp_get_interface(u32 sw_if_index, srp_ring_type_t *ring)
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
vnet_hw_if_output_node_runtime_t * r
unformat_function_t * unformat_buffer
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
uword() srp_control_handler_function_t(vlib_main_t *vm, u32 sw_if_index, u8 **contents)
srp_interface_t * interface_pool
static void srp_setup_node(vlib_main_t *vm, u32 node_index)
static char * srp_error_strings[]
u8 * format_srp_device(u8 *s, va_list *args)
u8 rx_neighbor_address_valid
#define CLIB_PREFETCH(addr, size, type)
#define STRUCT_OFFSET_OF(t, f)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
vlib_error_t * errors
Vector of errors for this node.
#define pool_foreach(VAR, POOL)
Iterate through pool.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
format_function_t * format_buffer
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static uword vlib_buffer_contents(vlib_main_t *vm, u32 buffer_index, u8 *contents)
Copy buffer contents to memory.
f64 wait_to_restore_start_time
unformat_function_t * unformat_edit
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
static ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static clib_error_t * srp_init(vlib_main_t *vm)
static pg_node_t * pg_get_node(uword node_index)
vnet_hw_interface_class_t srp_hw_interface_class
static u8 * format_srp_ips_request_type(u8 *s, va_list *args)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static void srp_header_compute_parity(srp_header_t *h)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static srp_input_disposition_t srp_input_disposition_by_mode[8]
#define foreach_srp_error
void srp_ips_local_request(u32 sw_if_index, srp_ips_request_type_t request)
struct _vlib_node_registration vlib_node_registration_t
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
static u8 * format_srp_ring(u8 *s, va_list *args)
static uword srp_ips_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void init_ips_packet(srp_interface_t *si, srp_ring_type_t tx_ring, srp_ips_header_t *i)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
@ SRP_INPUT_NEXT_ETHERNET_INPUT
static u8 * format_srp_ips_status(u8 *s, va_list *args)
vlib_put_next_frame(vm, node, next_index, 0)
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static int requests_switch(srp_ips_request_type_t r)
static uword srp_control_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
static vlib_node_registration_t srp_control_input_node
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u8 * format_srp_ips_header(u8 *s, va_list *args)
u8 rx_neighbor_address[6]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define clib_warning(format, args...)
@ SRP_N_CONTROL_PACKET_TYPE
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
static void tx_ips_packet(srp_interface_t *si, srp_ring_type_t tx_ring, srp_ips_header_t *i)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
static f64 vlib_time_now(vlib_main_t *vm)
int vlib_buffer_add_data(vlib_main_t *vm, u32 *buffer_index, void *data, u32 n_data_bytes)
static uword srp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
vl_api_interface_index_t sw_if_index
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static u16 ip_csum_fold(ip_csum_t c)
#define SRP_TOPOLOGY_MAC_BINDING_FLAG_IS_INNER_RING
static u8 * format_srp_ips_state(u8 *s, va_list *args)
void srp_ips_rx_packet(u32 sw_if_index, srp_ips_header_t *h)
VLIB buffer representation.