110 u32 n_left_from, next_index, *from, *to_next;
114 u32 last_tunnel_index = ~0;
115 vxlan4_gpe_tunnel_key_t last_key4;
116 vxlan6_gpe_tunnel_key_t last_key6;
117 u32 pkts_decapsulated = 0;
119 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
122 memset (&last_key4, 0xff,
sizeof(last_key4));
124 memset (&last_key6, 0xff,
sizeof(last_key6));
131 stats_n_packets = stats_n_bytes = 0;
133 while (n_left_from > 0)
139 while (n_left_from >= 4 && n_left_to_next >= 2)
144 ip4_vxlan_gpe_header_t * iuvn4_0, *iuvn4_1;
145 ip6_vxlan_gpe_header_t * iuvn6_0, *iuvn6_1;
147 u32 tunnel_index0, tunnel_index1;
149 vxlan4_gpe_tunnel_key_t key4_0, key4_1;
150 vxlan6_gpe_tunnel_key_t key6_0, key6_1;
152 u32 sw_if_index0, sw_if_index1, len0, len1;
214 next0 = (iuvn4_0->vxlan.protocol < node->
n_next_nodes) ?
215 iuvn4_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
216 next1 = (iuvn4_1->vxlan.protocol < node->
n_next_nodes) ?
217 iuvn4_1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
219 key4_0.local = iuvn4_0->ip4.dst_address.as_u32;
220 key4_1.local = iuvn4_1->ip4.dst_address.as_u32;
222 key4_0.remote = iuvn4_0->ip4.src_address.as_u32;
223 key4_1.remote = iuvn4_1->ip4.src_address.as_u32;
225 key4_0.vni = iuvn4_0->vxlan.vni_res;
226 key4_1.vni = iuvn4_1->vxlan.vni_res;
233 || (key4_0.as_u64[1] != last_key4.as_u64[1])))
239 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
243 last_key4.as_u64[0] = key4_0.as_u64[0];
244 last_key4.as_u64[1] = key4_0.as_u64[1];
245 tunnel_index0 = last_tunnel_index = p0[0];
248 tunnel_index0 = last_tunnel_index;
252 next0 = (iuvn6_0->vxlan.protocol < node->
n_next_nodes) ?
253 iuvn6_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
254 next1 = (iuvn6_1->vxlan.protocol < node->
n_next_nodes) ?
255 iuvn6_1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
257 key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
258 key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
259 key6_1.local.as_u64[0] = iuvn6_1->ip6.dst_address.as_u64[0];
260 key6_1.local.as_u64[1] = iuvn6_1->ip6.dst_address.as_u64[1];
262 key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
263 key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
264 key6_1.remote.as_u64[0] = iuvn6_1->ip6.src_address.as_u64[0];
265 key6_1.remote.as_u64[1] = iuvn6_1->ip6.src_address.as_u64[1];
267 key6_0.vni = iuvn6_0->vxlan.vni_res;
268 key6_1.vni = iuvn6_1->vxlan.vni_res;
271 if (
PREDICT_FALSE(memcmp (&key6_0, &last_key6,
sizeof(last_key6)) != 0))
277 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
281 memcpy (&last_key6, &key6_0,
sizeof(key6_0));
282 tunnel_index0 = last_tunnel_index = p0[0];
285 tunnel_index0 = last_tunnel_index;
304 stats_n_packets += 1;
305 stats_n_bytes += len0;
309 stats_n_packets -= 1;
310 stats_n_bytes -= len0;
314 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
316 stats_n_bytes = len0;
317 stats_sw_if_index = sw_if_index0;
320 trace0: b0->
error = error0 ? node->
errors[error0] : 0;
335 (key4_1.as_u64[0] != last_key4.as_u64[0])
336 || (key4_1.as_u64[1] != last_key4.as_u64[1])))
342 error1 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
346 last_key4.as_u64[0] = key4_1.as_u64[0];
347 last_key4.as_u64[1] = key4_1.as_u64[1];
348 tunnel_index1 = last_tunnel_index = p1[0];
351 tunnel_index1 = last_tunnel_index;
356 if (
PREDICT_FALSE(memcmp (&key6_1, &last_key6,
sizeof(last_key6)) != 0))
362 error1 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
366 memcpy (&last_key6, &key6_1,
sizeof(key6_1));
367 tunnel_index1 = last_tunnel_index = p1[0];
370 tunnel_index1 = last_tunnel_index;
388 stats_n_packets += 1;
389 stats_n_bytes += len1;
395 stats_n_packets -= 1;
396 stats_n_bytes -= len1;
400 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
402 stats_n_bytes = len1;
403 stats_sw_if_index = sw_if_index1;
407 trace1: b1->
error = error1 ? node->
errors[error1] : 0;
418 n_left_to_next, bi0, bi1, next0, next1);
421 while (n_left_from > 0 && n_left_to_next > 0)
426 ip4_vxlan_gpe_header_t * iuvn4_0;
427 ip6_vxlan_gpe_header_t * iuvn6_0;
431 vxlan4_gpe_tunnel_key_t key4_0;
432 vxlan6_gpe_tunnel_key_t key6_0;
434 u32 sw_if_index0, len0;
475 iuvn4_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
477 key4_0.local = iuvn4_0->ip4.dst_address.as_u32;
478 key4_0.remote = iuvn4_0->ip4.src_address.as_u32;
479 key4_0.vni = iuvn4_0->vxlan.vni_res;
484 (key4_0.as_u64[0] != last_key4.as_u64[0])
485 || (key4_0.as_u64[1] != last_key4.as_u64[1])))
491 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
495 last_key4.as_u64[0] = key4_0.as_u64[0];
496 last_key4.as_u64[1] = key4_0.as_u64[1];
497 tunnel_index0 = last_tunnel_index = p0[0];
500 tunnel_index0 = last_tunnel_index;
504 next0 = (iuvn6_0->vxlan.protocol < node->
n_next_nodes) ?
505 iuvn6_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
507 key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
508 key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
509 key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
510 key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
511 key6_0.vni = iuvn6_0->vxlan.vni_res;
514 if (
PREDICT_FALSE(memcmp (&key6_0, &last_key6,
sizeof(last_key6)) != 0))
520 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
524 memcpy (&last_key6, &key6_0,
sizeof(key6_0));
525 tunnel_index0 = last_tunnel_index = p0[0];
528 tunnel_index0 = last_tunnel_index;
547 stats_n_packets += 1;
548 stats_n_bytes += len0;
554 stats_n_packets -= 1;
555 stats_n_bytes -= len0;
559 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
561 stats_n_bytes = len0;
562 stats_sw_if_index = sw_if_index0;
565 trace00: b0->
error = error0 ? node->
errors[error0] : 0;
575 n_left_to_next, bi0, next0);
581 VXLAN_GPE_ERROR_DECAPSULATED, pkts_decapsulated);
587 stats_sw_if_index, stats_n_packets, stats_n_bytes);
633 #define vxlan_gpe_error(n,s) s, 635 #undef vxlan_gpe_error 641 .name =
"vxlan4-gpe-input",
643 .vector_size =
sizeof (
u32),
650 #define _(s,n) [VXLAN_GPE_INPUT_NEXT_##s] = n, 664 .name =
"vxlan6-gpe-input",
666 .vector_size =
sizeof (
u32),
673 #define _(s,n) [VXLAN_GPE_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.
uword * vxlan6_gpe_tunnel_by_key
lookup IPv6 VXLAN GPE tunnel by key
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vlib_node_registration_t vxlan4_gpe_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gpe_input_node)
vnet_interface_main_t interface_main
Struct for VXLAN GPE decap packet tracing.
vlib_node_registration_t vxlan_gpe_input_node
vlib_node_registration_t vxlan6_gpe_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gpe_input_node)
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.
vnet_main_t * vnet_main
State convenience vnet_main_t.
static char * vxlan_gpe_error_strings[]
VXLAN GPE error strings.
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.
static uword vxlan_gpe_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
Common processing for IPv4 and IPv6 VXLAN GPE decap dispatch functions.
Struct for VXLAN GPE tunnel.
uword os_get_cpu_number(void)
vxlan_gpe_main_t vxlan_gpe_main
u8 protocol
encapsulated protocol
#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)
#define CLIB_PREFETCH(addr, size, type)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static uword vxlan4_gpe_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for IPv4 VXLAN GPE.
#define foreach_vxlan_gpe_input_next
next nodes for VXLAN GPE input
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 u8 * format_vxlan_gpe_with_length(u8 *s, va_list *args)
Tracing function for VXLAN GPE packet decapsulation including length.
Struct for VXLAN GPE node state.
#define VLIB_BUFFER_IS_TRACED
vxlan_gpe_tunnel_t * tunnels
vector of encap tunnel instances
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
uword * vxlan4_gpe_tunnel_by_key
lookup IPv4 VXLAN GPE tunnel by key
u32 decap_fib_index
FIB indices - inner IP packet lookup here.
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)
#define VLIB_REGISTER_NODE(x,...)
u32 sw_if_index
vnet intfc sw_if_index
static uword vxlan6_gpe_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for IPv6 VXLAN GPE.
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static u8 * format_vxlan_gpe_rx_trace(u8 *s, va_list *args)
Tracing function for VXLAN GPE packet decapsulation.
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.