23 #define foreach_gre_input_next \ 24 _(PUNT, "error-punt") \ 25 _(DROP, "error-drop") \ 26 _(IP4_INPUT, "ip4-input") \ 27 _(IP6_INPUT, "ip6-input") 30 #define _(s,n) GRE_INPUT_NEXT_##s, 49 s =
format (s,
"GRE: tunnel %d len %d src %U dst %U",
71 __attribute__((unused))
u32 n_left_from, next_index, i_next, * from, * to_next;
72 u64 cached_tunnel_key = (
u64) ~0;
73 u32 cached_tunnel_sw_if_index = 0, tunnel_sw_if_index;
74 u32 cached_tunnel_fib_index = 0, tunnel_fib_index;
84 while (n_left_from > 0)
89 to_next, n_left_to_next);
91 while (n_left_from >= 4 && n_left_to_next >= 2)
96 u16 version0, version1;
98 u32 i0, i1, next0, next1, protocol0, protocol1;
159 b0->
error = verr0 ? node->
errors[GRE_ERROR_UNSUPPORTED_VERSION]
161 next0 = verr0 ? GRE_INPUT_NEXT_DROP : next0;
162 b1->
error = verr1 ? node->
errors[GRE_ERROR_UNSUPPORTED_VERSION]
164 next1 = verr1 ? GRE_INPUT_NEXT_DROP : next1;
168 || next0 == GRE_INPUT_NEXT_IP6_INPUT))
173 if (cached_tunnel_key != key)
183 next0 = GRE_INPUT_NEXT_DROP;
184 b0->
error = node->
errors[GRE_ERROR_NO_SUCH_TUNNEL];
194 cached_tunnel_sw_if_index = tunnel_sw_if_index;
195 cached_tunnel_fib_index = tunnel_fib_index;
199 tunnel_sw_if_index = cached_tunnel_sw_if_index;
200 tunnel_fib_index = cached_tunnel_fib_index;
217 || next1 == GRE_INPUT_NEXT_IP6_INPUT))
222 if (cached_tunnel_key != key)
232 next1 = GRE_INPUT_NEXT_DROP;
233 b1->
error = node->
errors[GRE_ERROR_NO_SUCH_TUNNEL];
243 cached_tunnel_sw_if_index = tunnel_sw_if_index;
244 cached_tunnel_fib_index = tunnel_fib_index;
248 tunnel_sw_if_index = cached_tunnel_sw_if_index;
249 tunnel_fib_index = cached_tunnel_fib_index;
288 to_next, n_left_to_next,
289 bi0, bi1, next0, next1);
292 while (n_left_from > 0 && n_left_to_next > 0)
324 ? GRE_ERROR_UNKNOWN_PROTOCOL : GRE_ERROR_NONE];
328 b0->
error = verr0 ? node->
errors[GRE_ERROR_UNSUPPORTED_VERSION]
330 next0 = verr0 ? GRE_INPUT_NEXT_DROP : next0;
336 || next0 == GRE_INPUT_NEXT_IP6_INPUT))
341 if (cached_tunnel_key != key)
351 next0 = GRE_INPUT_NEXT_DROP;
352 b0->
error = node->
errors[GRE_ERROR_NO_SUCH_TUNNEL];
362 cached_tunnel_sw_if_index = tunnel_sw_if_index;
363 cached_tunnel_fib_index = tunnel_fib_index;
367 tunnel_sw_if_index = cached_tunnel_sw_if_index;
368 tunnel_fib_index = cached_tunnel_fib_index;
397 to_next, n_left_to_next,
404 GRE_ERROR_PKTS_DECAP, from_frame->
n_vectors);
409 #define gre_error(n,s) s, 418 .vector_size =
sizeof (
u32),
422 .n_errors = GRE_N_ERROR,
427 #define _(s,n) [GRE_INPUT_NEXT_##s] = n, 465 clib_host_to_net_u16 (protocol));
519 ASSERT(mpls_unicast_input);
528 mpls_unicast_input->
index);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
VLIB_NODE_FUNCTION_MULTIARCH(ethernet_input_not_l2_node, ethernet_input_not_l2)
sll srl srl sll sra u16x4 i
format_function_t format_gre_header_with_length
vnet_interface_main_t interface_main
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
#define clib_error_report(e)
void ip4_register_protocol(u32 protocol, u32 node_index)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static pg_node_t * pg_get_node(uword node_index)
#define VLIB_INIT_FUNCTION(x)
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 sparse_vec_validate(v, i)
static void sparse_vec_index2(void *v, u32 si0, u32 si1, u32 *i0_return, u32 *i1_return)
unformat_function_t unformat_gre_header
#define vlib_call_init_function(vm, x)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static uword gre_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
uword os_get_cpu_number(void)
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
format_function_t * format_buffer
#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).
void gre_register_input_protocol(vlib_main_t *vm, gre_protocol_t protocol, u32 node_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 char * gre_error_strings[]
static clib_error_t * gre_init(vlib_main_t *vm)
#define CLIB_PREFETCH(addr, size, type)
u8 * format_gre_rx_trace(u8 *s, va_list *args)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
unformat_function_t * unformat_buffer
unformat_function_t * unformat_edit
static void gre_setup_node(vlib_main_t *vm, u32 node_index)
static clib_error_t * gre_input_init(vlib_main_t *vm)
static uword sparse_vec_index(void *v, uword sparse_index)
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.
#define foreach_gre_input_next
vlib_node_registration_t gre_input_node
(constructor) VLIB_REGISTER_NODE (gre_input_node)
#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)
#define vec_elt(v, i)
Get vector value at index i.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
unformat_function_t unformat_pg_gre_header
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static gre_protocol_info_t * gre_get_protocol_info(gre_main_t *em, gre_protocol_t protocol)
static void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
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.
#define SPARSE_VEC_INVALID_INDEX