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);
291 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
299 while (n_left_from > 0)
303 while (n_left_from > 0 && n_left_to_next > 0)
313 bi0 = to_next[0] = from[0];
357 n_left_to_next, bi0, next0);
371 u32 *from, *to_next, n_left_from, n_left_to_next, next_index;
377 while (n_left_from > 0)
381 while (n_left_from >= 8 && n_left_to_next >= 4)
384 u32 next0, next1, next2, next3;
385 u32 bi0, bi1, bi2, bi3;
387 next0 = next1 = next2 = next3 = 0;
404 bi0 = to_next[0] = from[0];
405 bi1 = to_next[1] = from[1];
406 bi2 = to_next[2] = from[2];
407 bi3 = to_next[3] = from[3];
427 to_next, n_left_to_next,
429 next0, next1, next2, next3);
432 while (n_left_from > 0 && n_left_to_next > 0)
439 bi0 = to_next[0] = from[0];
451 n_left_to_next, bi0, next0);
vnet_config_main_t config_main
#define POLICER_TICKS_PER_PERIOD_SHIFT
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
u8 * format_ip_punt_policer_trace(u8 *s, va_list *args)
ip_punt_redirect_rx_t * redirect_by_rx_sw_if_index
per-RX interface configuration
This packet is to be rewritten and forwarded to the next processing node.
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)
void ip_punt_redirect_del(ip_punt_redirect_t *cfg, u32 rx_sw_if_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.
struct ip_punt_policer_t_ ip_punt_policer_t
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
ip_punt_redirect_next_t_
IP punt redirect next nodes.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
ip46_address_t nh
The next-hop to send redirected packets to.
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.
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.
ip_punt_redirect_rx_t redirect
static u32 ip_punt_redirect_tx_via_adj(vlib_buffer_t *b0, adj_index_t ai)
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.
#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 uword ip_punt_redirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, ip_punt_redirect_t *redirect)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
ip_punt_redirect_rx_t any_rx_sw_if_index
any RX interface redirect
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
#define VLIB_BUFFER_IS_TRACED
u32 tx_sw_if_index
the TX interface to send redirected packets
u32 adj_index_t
An index for adjacencies.
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.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
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 void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
enum ip_punt_policer_next_t_ ip_punt_policer_next_t
void ip_punt_redirect_add(ip_punt_redirect_t *cfg, u32 rx_sw_if_index, ip_punt_redirect_rx_t *redirect, fib_protocol_t fproto, vnet_link_t linkt)
Add a punt redirect entry.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vnet_feature_config_main_t * feature_config_mains
feature config main objects
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
vnet_feature_main_t feature_main
adj_index_t adj_index
redirect forwarding adjacency
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.
struct ip_punt_redirect_t_ ip_punt_redirect_t
IP punt redirect configuration.
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)