39 "GENEVE decap from geneve_tunnel%d vni %d next %d error %d",
44 s =
format (s,
"GENEVE decap error - tunnel for vni %d does not exist",
78 u32 last_tunnel_index = ~0;
79 geneve4_tunnel_key_t last_key4;
80 geneve6_tunnel_key_t last_key6;
81 u32 pkts_decapsulated = 0;
83 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
87 last_key4.as_u64 = ~0;
97 stats_n_packets = stats_n_bytes = 0;
99 while (n_left_from > 0)
104 while (n_left_from >= 4 && n_left_to_next >= 2)
113 u32 tunnel_index0, tunnel_index1;
115 geneve4_tunnel_key_t key4_0, key4_1;
116 geneve6_tunnel_key_t key6_0, key6_1;
118 u32 sw_if_index0, sw_if_index1, len0, len1;
201 error0 = GENEVE_ERROR_BAD_FLAGS;
202 next0 = GENEVE_INPUT_NEXT_DROP;
205 #if SUPPORT_OPTIONS_HEADER==1 208 error0 = GENEVE_ERROR_BAD_FLAGS;
209 next0 = GENEVE_INPUT_NEXT_DROP;
224 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
225 next0 = GENEVE_INPUT_NEXT_DROP;
228 last_key4.as_u64 = key4_0.as_u64;
229 tunnel_index0 = last_tunnel_index = p0[0];
232 tunnel_index0 = last_tunnel_index;
238 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
239 next0 = GENEVE_INPUT_NEXT_DROP;
260 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
261 next0 = GENEVE_INPUT_NEXT_DROP;
267 key6_0.remote.as_u64[0] = ip6_0->
src_address.as_u64[0];
268 key6_0.remote.as_u64[1] = ip6_0->
src_address.as_u64[1];
273 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
278 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
279 next0 = GENEVE_INPUT_NEXT_DROP;
283 tunnel_index0 = last_tunnel_index = p0[0];
286 tunnel_index0 = last_tunnel_index;
292 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
293 next0 = GENEVE_INPUT_NEXT_DROP;
304 key6_0.remote.as_u64[0] = ip6_0->
dst_address.as_u64[0];
305 key6_0.remote.as_u64[1] = ip6_0->
dst_address.as_u64[1];
314 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
315 next0 = GENEVE_INPUT_NEXT_DROP;
330 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
333 stats_n_packets += 1;
334 stats_n_bytes += len0;
340 stats_n_packets -= 1;
341 stats_n_bytes -= len0;
345 thread_index, stats_sw_if_index,
346 stats_n_packets, stats_n_bytes);
348 stats_n_bytes = len0;
349 stats_sw_if_index = sw_if_index0;
368 error1 = GENEVE_ERROR_BAD_FLAGS;
369 next1 = GENEVE_INPUT_NEXT_DROP;
372 #if SUPPORT_OPTIONS_HEADER==1 375 error1 = GENEVE_ERROR_BAD_FLAGS;
376 next1 = GENEVE_INPUT_NEXT_DROP;
391 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
392 next1 = GENEVE_INPUT_NEXT_DROP;
395 last_key4.as_u64 = key4_1.as_u64;
396 tunnel_index1 = last_tunnel_index = p1[0];
399 tunnel_index1 = last_tunnel_index;
405 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
406 next1 = GENEVE_INPUT_NEXT_DROP;
427 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
428 next1 = GENEVE_INPUT_NEXT_DROP;
434 key6_1.remote.as_u64[0] = ip6_1->
src_address.as_u64[0];
435 key6_1.remote.as_u64[1] = ip6_1->
src_address.as_u64[1];
440 (memcmp (&key6_1, &last_key6,
sizeof (last_key6)) != 0))
446 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
447 next1 = GENEVE_INPUT_NEXT_DROP;
452 tunnel_index1 = last_tunnel_index = p1[0];
455 tunnel_index1 = last_tunnel_index;
461 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
462 next1 = GENEVE_INPUT_NEXT_DROP;
473 key6_1.remote.as_u64[0] = ip6_1->
dst_address.as_u64[0];
474 key6_1.remote.as_u64[1] = ip6_1->
dst_address.as_u64[1];
483 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
484 next1 = GENEVE_INPUT_NEXT_DROP;
499 sw_if_index1 = (mt1) ? mt1->sw_if_index : sw_if_index1;
502 stats_n_packets += 1;
503 stats_n_bytes += len1;
509 stats_n_packets -= 1;
510 stats_n_bytes -= len1;
514 thread_index, stats_sw_if_index,
515 stats_n_packets, stats_n_bytes);
517 stats_n_bytes = len1;
518 stats_sw_if_index = sw_if_index1;
535 to_next, n_left_to_next,
536 bi0, bi1, next0, next1);
539 while (n_left_from > 0 && n_left_to_next > 0)
550 geneve4_tunnel_key_t key4_0;
551 geneve6_tunnel_key_t key6_0;
553 u32 sw_if_index0, len0;
606 error0 = GENEVE_ERROR_BAD_FLAGS;
607 next0 = GENEVE_INPUT_NEXT_DROP;
610 #if SUPPORT_OPTIONS_HEADER==1 613 error0 = GENEVE_ERROR_BAD_FLAGS;
614 next0 = GENEVE_INPUT_NEXT_DROP;
629 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
630 next0 = GENEVE_INPUT_NEXT_DROP;
633 last_key4.as_u64 = key4_0.as_u64;
634 tunnel_index0 = last_tunnel_index = p0[0];
637 tunnel_index0 = last_tunnel_index;
643 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
644 next0 = GENEVE_INPUT_NEXT_DROP;
665 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
666 next0 = GENEVE_INPUT_NEXT_DROP;
672 key6_0.remote.as_u64[0] = ip6_0->
src_address.as_u64[0];
673 key6_0.remote.as_u64[1] = ip6_0->
src_address.as_u64[1];
678 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
683 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
684 next0 = GENEVE_INPUT_NEXT_DROP;
688 tunnel_index0 = last_tunnel_index = p0[0];
691 tunnel_index0 = last_tunnel_index;
697 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
698 next0 = GENEVE_INPUT_NEXT_DROP;
709 key6_0.remote.as_u64[0] = ip6_0->
dst_address.as_u64[0];
710 key6_0.remote.as_u64[1] = ip6_0->
dst_address.as_u64[1];
719 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
720 next0 = GENEVE_INPUT_NEXT_DROP;
735 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
738 stats_n_packets += 1;
739 stats_n_bytes += len0;
745 stats_n_packets -= 1;
746 stats_n_bytes -= len0;
750 thread_index, stats_sw_if_index,
751 stats_n_packets, stats_n_bytes);
753 stats_n_bytes = len0;
754 stats_sw_if_index = sw_if_index0;
770 to_next, n_left_to_next,
780 GENEVE_ERROR_DECAPSULATED, pkts_decapsulated);
787 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
809 #define geneve_error(n,s) s, 817 .name =
"geneve4-input",
819 .vector_size =
sizeof (
u32),
824 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n, 835 .name =
"geneve6-input",
837 .vector_size =
sizeof (
u32),
842 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n, 868 vtep4_key_t last_vtep4;
870 vtep6_key_t last_vtep6;
888 while (n_left_from > 0)
892 while (n_left_from >= 4 && n_left_to_next >= 2)
898 u32 bi0, ip_len0, udp_len0, flags0, next0;
899 u32 bi1, ip_len1, udp_len1, flags1, next1;
900 i32 len_diff0, len_diff1;
901 u8 error0, good_udp0, proto0;
902 u8 error1, good_udp1, proto1;
913 bi0 = to_next[0] = from[0];
914 bi1 = to_next[1] = from[1];
952 if (proto0 != IP_PROTOCOL_UDP)
960 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
966 #ifdef CLIB_HAVE_VEC512 967 if (!vtep4_check_vector (&vxm->
vtep_table, b0, ip40, &last_vtep4,
981 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
988 ip_len0 = clib_net_to_host_u16 (ip40->
length);
991 udp_len0 = clib_net_to_host_u16 (udp0->
length);
992 len_diff0 = ip_len0 - udp_len0;
997 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1004 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1010 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1011 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1015 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1016 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1021 b0->
error = error0 ? error_node->
errors[error0] : 0;
1035 if (proto1 != IP_PROTOCOL_UDP)
1043 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1049 #ifdef CLIB_HAVE_VEC512 1050 if (!vtep4_check_vector (&vxm->
vtep_table, b1, ip41, &last_vtep4,
1064 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1071 ip_len1 = clib_net_to_host_u16 (ip41->
length);
1074 udp_len1 = clib_net_to_host_u16 (udp1->
length);
1075 len_diff1 = ip_len1 - udp_len1;
1080 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1087 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1093 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1094 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
1098 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1099 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
1104 b1->
error = error1 ? error_node->
errors[error1] : 0;
1118 to_next, n_left_to_next,
1119 bi0, bi1, next0, next1);
1122 while (n_left_from > 0 && n_left_to_next > 0)
1128 u32 bi0, ip_len0, udp_len0, flags0, next0;
1130 u8 error0, good_udp0, proto0;
1132 bi0 = to_next[0] = from[0];
1136 n_left_to_next -= 1;
1155 if (proto0 != IP_PROTOCOL_UDP)
1163 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1169 #ifdef CLIB_HAVE_VEC512 1170 if (!vtep4_check_vector (&vxm->
vtep_table, b0, ip40, &last_vtep4,
1184 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1191 ip_len0 = clib_net_to_host_u16 (ip40->
length);
1194 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1195 len_diff0 = ip_len0 - udp_len0;
1200 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1207 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1213 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1214 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1218 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1219 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1224 b0->
error = error0 ? error_node->
errors[error0] : 0;
1238 to_next, n_left_to_next,
1258 .name =
"ip4-geneve-bypass",
1259 .vector_size =
sizeof (
u32),
1280 .name =
"ip6-geneve-bypass",
1281 .vector_size =
sizeof (
u32),
static u8 vnet_get_geneve_critical_bit(geneve_header_t *h)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static u32 vnet_get_geneve_vni(geneve_header_t *h)
vlib_node_registration_t ip6_geneve_bypass_node
(constructor) VLIB_REGISTER_NODE (ip6_geneve_bypass_node)
static u8 * format_geneve_rx_trace(u8 *s, va_list *args)
u8 runtime_data[0]
Function dependent node-runtime data.
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
vnet_interface_main_t interface_main
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
#define VLIB_NODE_FN(node)
static uword ip4_address_is_multicast(const ip4_address_t *a)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define GENEVE_BASE_HEADER_LENGTH
geneve_tunnel_t * tunnels
static int ip4_is_fragment(const ip4_header_t *i)
static u8 vnet_get_geneve_options_len(geneve_header_t *h)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
vlib_get_buffers(vm, from, b, n_left_from)
#define foreach_geneve_input_next
vlib_combined_counter_main_t * combined_sw_if_counters
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_node_registration_t ip4_geneve_bypass_node
(constructor) VLIB_REGISTER_NODE (ip4_geneve_bypass_node)
static void * ip4_next_header(ip4_header_t *i)
static void vtep4_key_init(vtep4_key_t *k4)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vl_api_interface_index_t sw_if_index
static void vnet_geneve_hdr_1word_ntoh(geneve_header_t *h)
static uword geneve_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 is_ip4)
vlib_node_registration_t ip4_input_node
Global ip4 input node.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t geneve6_input_node
(constructor) VLIB_REGISTER_NODE (geneve6_input_node)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#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.
#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.
#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 u8 vtep6_check(vtep_table_t *t, vlib_buffer_t *b0, ip6_header_t *ip60, vtep6_key_t *last_k6)
static u32 validate_geneve_fib(vlib_buffer_t *b, geneve_tunnel_t *t, u32 is_ip4)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static u8 vtep4_check(vtep_table_t *t, vlib_buffer_t *b0, ip4_header_t *ip40, vtep4_key_t *last_k4)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
vnet_interface_main_t * im
uword * geneve4_tunnel_by_key
static void * ip6_next_header(ip6_header_t *i)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static uword ip_geneve_bypass_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 is_ip4)
static void vtep6_key_init(vtep6_key_t *k6)
vlib_put_next_frame(vm, node, next_index, 0)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static u8 vnet_get_geneve_version(geneve_header_t *h)
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
nat44_ei_hairpin_src_next_t next_index
static uword ip6_address_is_equal(const ip6_address_t *a, const ip6_address_t *b)
static uword ip6_address_is_multicast(const ip6_address_t *a)
static u32 vnet_get_geneve_vni_network_order(geneve_header_t *h)
#define vec_elt(v, i)
Get vector value at index i.
u32 ip6_tcp_udp_icmp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
vlib_main_t vlib_node_runtime_t * node
void ip4_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
VLIB buffer representation.
uword * geneve6_tunnel_by_key
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
#define hash_get_mem(h, key)
static char * geneve_error_strings[]
ip4_main_t ip4_main
Global ip4 main structure.
geneve_main_t geneve_main
u16 flags
Copy of main node flags.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
u32 * fib_index_by_sw_if_index
vlib_node_registration_t geneve4_input_node
(constructor) VLIB_REGISTER_NODE (geneve4_input_node)
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)