16 #ifndef __IP_PUNT_DROP_H__ 17 #define __IP_PUNT_DROP_H__ 44 #define foreach_ip_punt_policer_error \ 45 _(DROP, "ip punt policer drop") 49 #define _(sym,str) IP_PUNT_POLICER_ERROR_##sym, 65 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
66 u64 time_in_policer_periods;
70 time_in_policer_periods =
77 while (n_left_from > 0)
81 while (n_left_from >= 4 && n_left_to_next >= 2)
89 bi0 = to_next[0] = from[0];
90 bi1 = to_next[1] = from[1];
107 time_in_policer_periods,
111 time_in_policer_periods,
117 b0->
error = node->
errors[IP_PUNT_POLICER_ERROR_DROP];
122 b1->
error = node->
errors[IP_PUNT_POLICER_ERROR_DROP];
141 bi0, bi1, next0, next1);
143 while (n_left_from > 0 && n_left_to_next > 0)
151 bi0 = to_next[0] = from[0];
165 time_in_policer_periods,
170 b0->
error = node->
errors[IP_PUNT_POLICER_ERROR_DROP];
182 n_left_to_next, bi0, next0);
266 redirect,
void *arg);
281 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
291 while (n_left_from > 0)
295 while (n_left_from > 0 && n_left_to_next > 0)
297 u32 rx_sw_if_index0, rrxi0;
305 bi0 = to_next[0] = from[0];
323 if (
vec_len (redirects) > rx_sw_if_index0)
325 rrxi0 = redirects[rx_sw_if_index0];
327 rrxi0 = redirects[0];
329 else if (
vec_len (redirects) >= 1)
330 rrxi0 = redirects[0];
348 n_left_to_next, bi0, next0);
362 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
368 while (n_left_from > 0)
372 while (n_left_from >= 8 && n_left_to_next >= 4)
375 u32 next0, next1, next2, next3;
376 u32 bi0, bi1, bi2, bi3;
378 next0 = next1 = next2 = next3 = 0;
395 bi0 = to_next[0] = from[0];
396 bi1 = to_next[1] = from[1];
397 bi2 = to_next[2] = from[2];
398 bi3 = to_next[3] = from[3];
418 to_next, n_left_to_next,
420 next0, next1, next2, next3);
423 while (n_left_from > 0 && n_left_to_next > 0)
430 bi0 = to_next[0] = from[0];
442 n_left_to_next, bi0, next0);
vnet_config_main_t config_main
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
ip_punt_redirect_rx_t * pool
index_t ip_punt_redirect_find(fib_protocol_t fproto, u32 rx_sw_if_index)
#define POLICER_TICKS_PER_PERIOD_SHIFT
A representation of a path as described by a route producer.
u8 * format_ip_punt_policer_trace(u8 *s, va_list *args)
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static u64 clib_cpu_time_now(void)
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
static uword ip_drop_or_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index)
vlib_error_t * errors
Vector of errors for this node.
u8 * format_ip_punt_redirect(u8 *s, va_list *args)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
enum walk_rc_t_ walk_rc_t
Walk return code.
struct ip_punt_policer_t_ ip_punt_policer_t
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
#define static_always_inline
ip_punt_redirect_next_t_
IP punt redirect next nodes.
fib_forward_chain_type_t payload_type
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
u8 * format_ip_punt_redirect_trace(u8 *s, va_list *args)
struct ip4_punt_redirect_trace_t_ ip_punt_redirect_trace_t
IP Punt redirect trace.
#define foreach_ip_punt_policer_error
IP punt redirect configuration.
void ip_punt_redirect_del(fib_protocol_t fproto, u32 rx_sw_if_index)
static uword ip_punt_policer(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, u32 policer_index)
IP punt policing node function.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
fib_node_t node
Node linkage into the FIB graph.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void ip_punt_redirect_add(fib_protocol_t fproto, u32 rx_sw_if_index, fib_forward_chain_type_t ct, fib_route_path_t *rpaths)
Add a punt redirect entry.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
#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.
An node in the FIB 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_always_inline ip_punt_redirect_rx_t * ip_punt_redirect_get(index_t rrxi)
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
dpo_id_t dpo
redirect forwarding
u32 fib_node_index_t
A typedef of a node index.
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
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_main_t vlib_node_runtime_t * node
struct ip_punt_redirect_t_ ip_punt_redirect_cfg_t
IP punt redirect configuration.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
walk_rc_t(* ip_punt_redirect_walk_cb_t)(u32 rx_sw_if_index, const ip_punt_redirect_rx_t *redirect, void *arg)
static_always_inline u8 vnet_policer_police(vlib_main_t *vm, vlib_buffer_t *b, u32 policer_index, u64 time_in_policer_periods, policer_result_e packet_color)
struct ip_punt_policer_trace_t_ ip_punt_policer_trace_t
struct ip_punt_redirect_rx_t_ ip_punt_redirect_rx_t
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
static uword ip_punt_redirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, fib_protocol_t fproto)
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
enum ip_punt_policer_next_t_ ip_punt_policer_next_t
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
index_t * redirect_by_rx_sw_if_index[FIB_PROTOCOL_IP_MAX]
per-RX interface configuration.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u16 dpoi_next_node
The next VLIB node to follow.
vnet_feature_config_main_t * feature_config_mains
feature config main objects
vnet_feature_main_t feature_main
enum ip_punt_redirect_next_t_ ip_punt_redirect_next_t
IP punt redirect next nodes.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
ip_punt_redirect_cfg_t ip_punt_redirect_cfg
void ip_punt_redirect_walk(fib_protocol_t fproto, ip_punt_redirect_walk_cb_t cb, void *ctx)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)