39 s =
format (s,
"VXLAN: tunnel %d vni %d next %d error %d",
44 s =
format (s,
"VXLAN: no tunnel for vni %d next %d error %d",
56 u32 n_left_from, next_index, * from, * to_next;
60 u32 last_tunnel_index = ~0;
61 vxlan4_tunnel_key_t last_key4;
62 vxlan6_tunnel_key_t last_key6;
63 u32 pkts_decapsulated = 0;
65 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
67 last_key4.as_u64 = ~0;
74 stats_n_packets = stats_n_bytes = 0;
76 while (n_left_from > 0)
81 to_next, n_left_to_next);
82 while (n_left_from >= 4 && n_left_to_next >= 2)
91 u32 tunnel_index0, tunnel_index1;
93 vxlan4_tunnel_key_t key4_0, key4_1;
94 vxlan6_tunnel_key_t key6_0, key6_1;
96 u32 sw_if_index0, sw_if_index1, len0, len1;
147 (b0,
sizeof(*ip4_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
149 (b1,
sizeof(*ip4_1)+
sizeof(
udp_header_t)+
sizeof(*vxlan1));
152 (b0,
sizeof(*ip6_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
154 (b1,
sizeof(*ip6_1)+
sizeof(
udp_header_t)+
sizeof(*vxlan1));
173 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
174 next0 = VXLAN_INPUT_NEXT_DROP;
178 last_key4.as_u64 = key4_0.as_u64;
179 tunnel_index0 = last_tunnel_index = p0[0];
182 tunnel_index0 = last_tunnel_index;
188 if (
PREDICT_FALSE (memcmp(&key6_0, &last_key6,
sizeof(last_key6)) != 0))
194 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
195 next0 = VXLAN_INPUT_NEXT_DROP;
200 tunnel_index0 = last_tunnel_index = p0[0];
203 tunnel_index0 = last_tunnel_index;
219 pkts_decapsulated ++;
220 stats_n_packets += 1;
221 stats_n_bytes += len0;
227 stats_n_packets -= 1;
228 stats_n_bytes -= len0;
232 cpu_index, stats_sw_if_index,
233 stats_n_packets, stats_n_bytes);
235 stats_n_bytes = len0;
236 stats_sw_if_index = sw_if_index0;
263 error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
264 next1 = VXLAN_INPUT_NEXT_DROP;
268 last_key4.as_u64 = key4_1.as_u64;
269 tunnel_index1 = last_tunnel_index = p1[0];
272 tunnel_index1 = last_tunnel_index;
278 if (
PREDICT_FALSE (memcmp(&key6_1, &last_key6,
sizeof(last_key6)) != 0))
284 error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
285 next1 = VXLAN_INPUT_NEXT_DROP;
290 tunnel_index1 = last_tunnel_index = p1[0];
293 tunnel_index1 = last_tunnel_index;
309 pkts_decapsulated ++;
310 stats_n_packets += 1;
311 stats_n_bytes += len1;
317 stats_n_packets -= 1;
318 stats_n_bytes -= len1;
322 cpu_index, stats_sw_if_index,
323 stats_n_packets, stats_n_bytes);
325 stats_n_bytes = len1;
326 stats_sw_if_index = sw_if_index1;
343 to_next, n_left_to_next,
344 bi0, bi1, next0, next1);
347 while (n_left_from > 0 && n_left_to_next > 0)
358 vxlan4_tunnel_key_t key4_0;
359 vxlan6_tunnel_key_t key6_0;
361 u32 sw_if_index0, len0;
388 (b0,
sizeof(*ip4_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
391 (b0,
sizeof(*ip6_0)+
sizeof(
udp_header_t)+
sizeof(*vxlan0));
407 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
408 next0 = VXLAN_INPUT_NEXT_DROP;
412 last_key4.as_u64 = key4_0.as_u64;
413 tunnel_index0 = last_tunnel_index = p0[0];
416 tunnel_index0 = last_tunnel_index;
422 if (
PREDICT_FALSE (memcmp(&key6_0, &last_key6,
sizeof(last_key6)) != 0))
428 error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
429 next0 = VXLAN_INPUT_NEXT_DROP;
434 tunnel_index0 = last_tunnel_index = p0[0];
437 tunnel_index0 = last_tunnel_index;
453 pkts_decapsulated ++;
454 stats_n_packets += 1;
455 stats_n_bytes += len0;
461 stats_n_packets -= 1;
462 stats_n_bytes -= len0;
466 cpu_index, stats_sw_if_index,
467 stats_n_packets, stats_n_bytes);
469 stats_n_bytes = len0;
470 stats_sw_if_index = sw_if_index0;
486 to_next, n_left_to_next,
494 VXLAN_ERROR_DECAPSULATED,
502 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
526 #define vxlan_error(n,s) s, 534 .name =
"vxlan4-input",
536 .vector_size =
sizeof (
u32),
543 #define _(s,n) [VXLAN_INPUT_NEXT_##s] = n, 555 .name =
"vxlan6-input",
557 .vector_size =
sizeof (
u32),
564 #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)
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
vlib_node_registration_t vxlan_input_node
always_inline 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
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
#define pool_elt_at_index(p, i)
uword * vxlan4_tunnel_by_key
uword os_get_cpu_number(void)
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
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)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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)
always_inline 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
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define hash_get_mem(h, key)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
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)]
always_inline 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)