62 u32 n_left_from, next_index, * from, * to_next;
66 u32 last_tunnel_index = ~0;
67 vxlan_gpe_tunnel_key_t last_key;
68 u32 pkts_decapsulated = 0;
70 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
72 memset (&last_key, 0xff,
sizeof (last_key));
79 stats_n_packets = stats_n_bytes = 0;
81 while (n_left_from > 0)
86 to_next, n_left_to_next);
88 while (n_left_from >= 4 && n_left_to_next >= 2)
93 ip4_vxlan_gpe_header_t * iuvn0, * iuvn1;
95 u32 tunnel_index0, tunnel_index1;
97 vxlan_gpe_tunnel_key_t key0, key1;
99 u32 sw_if_index0, sw_if_index1, len0, len1;
145 next0 = (iuvn0->vxlan.protocol < node->
n_next_nodes) ? iuvn0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
146 next1 = (iuvn1->vxlan.protocol < node->
n_next_nodes) ? iuvn1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
151 key0.local = iuvn0->ip4.dst_address.as_u32;
152 key1.local = iuvn1->ip4.dst_address.as_u32;
154 key0.remote = iuvn0->ip4.src_address.as_u32;
155 key1.remote = iuvn1->ip4.src_address.as_u32;
157 key0.vni = iuvn0->vxlan.vni_res;
158 key1.vni = iuvn1->vxlan.vni_res;
165 || (key0.as_u64[1] != last_key.as_u64[1])))
171 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
175 last_key.as_u64[0] = key0.as_u64[0];
176 last_key.as_u64[1] = key0.as_u64[1];
177 tunnel_index0 = last_tunnel_index = p0[0];
180 tunnel_index0 = last_tunnel_index;
198 stats_n_packets += 1;
199 stats_n_bytes += len0;
203 stats_n_packets -= 1;
204 stats_n_bytes -= len0;
208 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
210 stats_n_bytes = len0;
211 stats_sw_if_index = sw_if_index0;
229 || (key1.as_u64[1] != last_key.as_u64[1])))
235 error1 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
239 last_key.as_u64[0] = key1.as_u64[0];
240 last_key.as_u64[1] = key1.as_u64[1];
241 tunnel_index1 = last_tunnel_index = p1[0];
244 tunnel_index1 = last_tunnel_index;
262 stats_n_packets += 1;
263 stats_n_bytes += len1;
269 stats_n_packets -= 1;
270 stats_n_bytes -= len1;
274 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
276 stats_n_bytes = len1;
277 stats_sw_if_index = sw_if_index1;
294 to_next, n_left_to_next,
295 bi0, bi1, next0, next1);
298 while (n_left_from > 0 && n_left_to_next > 0)
303 ip4_vxlan_gpe_header_t * iuvn0;
307 vxlan_gpe_tunnel_key_t key0;
309 u32 sw_if_index0, len0;
331 next0 = (iuvn0->vxlan.protocol < node->
n_next_nodes) ? iuvn0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
333 key0.local = iuvn0->ip4.dst_address.as_u32;
334 key0.remote = iuvn0->ip4.src_address.as_u32;
335 key0.vni = iuvn0->vxlan.vni_res;
339 || (key0.as_u64[1] != last_key.as_u64[1])))
345 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
349 last_key.as_u64[0] = key0.as_u64[0];
350 last_key.as_u64[1] = key0.as_u64[1];
351 tunnel_index0 = last_tunnel_index = p0[0];
354 tunnel_index0 = last_tunnel_index;
371 pkts_decapsulated ++;
372 stats_n_packets += 1;
373 stats_n_bytes += len0;
379 stats_n_packets -= 1;
380 stats_n_bytes -= len0;
384 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
386 stats_n_bytes = len0;
387 stats_sw_if_index = sw_if_index0;
402 to_next, n_left_to_next,
409 VXLAN_GPE_ERROR_DECAPSULATED,
416 stats_sw_if_index, stats_n_packets, stats_n_bytes);
423 #define vxlan_gpe_error(n,s) s, 425 #undef vxlan_gpe_error 431 .name =
"vxlan-gpe-input",
433 .vector_size =
sizeof (
u32),
440 #define _(s,n) [VXLAN_GPE_INPUT_NEXT_##s] = n, static uword vxlan_gpe_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vnet_interface_main_t interface_main
vlib_node_registration_t vxlan_gpe_input_node
(constructor) VLIB_REGISTER_NODE (vxlan_gpe_input_node)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static char * vxlan_gpe_error_strings[]
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 os_get_cpu_number(void)
vxlan_gpe_main_t vxlan_gpe_main
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#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.
#define CLIB_PREFETCH(addr, size, type)
#define foreach_vxlan_gpe_input_next
static u8 * format_vxlan_gpe_with_length(u8 *s, va_list *args)
#define VLIB_BUFFER_IS_TRACED
vxlan_gpe_tunnel_t * tunnels
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)
uword * vxlan_gpe_tunnel_by_key
#define hash_get_mem(h, key)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
#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)
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.