42 "GENEVE decap from geneve_tunnel%d vni %d next %d error %d",
47 s =
format (s,
"GENEVE decap error - tunnel for vni %d does not exist",
56 u32 fib_index, sw_if_index;
77 u32 n_left_from, next_index, *from, *to_next;
81 u32 last_tunnel_index = ~0;
82 geneve4_tunnel_key_t last_key4;
83 geneve6_tunnel_key_t last_key6;
84 u32 pkts_decapsulated = 0;
86 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
89 last_key4.as_u64 = ~0;
91 memset (&last_key6, 0xff,
sizeof (last_key6));
98 stats_n_packets = stats_n_bytes = 0;
100 while (n_left_from > 0)
105 while (n_left_from >= 4 && n_left_to_next >= 2)
114 u32 tunnel_index0, tunnel_index1;
116 geneve4_tunnel_key_t key4_0, key4_1;
117 geneve6_tunnel_key_t key6_0, key6_1;
119 u32 sw_if_index0, sw_if_index1, len0, len1;
208 error0 = GENEVE_ERROR_BAD_FLAGS;
209 next0 = GENEVE_INPUT_NEXT_DROP;
212 #if SUPPORT_OPTIONS_HEADER==1 215 error0 = GENEVE_ERROR_BAD_FLAGS;
216 next0 = GENEVE_INPUT_NEXT_DROP;
231 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
232 next0 = GENEVE_INPUT_NEXT_DROP;
235 last_key4.as_u64 = key4_0.as_u64;
236 tunnel_index0 = last_tunnel_index = p0[0];
239 tunnel_index0 = last_tunnel_index;
245 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
246 next0 = GENEVE_INPUT_NEXT_DROP;
267 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
268 next0 = GENEVE_INPUT_NEXT_DROP;
280 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
285 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
286 next0 = GENEVE_INPUT_NEXT_DROP;
289 clib_memcpy (&last_key6, &key6_0,
sizeof (key6_0));
290 tunnel_index0 = last_tunnel_index = p0[0];
293 tunnel_index0 = last_tunnel_index;
299 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
300 next0 = GENEVE_INPUT_NEXT_DROP;
321 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
322 next0 = GENEVE_INPUT_NEXT_DROP;
337 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
340 stats_n_packets += 1;
341 stats_n_bytes += len0;
347 stats_n_packets -= 1;
348 stats_n_bytes -= len0;
352 thread_index, stats_sw_if_index,
353 stats_n_packets, stats_n_bytes);
355 stats_n_bytes = len0;
356 stats_sw_if_index = sw_if_index0;
375 error1 = GENEVE_ERROR_BAD_FLAGS;
376 next1 = GENEVE_INPUT_NEXT_DROP;
379 #if SUPPORT_OPTIONS_HEADER==1 382 error1 = GENEVE_ERROR_BAD_FLAGS;
383 next1 = GENEVE_INPUT_NEXT_DROP;
398 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
399 next1 = GENEVE_INPUT_NEXT_DROP;
402 last_key4.as_u64 = key4_1.as_u64;
403 tunnel_index1 = last_tunnel_index = p1[0];
406 tunnel_index1 = last_tunnel_index;
412 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
413 next1 = GENEVE_INPUT_NEXT_DROP;
434 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
435 next1 = GENEVE_INPUT_NEXT_DROP;
447 (memcmp (&key6_1, &last_key6,
sizeof (last_key6)) != 0))
453 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
454 next1 = GENEVE_INPUT_NEXT_DROP;
458 clib_memcpy (&last_key6, &key6_1,
sizeof (key6_1));
459 tunnel_index1 = last_tunnel_index = p1[0];
462 tunnel_index1 = last_tunnel_index;
468 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
469 next1 = GENEVE_INPUT_NEXT_DROP;
490 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
491 next1 = GENEVE_INPUT_NEXT_DROP;
506 sw_if_index1 = (mt1) ? mt1->sw_if_index : sw_if_index1;
509 stats_n_packets += 1;
510 stats_n_bytes += len1;
516 stats_n_packets -= 1;
517 stats_n_bytes -= len1;
521 thread_index, stats_sw_if_index,
522 stats_n_packets, stats_n_bytes);
524 stats_n_bytes = len1;
525 stats_sw_if_index = sw_if_index1;
542 to_next, n_left_to_next,
543 bi0, bi1, next0, next1);
546 while (n_left_from > 0 && n_left_to_next > 0)
557 geneve4_tunnel_key_t key4_0;
558 geneve6_tunnel_key_t key6_0;
560 u32 sw_if_index0, len0;
612 error0 = GENEVE_ERROR_BAD_FLAGS;
613 next0 = GENEVE_INPUT_NEXT_DROP;
616 #if SUPPORT_OPTIONS_HEADER==1 619 error0 = GENEVE_ERROR_BAD_FLAGS;
620 next0 = GENEVE_INPUT_NEXT_DROP;
635 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
636 next0 = GENEVE_INPUT_NEXT_DROP;
639 last_key4.as_u64 = key4_0.as_u64;
640 tunnel_index0 = last_tunnel_index = p0[0];
643 tunnel_index0 = last_tunnel_index;
649 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
650 next0 = GENEVE_INPUT_NEXT_DROP;
671 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
672 next0 = GENEVE_INPUT_NEXT_DROP;
684 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
689 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
690 next0 = GENEVE_INPUT_NEXT_DROP;
693 clib_memcpy (&last_key6, &key6_0,
sizeof (key6_0));
694 tunnel_index0 = last_tunnel_index = p0[0];
697 tunnel_index0 = last_tunnel_index;
703 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
704 next0 = GENEVE_INPUT_NEXT_DROP;
725 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
726 next0 = GENEVE_INPUT_NEXT_DROP;
741 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
744 stats_n_packets += 1;
745 stats_n_bytes += len0;
751 stats_n_packets -= 1;
752 stats_n_bytes -= len0;
756 thread_index, stats_sw_if_index,
757 stats_n_packets, stats_n_bytes);
759 stats_n_bytes = len0;
760 stats_sw_if_index = sw_if_index0;
776 to_next, n_left_to_next,
786 GENEVE_ERROR_DECAPSULATED, pkts_decapsulated);
793 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
815 #define geneve_error(n,s) s, 824 .name =
"geneve4-input",
826 .vector_size =
sizeof (
u32),
831 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n, 845 .name =
"geneve6-input",
847 .vector_size =
sizeof (
u32),
852 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n, 877 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
895 while (n_left_from > 0)
899 while (n_left_from >= 4 && n_left_to_next >= 2)
905 u32 bi0, ip_len0, udp_len0, flags0, next0;
906 u32 bi1, ip_len1, udp_len1, flags1, next1;
907 i32 len_diff0, len_diff1;
908 u8 error0, good_udp0, proto0;
909 u8 error1, good_udp1, proto1;
925 bi0 = to_next[0] = from[0];
926 bi1 = to_next[1] = from[1];
965 if (proto0 != IP_PROTOCOL_UDP)
973 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
997 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1004 ip_len0 = clib_net_to_host_u16 (ip40->
length);
1007 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1008 len_diff0 = ip_len0 - udp_len0;
1013 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1020 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1026 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1027 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1031 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1032 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1037 b0->
error = error0 ? error_node->
errors[error0] : 0;
1051 if (proto1 != IP_PROTOCOL_UDP)
1059 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1083 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1090 ip_len1 = clib_net_to_host_u16 (ip41->
length);
1093 udp_len1 = clib_net_to_host_u16 (udp1->
length);
1094 len_diff1 = ip_len1 - udp_len1;
1099 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1106 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1112 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1113 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
1117 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1118 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
1123 b1->
error = error1 ? error_node->
errors[error1] : 0;
1137 to_next, n_left_to_next,
1138 bi0, bi1, next0, next1);
1141 while (n_left_from > 0 && n_left_to_next > 0)
1147 u32 bi0, ip_len0, udp_len0, flags0, next0;
1149 u8 error0, good_udp0, proto0;
1151 bi0 = to_next[0] = from[0];
1155 n_left_to_next -= 1;
1174 if (proto0 != IP_PROTOCOL_UDP)
1182 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1206 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1213 ip_len0 = clib_net_to_host_u16 (ip40->
length);
1216 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1217 len_diff0 = ip_len0 - udp_len0;
1222 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1229 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1235 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1236 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1240 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1241 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1246 b0->
error = error0 ? error_node->
errors[error0] : 0;
1260 to_next, n_left_to_next,
static u8 vnet_get_geneve_critical_bit(geneve_header_t *h)
static u32 vnet_get_geneve_vni(geneve_header_t *h)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u8 runtime_data[0]
Function dependent node-runtime data.
vnet_interface_main_t interface_main
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
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.
static char * geneve_error_strings[]
#define GENEVE_BASE_HEADER_LENGTH
vlib_node_registration_t ip4_geneve_bypass_node
(constructor) VLIB_REGISTER_NODE (ip4_geneve_bypass_node)
geneve_tunnel_t * tunnels
static u8 vnet_get_geneve_options_len(geneve_header_t *h)
#define VLIB_INIT_FUNCTION(x)
#define foreach_geneve_input_next
static u32 vnet_get_geneve_vni_bigendian(geneve_header_t *h)
vlib_combined_counter_main_t * combined_sw_if_counters
static uword ip6_address_is_equal(ip6_address_t *a, ip6_address_t *b)
static uword ip_geneve_bypass_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 is_ip4)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static void * ip4_next_header(ip4_header_t *i)
static int ip4_is_fragment(ip4_header_t *i)
clib_error_t * ip6_geneve_bypass_init(vlib_main_t *vm)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vnet_geneve_hdr_1word_ntoh(geneve_header_t *h)
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.
static uword ip4_address_is_multicast(ip4_address_t *a)
static u32 validate_geneve_fib(vlib_buffer_t *b, geneve_tunnel_t *t, u32 is_ip4)
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
vlib_node_registration_t ip6_geneve_bypass_node
(constructor) VLIB_REGISTER_NODE (ip6_geneve_bypass_node)
#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_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
vlib_node_registration_t geneve4_input_node
(constructor) VLIB_REGISTER_NODE (geneve4_input_node)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static void ip6_address_set_zero(ip6_address_t *a)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
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 geneve6_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u8 * format_geneve_rx_trace(u8 *s, va_list *args)
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)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
struct _vlib_node_registration vlib_node_registration_t
static uword ip6_address_is_multicast(ip6_address_t *a)
static uword ip4_geneve_bypass(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 ip6_tcp_udp_icmp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
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)
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 uword ip6_geneve_bypass(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_node_registration_t geneve6_input_node
(constructor) VLIB_REGISTER_NODE (geneve6_input_node)
VLIB_NODE_FUNCTION_MULTIARCH(l2t_decap_node, l2t_decap_node_fn)
ip4_main_t ip4_main
Global ip4 main structure.
geneve_main_t geneve_main
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
clib_error_t * ip4_geneve_bypass_init(vlib_main_t *vm)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 * fib_index_by_sw_if_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static uword geneve4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static uword geneve_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 is_ip4)
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)