41 "VXLAN_GBP decap error - tunnel for vni %d does not exist",
44 "VXLAN_GBP decap from vxlan_gbp_tunnel%d vni %d sclass %d" 45 " flags %U next %d error %d",
55 if (sw_if_index != (
u32) ~ 0)
58 u32 *fib_index_by_sw_if_index = is_ip4 ?
62 return vec_elt (fib_index_by_sw_if_index, sw_if_index);
84 key4.
key[1] != cache->
key[1]))
167 return (VXLAN_GBP_INPUT_NEXT_L2_INPUT);
175 type0 = clib_net_to_host_u16 (e0->
type);
178 case ETHERNET_TYPE_IP4:
179 return (VXLAN_GBP_INPUT_NEXT_IP4_INPUT);
180 case ETHERNET_TYPE_IP6:
181 return (VXLAN_GBP_INPUT_NEXT_IP6_INPUT);
184 return (VXLAN_GBP_INPUT_NEXT_DROP);
201 u32 pkts_decapsulated = 0;
214 while (n_left_from > 0)
216 u32 *to_next, n_left_to_next;
219 while (n_left_from >= 4 && n_left_to_next >= 2)
235 u32 bi0 = to_next[0] = from[0];
236 u32 bi1 = to_next[1] = from[1];
288 u8 error0 = 0, error1 = 0;
299 || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
302 && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
304 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
306 (drop_counter, thread_index, t0->
sw_if_index, 1, len0);
307 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
311 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
312 next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
329 (rx_counter, thread_index, t0->
sw_if_index, 1, len0);
334 VXLAN_GBP_GPFLAGS_R);
339 (t1 == 0 || flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
342 && flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
344 error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
346 (drop_counter, thread_index, t1->
sw_if_index, 1, len1);
347 next1 = VXLAN_GBP_INPUT_NEXT_DROP;
351 error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
352 next1 = VXLAN_GBP_INPUT_NEXT_PUNT;
371 (rx_counter, thread_index, t1->
sw_if_index, 1, len1);
375 VXLAN_GBP_GPFLAGS_R);
406 to_next, n_left_to_next,
407 bi0, bi1, next0, next1);
410 while (n_left_from > 0 && n_left_to_next > 0)
412 u32 bi0 = to_next[0] = from[0];
449 || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
452 && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
454 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
456 (drop_counter, thread_index, t0->
sw_if_index, 1, len0);
457 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
461 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
462 next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
480 (rx_counter, thread_index, t0->
sw_if_index, 1, len0);
483 VXLAN_GBP_GPFLAGS_R);
502 to_next, n_left_to_next,
532 #define vxlan_gbp_error(n,s) s, 534 #undef vxlan_gbp_error 541 .name =
"vxlan4-gbp-input",
542 .vector_size =
sizeof (
u32),
548 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 556 .name =
"vxlan6-gbp-input",
557 .vector_size =
sizeof (
u32),
562 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 583 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
601 while (n_left_from > 0)
605 while (n_left_from >= 4 && n_left_to_next >= 2)
611 u32 bi0, ip_len0, udp_len0, flags0, next0;
612 u32 bi1, ip_len1, udp_len1, flags1, next1;
613 i32 len_diff0, len_diff1;
614 u8 error0, good_udp0, proto0;
615 u8 error1, good_udp1, proto1;
631 bi0 = to_next[0] = from[0];
632 bi1 = to_next[1] = from[1];
669 if (proto0 != IP_PROTOCOL_UDP)
677 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
701 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
708 ip_len0 = clib_net_to_host_u16 (ip40->
length);
711 udp_len0 = clib_net_to_host_u16 (udp0->
length);
712 len_diff0 = ip_len0 - udp_len0;
717 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
724 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
730 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
731 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
735 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
736 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
742 b0->
error = error0 ? error_node->
errors[error0] : 0;
756 if (proto1 != IP_PROTOCOL_UDP)
764 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
788 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
795 ip_len1 = clib_net_to_host_u16 (ip41->
length);
798 udp_len1 = clib_net_to_host_u16 (udp1->
length);
799 len_diff1 = ip_len1 - udp_len1;
804 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
811 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
817 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
818 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
822 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
823 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
829 b1->
error = error1 ? error_node->
errors[error1] : 0;
843 to_next, n_left_to_next,
844 bi0, bi1, next0, next1);
847 while (n_left_from > 0 && n_left_to_next > 0)
853 u32 bi0, ip_len0, udp_len0, flags0, next0;
855 u8 error0, good_udp0, proto0;
857 bi0 = to_next[0] = from[0];
879 if (proto0 != IP_PROTOCOL_UDP)
887 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
911 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
918 ip_len0 = clib_net_to_host_u16 (ip40->
length);
921 udp_len0 = clib_net_to_host_u16 (udp0->
length);
922 len_diff0 = ip_len0 - udp_len0;
927 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
934 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
940 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
941 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
945 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
946 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
952 b0->
error = error0 ? error_node->
errors[error0] : 0;
966 to_next, n_left_to_next,
986 .name =
"ip4-vxlan-gbp-bypass",
987 .vector_size =
sizeof (
u32),
998 #ifndef CLIB_MARCH_VARIANT 1019 .name =
"ip6-vxlan-gbp-bypass",
1020 .vector_size =
sizeof (
u32),
1031 #ifndef CLIB_MARCH_VARIANT
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
clib_bihash_24_8_t vxlan6_gbp_tunnel_by_key
static uword vxlan_gbp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
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.
static vxlan_gbp_flags_t vxlan_gbp_get_flags(vxlan_gbp_header_t *h)
vnet_interface_main_t interface_main
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u32 buf_fib_index(vlib_buffer_t *b, u32 is_ip4)
vlib_node_registration_t ip4_vxlan_gbp_bypass_node
(constructor) VLIB_REGISTER_NODE (ip4_vxlan_gbp_bypass_node)
#define foreach_vxlan_gbp_input_next
vxlan_gbp_main_t vxlan_gbp_main
static vxlan_gbp_tunnel_t * vxlan6_gbp_find_tunnel(vxlan_gbp_main_t *vxm, last_tunnel_cache6 *cache, u32 fib_index, ip6_header_t *ip6_0, vxlan_gbp_header_t *vxlan_gbp0)
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.
static int ip4_is_fragment(const ip4_header_t *i)
static int clib_bihash_key_compare_24_8(u64 *a, u64 *b)
static u8 * format_vxlan_gbp_rx_trace(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
vlib_combined_counter_main_t * combined_sw_if_counters
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static void * ip4_next_header(ip4_header_t *i)
static char * vxlan_gbp_error_strings[]
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static vxlan_gbp_gpflags_t vxlan_gbp_get_gpflags(vxlan_gbp_header_t *h)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_punt_reason_t punt_no_such_tunnel[FIB_PROTOCOL_IP_MAX]
Punt reasons for no such tunnel.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
clib_bihash_16_8_t vxlan4_gbp_tunnel_by_key
static uword ip_vxlan_gbp_bypass_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 is_ip4)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static vxlan_gbp_input_next_t vxlan_gbp_tunnel_get_next(const vxlan_gbp_tunnel_t *t, vlib_buffer_t *b0)
ip_vxlan_gbp_bypass_next_t
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
#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.
vxlan4_tunnel_key_t last_tunnel_cache4
clib_error_t * ip6_vxlan_gbp_bypass_init(vlib_main_t *vm)
#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 void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
vlib_node_registration_t vxlan4_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gbp_input_node)
#define VLIB_REGISTER_NODE(x,...)
static u16 vxlan_gbp_get_sclass(vxlan_gbp_header_t *h)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
static void ip6_address_set_zero(ip6_address_t *a)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static u32 vxlan_gbp_get_vni(vxlan_gbp_header_t *h)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
vlib_node_registration_t vxlan6_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gbp_input_node)
vxlan6_tunnel_key_t last_tunnel_cache6
clib_error_t * ip4_vxlan_gbp_bypass_init(vlib_main_t *vm)
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.
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 vxlan_gbp_tunnel_t * vxlan4_gbp_find_tunnel(vxlan_gbp_main_t *vxm, last_tunnel_cache4 *cache, u32 fib_index, ip4_header_t *ip4_0, vxlan_gbp_header_t *vxlan_gbp0)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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 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.
vlib_node_registration_t ip6_vxlan_gbp_bypass_node
(constructor) VLIB_REGISTER_NODE (ip6_vxlan_gbp_bypass_node)
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)
VLIB buffer representation.
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)
A collection of combined counters.
vxlan_gbp_tunnel_t * tunnels
#define hash_get_mem(h, key)
ip4_main_t ip4_main
Global ip4 main structure.
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
vxlan_gbp_tunnel_mode_t mode
Tunnel mode.
#define CLIB_CACHE_LINE_BYTES
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.
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)