44 "VXLAN_GBP decap error - tunnel for vni %d does not exist",
47 "VXLAN_GBP decap from vxlan_gbp_tunnel%d vni %d sclass %d" 48 " flags %U next %d error %d",
58 if (sw_if_index != (
u32) ~ 0)
61 u32 *fib_index_by_sw_if_index = is_ip4 ?
65 return vec_elt (fib_index_by_sw_if_index, sw_if_index);
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];
297 u8 error0 = 0, error1 = 0;
307 (t0 == 0 || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
310 && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
312 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
314 (drop_counter, thread_index, stats_t0->
sw_if_index, 1,
316 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
320 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
321 next0 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
332 (rx_counter, thread_index, stats_t0->
sw_if_index, 1, len0);
341 (t1 == 0 || flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
344 && flags1 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
346 error1 = VXLAN_GBP_ERROR_BAD_FLAGS;
348 (drop_counter, thread_index, stats_t1->
sw_if_index, 1,
350 next1 = VXLAN_GBP_INPUT_NEXT_DROP;
354 error1 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
355 next1 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
368 (rx_counter, thread_index, stats_t1->
sw_if_index, 1, len1);
401 to_next, n_left_to_next,
402 bi0, bi1, next0, next1);
405 while (n_left_from > 0 && n_left_to_next > 0)
407 u32 bi0 = to_next[0] = from[0];
447 (t0 == 0 || flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G)))
450 && flags0 != (VXLAN_GBP_FLAGS_I | VXLAN_GBP_FLAGS_G))
452 error0 = VXLAN_GBP_ERROR_BAD_FLAGS;
454 (drop_counter, thread_index, stats_t0->
sw_if_index, 1,
456 next0 = VXLAN_GBP_INPUT_NEXT_DROP;
460 error0 = VXLAN_GBP_ERROR_NO_SUCH_TUNNEL;
461 next0 = VXLAN_GBP_INPUT_NEXT_NO_TUNNEL;
473 (rx_counter, thread_index, stats_t0->
sw_if_index, 1, len0);
493 to_next, n_left_to_next,
523 #define vxlan_gbp_error(n,s) s, 525 #undef vxlan_gbp_error 533 .name =
"vxlan4-gbp-input",
534 .vector_size =
sizeof (
u32),
540 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 550 .name =
"vxlan6-gbp-input",
551 .vector_size =
sizeof (
u32),
556 #define _(s,n) [VXLAN_GBP_INPUT_NEXT_##s] = n, 578 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
596 while (n_left_from > 0)
600 while (n_left_from >= 4 && n_left_to_next >= 2)
606 u32 bi0, ip_len0, udp_len0, flags0, next0;
607 u32 bi1, ip_len1, udp_len1, flags1, next1;
608 i32 len_diff0, len_diff1;
609 u8 error0, good_udp0, proto0;
610 u8 error1, good_udp1, proto1;
626 bi0 = to_next[0] = from[0];
627 bi1 = to_next[1] = from[1];
664 if (proto0 != IP_PROTOCOL_UDP)
672 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
696 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
703 ip_len0 = clib_net_to_host_u16 (ip40->
length);
706 udp_len0 = clib_net_to_host_u16 (udp0->
length);
707 len_diff0 = ip_len0 - udp_len0;
712 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
719 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
725 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
726 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
730 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
731 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
737 b0->
error = error0 ? error_node->
errors[error0] : 0;
751 if (proto1 != IP_PROTOCOL_UDP)
759 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
783 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
790 ip_len1 = clib_net_to_host_u16 (ip41->
length);
793 udp_len1 = clib_net_to_host_u16 (udp1->
length);
794 len_diff1 = ip_len1 - udp_len1;
799 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
806 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
812 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
813 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
817 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
818 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
824 b1->
error = error1 ? error_node->
errors[error1] : 0;
838 to_next, n_left_to_next,
839 bi0, bi1, next0, next1);
842 while (n_left_from > 0 && n_left_to_next > 0)
848 u32 bi0, ip_len0, udp_len0, flags0, next0;
850 u8 error0, good_udp0, proto0;
852 bi0 = to_next[0] = from[0];
874 if (proto0 != IP_PROTOCOL_UDP)
882 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp))
906 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
913 ip_len0 = clib_net_to_host_u16 (ip40->
length);
916 udp_len0 = clib_net_to_host_u16 (udp0->
length);
917 len_diff0 = ip_len0 - udp_len0;
922 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
929 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
935 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
936 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
940 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
941 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
947 b0->
error = error0 ? error_node->
errors[error0] : 0;
961 to_next, n_left_to_next,
982 .name =
"ip4-vxlan-gbp-bypass",
983 .vector_size =
sizeof (
u32),
1016 .name =
"ip6-vxlan-gbp-bypass",
1017 .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 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
ip_vxan_gbp_bypass_next_t
vxlan_gbp_main_t vxlan_gbp_main
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)
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[]
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.
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 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)
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
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
vxlan_gbp_tunnel_mode_t mode
Tunnel mode.
#define CLIB_CACHE_LINE_BYTES
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)