40 s =
format (s,
"VXLAN: tunnel %d vni %d next %d error %d",
45 s =
format (s,
"VXLAN: no tunnel for vni %d next %d error %d",
57 u32 n_left_from, next_index, * from, * to_next;
61 u32 last_tunnel_index = ~0;
62 vxlan4_tunnel_key_t last_key4;
63 vxlan6_tunnel_key_t last_key6;
64 u32 pkts_decapsulated = 0;
66 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
69 last_key4.as_u64 = ~0;
71 memset (&last_key6, 0xff,
sizeof (last_key6));
78 stats_n_packets = stats_n_bytes = 0;
80 while (n_left_from > 0)
85 to_next, n_left_to_next);
86 while (n_left_from >= 4 && n_left_to_next >= 2)
95 u32 tunnel_index0, tunnel_index1;
97 vxlan4_tunnel_key_t key4_0, key4_1;
98 vxlan6_tunnel_key_t key6_0, key6_1;
100 u32 sw_if_index0, sw_if_index1, len0, len1;
151 (b0,
sizeof(*ip4_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
153 (b1,
sizeof(*ip4_1)+
sizeof(
udp_header_t)+
sizeof(*vxlan1));
156 (b0,
sizeof(*ip6_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
158 (b1,
sizeof(*ip6_1)+
sizeof(
udp_header_t)+
sizeof(*vxlan1));
177 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
178 next0 = VXLAN_INPUT_NEXT_DROP;
182 last_key4.as_u64 = key4_0.as_u64;
183 tunnel_index0 = last_tunnel_index = p0[0];
186 tunnel_index0 = last_tunnel_index;
192 if (
PREDICT_FALSE (memcmp(&key6_0, &last_key6,
sizeof(last_key6)) != 0))
198 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
199 next0 = VXLAN_INPUT_NEXT_DROP;
204 tunnel_index0 = last_tunnel_index = p0[0];
207 tunnel_index0 = last_tunnel_index;
223 pkts_decapsulated ++;
224 stats_n_packets += 1;
225 stats_n_bytes += len0;
231 stats_n_packets -= 1;
232 stats_n_bytes -= len0;
236 cpu_index, stats_sw_if_index,
237 stats_n_packets, stats_n_bytes);
239 stats_n_bytes = len0;
240 stats_sw_if_index = sw_if_index0;
267 error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
268 next1 = VXLAN_INPUT_NEXT_DROP;
272 last_key4.as_u64 = key4_1.as_u64;
273 tunnel_index1 = last_tunnel_index = p1[0];
276 tunnel_index1 = last_tunnel_index;
282 if (
PREDICT_FALSE (memcmp(&key6_1, &last_key6,
sizeof(last_key6)) != 0))
288 error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
289 next1 = VXLAN_INPUT_NEXT_DROP;
294 tunnel_index1 = last_tunnel_index = p1[0];
297 tunnel_index1 = last_tunnel_index;
313 pkts_decapsulated ++;
314 stats_n_packets += 1;
315 stats_n_bytes += len1;
321 stats_n_packets -= 1;
322 stats_n_bytes -= len1;
326 cpu_index, stats_sw_if_index,
327 stats_n_packets, stats_n_bytes);
329 stats_n_bytes = len1;
330 stats_sw_if_index = sw_if_index1;
347 to_next, n_left_to_next,
348 bi0, bi1, next0, next1);
351 while (n_left_from > 0 && n_left_to_next > 0)
362 vxlan4_tunnel_key_t key4_0;
363 vxlan6_tunnel_key_t key6_0;
365 u32 sw_if_index0, len0;
392 (b0,
sizeof(*ip4_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
395 (b0,
sizeof(*ip6_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
411 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
412 next0 = VXLAN_INPUT_NEXT_DROP;
416 last_key4.as_u64 = key4_0.as_u64;
417 tunnel_index0 = last_tunnel_index = p0[0];
420 tunnel_index0 = last_tunnel_index;
426 if (
PREDICT_FALSE (memcmp(&key6_0, &last_key6,
sizeof(last_key6)) != 0))
432 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
433 next0 = VXLAN_INPUT_NEXT_DROP;
438 tunnel_index0 = last_tunnel_index = p0[0];
441 tunnel_index0 = last_tunnel_index;
457 pkts_decapsulated ++;
458 stats_n_packets += 1;
459 stats_n_bytes += len0;
465 stats_n_packets -= 1;
466 stats_n_bytes -= len0;
470 cpu_index, stats_sw_if_index,
471 stats_n_packets, stats_n_bytes);
473 stats_n_bytes = len0;
474 stats_sw_if_index = sw_if_index0;
490 to_next, n_left_to_next,
499 VXLAN_ERROR_DECAPSULATED,
507 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
531 #define vxlan_error(n,s) s, 539 .name =
"vxlan4-input",
541 .vector_size =
sizeof (
u32),
543 .n_errors = VXLAN_N_ERROR,
548 #define _(s,n) [VXLAN_INPUT_NEXT_##s] = n, 562 .name =
"vxlan6-input",
564 .vector_size =
sizeof (
u32),
566 .n_errors = VXLAN_N_ERROR,
571 #define _(s,n) [VXLAN_INPUT_NEXT_##s] = n, 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.
vnet_interface_main_t interface_main
vlib_node_registration_t vxlan4_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_input_node)
#define foreach_vxlan_input_next
struct _vlib_node_registration vlib_node_registration_t
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_combined_counter_main_t * combined_sw_if_counters
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword * vxlan4_tunnel_by_key
uword os_get_cpu_number(void)
vlib_node_registration_t vxlan6_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_input_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.
#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)
static u32 vnet_get_vni(vxlan_header_t *h)
static uword vxlan4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
#define CLIB_PREFETCH(addr, size, type)
static char * vxlan_error_strings[]
#define clib_memcpy(a, b, c)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
static uword vxlan_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, char is_ip4)
uword * vxlan6_tunnel_by_key
#define VLIB_BUFFER_IS_TRACED
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define hash_get_mem(h, key)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
VLIB_NODE_FUNCTION_MULTIARCH(l2t_decap_node, l2t_decap_node_fn)
static u8 * format_vxlan_rx_trace(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
uword runtime_data[(128-1 *sizeof(vlib_node_function_t *)-1 *sizeof(vlib_error_t *)-11 *sizeof(u32)-5 *sizeof(u16))/sizeof(uword)]
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static uword vxlan6_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)