28 #define foreach_vxlan_gpe_encap_error \ 29 _(ENCAPSULATED, "good packets encapsulated") 35 #define _(sym,string) string, 44 #define _(sym,str) VXLAN_GPE_ENCAP_ERROR_##sym, 92 ASSERT(
sizeof(ip4_vxlan_gpe_header_t) == 36);
93 ASSERT(
sizeof(ip6_vxlan_gpe_header_t) == 56);
116 u32 * next1,
u8 is_v4)
118 ASSERT(
sizeof(ip4_vxlan_gpe_header_t) == 36);
119 ASSERT(
sizeof(ip6_vxlan_gpe_header_t) == 56);
149 u32 n_left_from, next_index, *from, *to_next;
153 u32 pkts_encapsulated = 0;
155 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
162 stats_n_packets = stats_n_bytes = 0;
164 while (n_left_from > 0)
170 while (n_left_from >= 4 && n_left_to_next >= 2)
175 u32 sw_if_index0, sw_if_index1, len0, len1;
178 u8 is_ip4_0, is_ip4_1;
235 pkts_encapsulated += 2;
239 stats_n_packets += 2;
240 stats_n_bytes += len0 + len1;
247 || (sw_if_index1 != stats_sw_if_index)))
249 stats_n_packets -= 2;
250 stats_n_bytes -= len0 + len1;
251 if (sw_if_index0 == sw_if_index1)
256 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
257 stats_sw_if_index = sw_if_index0;
259 stats_n_bytes = len0 + len1;
265 cpu_index, sw_if_index0, 1, len0);
268 cpu_index, sw_if_index1, 1, len1);
286 n_left_to_next, bi0, bi1, next0, next1);
289 while (n_left_from > 0 && n_left_to_next > 0)
294 u32 sw_if_index0, len0;
324 stats_n_packets += 1;
325 stats_n_bytes += len0;
333 stats_n_packets -= 1;
334 stats_n_bytes -= len0;
338 cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
340 stats_n_bytes = len0;
341 stats_sw_if_index = sw_if_index0;
350 n_left_to_next, bi0, next0);
356 VXLAN_GPE_ENCAP_ERROR_ENCAPSULATED,
363 stats_sw_if_index, stats_n_packets, stats_n_bytes);
372 .name =
"vxlan-gpe-encap",
373 .vector_size =
sizeof (
u32),
#define foreach_vxlan_gpe_encap_error
Statistics (not really errors)
Struct for tracing VXLAN GPE encapsulated packets.
u8 runtime_data[0]
Function dependent node-runtime data.
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
vnet_interface_main_t interface_main
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 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 uword vxlan_gpe_encap(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Common processing for IPv4 and IPv6 VXLAN GPE encap dispatch functions.
static void vxlan_gpe_encap_one_inline(vxlan_gpe_main_t *ngm, vlib_buffer_t *b0, vxlan_gpe_tunnel_t *t0, u32 *next0, u8 is_v4)
Instantiates UDP + VXLAN-GPE header then set next node to IP4|6 lookup.
vlib_combined_counter_main_t * combined_sw_if_counters
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
u8 * format_vxlan_gpe_encap_trace(u8 *s, va_list *args)
Trace of packets encapsulated in VXLAN GPE.
u8 * rewrite
Rewrite string.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Struct for VXLAN GPE tunnel.
static void vxlan_gpe_encap_two_inline(vxlan_gpe_main_t *ngm, vlib_buffer_t *b0, vlib_buffer_t *b1, vxlan_gpe_tunnel_t *t0, vxlan_gpe_tunnel_t *t1, u32 *next0, u32 *next1, u8 is_v4)
Instantiates UDP + VXLAN-GPE header then set next node to IP4|6 lookup for two packets.
vxlan_gpe_encap_error_t
Struct for VXLAN GPE errors/counters.
uword os_get_cpu_number(void)
vxlan_gpe_main_t vxlan_gpe_main
vlib_main_t * vlib_main
State convenience vlib_main_t.
static void ip_udp_encap_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 *ec0, word ec_len, u8 is_ip4)
u32 node_index
Node index.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define CLIB_PREFETCH(addr, size, type)
#define VLIB_BUFFER_IS_TRACED
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u8 rewrite_size
rewrite size for dynamic plugins like iOAM
Struct for VXLAN GPE node state.
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)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static char * vxlan_gpe_encap_error_strings[]
VXLAN GPE encap error strings.
u32 encap_fib_index
FIB indices - tunnel partner lookup here.
#define VLIB_REGISTER_NODE(x,...)
uword encap_next_node
Next node after VxLAN-GPE encap.
vlib_node_registration_t vxlan_gpe_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan_gpe_encap_node)
#define CLIB_CACHE_LINE_BYTES
#define VXLAN_GPE_TUNNEL_IS_IPV4
Flags for vxlan_gpe_tunnel_t.
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.