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);
79 key4.
key[1] = (((
u64) fib_index << 32) |
81 clib_host_to_net_u32 (0xffffff00)));
86 key4.
key[1] != cache->
key[1]))
127 [2] = ((((
u64) fib_index) << 32) |
129 clib_host_to_net_u32 (0xffffff00))),
171 return (VXLAN_GBP_INPUT_NEXT_L2_INPUT);
179 type0 = clib_net_to_host_u16 (e0->
type);
182 case ETHERNET_TYPE_IP4:
183 return (VXLAN_GBP_INPUT_NEXT_IP4_INPUT);
184 case ETHERNET_TYPE_IP6:
185 return (VXLAN_GBP_INPUT_NEXT_IP6_INPUT);
188 return (VXLAN_GBP_INPUT_NEXT_DROP);
205 u32 pkts_decapsulated = 0;
218 while (n_left_from > 0)
220 u32 *to_next, n_left_to_next;
223 while (n_left_from >= 4 && n_left_to_next >= 2)
239 u32 bi0 = to_next[0] = from[0];
240 u32 bi1 = to_next[1] = from[1];
292 u8 error0 = 0, error1 = 0;
306 if (t0 != NULL && !i_and_g0)
308 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
310 (drop_counter, thread_index, t0->
sw_if_index, 1, len0);
311 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
315 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
316 next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
333 (rx_counter, thread_index, t0->
sw_if_index, 1, len0);
338 VXLAN_GBP_GPFLAGS_R);
344 if (t1 != NULL && !i_and_g1)
346 error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
348 (drop_counter, thread_index, t1->
sw_if_index, 1, len1);
349 next1 = VXLAN_GBP_INPUT_NEXT_DROP;
353 error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
354 next1 = VXLAN_GBP_INPUT_NEXT_PUNT;
373 (rx_counter, thread_index, t1->
sw_if_index, 1, len1);
377 VXLAN_GBP_GPFLAGS_R);
408 to_next, n_left_to_next,
409 bi0, bi1, next0, next1);
412 while (n_left_from > 0 && n_left_to_next > 0)
414 u32 bi0 = to_next[0] = from[0];
454 if (t0 != NULL && !i_and_g0)
456 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
458 (drop_counter, thread_index, t0->
sw_if_index, 1, len0);
459 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
463 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
464 next0 = VXLAN_GBP_INPUT_NEXT_PUNT;
482 (rx_counter, thread_index, t0->
sw_if_index, 1, len0);
485 VXLAN_GBP_GPFLAGS_R);
504 to_next, n_left_to_next,
534 #define vxlan_gbp_error(n,s) s, 536 #undef vxlan_gbp_error 543 .name =
"vxlan4-gbp-input",
544 .vector_size =
sizeof (
u32),
550 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 558 .name =
"vxlan6-gbp-input",
559 .vector_size =
sizeof (
u32),
564 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 585 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
603 while (n_left_from > 0)
607 while (n_left_from >= 4 && n_left_to_next >= 2)
613 u32 bi0, ip_len0, udp_len0, flags0, next0;
614 u32 bi1, ip_len1, udp_len1, flags1, next1;
615 i32 len_diff0, len_diff1;
616 u8 error0, good_udp0, proto0;
617 u8 error1, good_udp1, proto1;
633 bi0 = to_next[0] = from[0];
634 bi1 = to_next[1] = from[1];
671 if (proto0 != IP_PROTOCOL_UDP)
679 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
703 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
710 ip_len0 = clib_net_to_host_u16 (ip40->
length);
713 udp_len0 = clib_net_to_host_u16 (udp0->
length);
714 len_diff0 = ip_len0 - udp_len0;
719 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
726 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
732 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
733 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
737 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
738 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
744 b0->
error = error0 ? error_node->
errors[error0] : 0;
758 if (proto1 != IP_PROTOCOL_UDP)
766 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
790 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
797 ip_len1 = clib_net_to_host_u16 (ip41->
length);
800 udp_len1 = clib_net_to_host_u16 (udp1->
length);
801 len_diff1 = ip_len1 - udp_len1;
806 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
813 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
819 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
820 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
824 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
825 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
831 b1->
error = error1 ? error_node->
errors[error1] : 0;
845 to_next, n_left_to_next,
846 bi0, bi1, next0, next1);
849 while (n_left_from > 0 && n_left_to_next > 0)
855 u32 bi0, ip_len0, udp_len0, flags0, next0;
857 u8 error0, good_udp0, proto0;
859 bi0 = to_next[0] = from[0];
881 if (proto0 != IP_PROTOCOL_UDP)
889 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
913 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
920 ip_len0 = clib_net_to_host_u16 (ip40->
length);
923 udp_len0 = clib_net_to_host_u16 (udp0->
length);
924 len_diff0 = ip_len0 - udp_len0;
929 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
936 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
942 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
943 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
947 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
948 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
954 b0->
error = error0 ? error_node->
errors[error0] : 0;
968 to_next, n_left_to_next,
988 .name =
"ip4-vxlan-gbp-bypass",
989 .vector_size =
sizeof (
u32),
1000 #ifndef CLIB_MARCH_VARIANT 1021 .name =
"ip6-vxlan-gbp-bypass",
1022 .vector_size =
sizeof (
u32),
1033 #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)
#define VXLAN_GBP_FLAGS_GI
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)
vlib_main_t vlib_node_runtime_t * node
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)
#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_main_t vlib_node_runtime_t vlib_frame_t * frame
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.
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
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.
vl_api_interface_index_t sw_if_index
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)