43 "VXLAN_GBP decap error - tunnel for vni %d does not exist",
46 "VXLAN_GBP decap from vxlan_gbp_tunnel%d vni %d sclass %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);
178 u32 pkts_decapsulated = 0;
182 memset (&last4, 0xff,
sizeof last4);
184 memset (&last6, 0xff,
sizeof last6);
191 while (n_left_from > 0)
193 u32 *to_next, n_left_to_next;
196 while (n_left_from >= 4 && n_left_to_next >= 2)
212 u32 bi0 = to_next[0] = from[0];
213 u32 bi1 = to_next[1] = from[1];
274 u8 error0 = 0, error1 = 0;
281 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
286 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
288 (drop_counter, thread_index, stats_t0->
sw_if_index, 1,
292 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
304 if (
PREDICT_TRUE (next0 == VXLAN_GBP_INPUT_NEXT_L2_INPUT))
310 (rx_counter, thread_index, stats_t0->
sw_if_index, 1, len0);
318 next1 = VXLAN_GBP_INPUT_NEXT_DROP;
323 error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
325 (drop_counter, thread_index, stats_t1->
sw_if_index, 1,
329 error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
341 if (
PREDICT_TRUE (next1 == VXLAN_GBP_INPUT_NEXT_L2_INPUT))
349 (rx_counter, thread_index, stats_t1->
sw_if_index, 1, len1);
374 to_next, n_left_to_next,
375 bi0, bi1, next0, next1);
378 while (n_left_from > 0 && n_left_to_next > 0)
380 u32 bi0 = to_next[0] = from[0];
422 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
427 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
429 (drop_counter, thread_index, stats_t0->
sw_if_index, 1,
433 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
446 if (
PREDICT_TRUE (next0 == VXLAN_GBP_INPUT_NEXT_L2_INPUT))
454 (rx_counter, thread_index, stats_t0->
sw_if_index, 1, len0);
468 to_next, n_left_to_next,
498 #define vxlan_gbp_error(n,s) s, 500 #undef vxlan_gbp_error 508 .name =
"vxlan4-gbp-input",
509 .vector_size =
sizeof (
u32),
515 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 525 .name =
"vxlan6-gbp-input",
526 .vector_size =
sizeof (
u32),
531 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 553 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
571 while (n_left_from > 0)
575 while (n_left_from >= 4 && n_left_to_next >= 2)
581 u32 bi0, ip_len0, udp_len0, flags0, next0;
582 u32 bi1, ip_len1, udp_len1, flags1, next1;
583 i32 len_diff0, len_diff1;
584 u8 error0, good_udp0, proto0;
585 u8 error1, good_udp1, proto1;
601 bi0 = to_next[0] = from[0];
602 bi1 = to_next[1] = from[1];
639 if (proto0 != IP_PROTOCOL_UDP)
647 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
671 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
678 ip_len0 = clib_net_to_host_u16 (ip40->
length);
681 udp_len0 = clib_net_to_host_u16 (udp0->
length);
682 len_diff0 = ip_len0 - udp_len0;
687 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
694 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
700 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
701 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
705 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
706 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
712 b0->
error = error0 ? error_node->
errors[error0] : 0;
726 if (proto1 != IP_PROTOCOL_UDP)
734 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
758 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
765 ip_len1 = clib_net_to_host_u16 (ip41->
length);
768 udp_len1 = clib_net_to_host_u16 (udp1->
length);
769 len_diff1 = ip_len1 - udp_len1;
774 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
781 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
787 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
788 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
792 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
793 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
799 b1->
error = error1 ? error_node->
errors[error1] : 0;
813 to_next, n_left_to_next,
814 bi0, bi1, next0, next1);
817 while (n_left_from > 0 && n_left_to_next > 0)
823 u32 bi0, ip_len0, udp_len0, flags0, next0;
825 u8 error0, good_udp0, proto0;
827 bi0 = to_next[0] = from[0];
849 if (proto0 != IP_PROTOCOL_UDP)
857 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
881 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
888 ip_len0 = clib_net_to_host_u16 (ip40->
length);
891 udp_len0 = clib_net_to_host_u16 (udp0->
length);
892 len_diff0 = ip_len0 - udp_len0;
897 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
904 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
910 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
911 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
915 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
916 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
922 b0->
error = error0 ? error_node->
errors[error0] : 0;
936 to_next, n_left_to_next,
957 .name =
"ip4-vxlan-gbp-bypass",
958 .vector_size =
sizeof (
u32),
991 .name =
"ip6-vxlan-gbp-bypass",
992 .vector_size =
sizeof (
u32),
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, vxlan_gbp_tunnel_t **stats_t0)
clib_bihash_24_8_t vxlan6_gbp_tunnel_by_key
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.
#define VXLAN_GBP_FLAGS_I
vnet_interface_main_t interface_main
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
ip_vxan_gbp_bypass_next_t
vxlan_gbp_main_t vxlan_gbp_main
#define VXLAN_GBP_FLAGS_G
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
static uword ip4_address_is_multicast(const ip4_address_t *a)
static uword ip4_vxlan_gbp_bypass(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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 uword ip6_vxlan_gbp_bypass(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
static u8 * format_vxlan_gbp_rx_trace(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
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[]
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static uword vxlan6_gbp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
vlib_node_registration_t ip4_input_node
Global ip4 input node.
clib_bihash_16_8_t vxlan4_gbp_tunnel_by_key
static u8 vxlan_gbp_get_flags(vxlan_gbp_header_t *h)
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.
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 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, vxlan_gbp_tunnel_t **stats_t0)
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 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 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.
struct _vlib_node_registration vlib_node_registration_t
static u8 vxlan_gbp_get_gpflags(vxlan_gbp_header_t *h)
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)
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)
VLIB_NODE_FUNCTION_MULTIARCH(l2t_decap_node, l2t_decap_node_fn)
ip4_main_t ip4_main
Global ip4 main structure.
static uword vxlan4_gbp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
static uword vxlan_gbp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 is_ip4)
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.
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)