|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
46 s =
format (s,
"VNET_POLICER: sw_if_index %d policer_index %d next %d",
51 #define foreach_vnet_policer_error \
52 _(TRANSMIT, "Packets Transmitted") \
53 _(DROP, "Packets Dropped")
57 #define _(sym,str) VNET_POLICER_ERROR_##sym,
64 #define _(sym,string) string,
76 u64 time_in_policer_periods;
79 time_in_policer_periods =
97 u32 sw_if_index0, sw_if_index1;
113 to_next[0] = bi0 =
from[0];
114 to_next[1] = bi1 =
from[1];
143 b0->
error =
node->errors[VNET_POLICER_ERROR_DROP];
159 b1->
error =
node->errors[VNET_POLICER_ERROR_DROP];
169 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
176 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
187 to_next, n_left_to_next,
188 bi0, bi1, next0, next1);
224 b0->
error =
node->errors[VNET_POLICER_ERROR_DROP];
233 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
244 to_next, n_left_to_next,
252 VNET_POLICER_ERROR_TRANSMIT, transmitted);
253 return frame->n_vectors;
263 .name =
"policer-input",
264 .vector_size =
sizeof (
u32),
277 .arc_name =
"device-input",
278 .node_name =
"policer-input",
291 .name =
"policer-input-handoff",
292 .vector_size =
sizeof (
u32),
320 s =
format (s,
"POLICER_CLASSIFY: sw_if_index %d next %d table %d offset %d"
327 #define foreach_policer_classify_error \
328 _(MISS, "Policer classify misses") \
329 _(HIT, "Policer classify hits") \
330 _(CHAIN_HIT, "Policer classify hits after chain walk") \
331 _(DROP, "Policer classify action drop")
335 #define _(sym,str) POLICER_CLASSIFY_ERROR_##sym,
342 #define _(sym,string) string,
362 u64 time_in_policer_periods;
364 time_in_policer_periods =
367 n_next_nodes =
node->n_next_nodes;
378 u32 sw_if_index0, sw_if_index1;
379 u32 table_index0, table_index1;
425 vnet_buffer (b0)->l2_classify.table_index = table_index0;
427 vnet_buffer (b1)->l2_classify.table_index = table_index1;
454 vnet_buffer (b0)->l2_classify.table_index = table_index0;
492 table_index1 =
vnet_buffer (p1)->l2_classify.table_index;
512 table_index0 =
vnet_buffer (b0)->l2_classify.table_index;
520 L2INPUT_FEAT_POLICER_CLAS);
538 time_in_policer_periods,
539 e0->opaque_index,
false);
543 b0->
error =
node->errors[POLICER_CLASSIFY_ERROR_DROP];
570 time_in_policer_periods,
571 e0->opaque_index,
false);
576 node->errors[POLICER_CLASSIFY_ERROR_DROP];
586 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
599 n_left_to_next, bi0, next0);
606 POLICER_CLASSIFY_ERROR_MISS, misses);
608 POLICER_CLASSIFY_ERROR_HIT, hits);
610 POLICER_CLASSIFY_ERROR_CHAIN_HIT, chain_hits);
612 return frame->n_vectors;
625 .name =
"ip4-policer-classify",
626 .vector_size =
sizeof (
u32),
647 .name =
"ip6-policer-classify",
648 .vector_size =
sizeof (
u32),
668 .name =
"l2-policer-classify",
669 .vector_size =
sizeof (
u32),
680 #ifndef CLIB_MARCH_VARIANT
struct _vnet_classify_entry vnet_classify_entry_t
vlib_main_t vlib_node_runtime_t * node
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define foreach_vnet_policer_error
static uword policer_classify_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, policer_classify_table_id_t tid)
nat44_ei_hairpin_src_next_t next_index
vnet_policer_main_t vnet_policer_main
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_registration_t ip6_policer_classify_node
(constructor) VLIB_REGISTER_NODE (ip6_policer_classify_node)
@ VLIB_NODE_TYPE_INTERNAL
policer_classify_table_id_t
vnet_classify_main_t vnet_classify_main
vlib_node_registration_t policer_input_handoff_node
(constructor) VLIB_REGISTER_NODE (policer_input_handoff_node)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
@ POLICER_CLASSIFY_TABLE_IP6
VNET_FEATURE_INIT(policer_input_node, static)
vnet_classify_entry_t * vnet_classify_find_entry(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
static_always_inline uword policer_handoff(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 fq_index, u32 policer_index)
static uword vnet_policer_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ POLICER_CLASSIFY_TABLE_L2
u32 * classify_table_index_by_sw_if_index[POLICER_CLASSIFY_N_TABLES]
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
u8 * format_policer_handoff_trace(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void vnet_classify_prefetch_entry(vnet_classify_table_t *t, u64 hash)
static void vnet_classify_prefetch_bucket(vnet_classify_table_t *t, u64 hash)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
u32 * policer_index_by_sw_if_index
#define foreach_policer_classify_error
static char * policer_input_handoff_error_strings[]
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, bool handoff)
vnet_classify_main_t * vnet_classify_main
policer_classify_main_t policer_classify_main
struct _vlib_node_registration vlib_node_registration_t
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
#define POLICER_TICKS_PER_PERIOD_SHIFT
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
#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.
description fragment has unexpected format
static char * policer_classify_error_strings[]
vlib_put_next_frame(vm, node, next_index, 0)
#define VLIB_INIT_FUNCTION(x)
@ VNET_POLICER_NEXT_HANDOFF
vlib_node_registration_t policer_input_node
(constructor) VLIB_REGISTER_NODE (policer_input_node)
static char * vnet_policer_error_strings[]
struct _vnet_classify_main vnet_classify_main_t
u64 vnet_classify_hash_packet(vnet_classify_table_t *t, u8 *h)
static uword vnet_classify_get_offset(vnet_classify_table_t *t, vnet_classify_entry_t *v)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VNET_FEATURES(...)
static u8 * format_policer_trace(u8 *s, va_list *args)
u32 feat_next_node_index[32]
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
@ POLICER_CLASSIFY_N_ERROR
static u8 * format_policer_classify_trace(u8 *s, va_list *args)
vnet_config_main_t * vnet_config_main[POLICER_CLASSIFY_N_TABLES]
@ POLICER_CLASSIFY_NEXT_INDEX_DROP
#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.
static f64 vlib_time_now(vlib_main_t *vm)
static_always_inline void clib_prefetch_store(void *p)
static u64 clib_cpu_time_now(void)
@ POLICER_CLASSIFY_TABLE_IP4
policer_classify_next_index_t
#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).
@ POLICER_CLASSIFY_NEXT_INDEX_N_NEXT
vlib_node_registration_t l2_policer_classify_node
(constructor) VLIB_REGISTER_NODE (l2_policer_classify_node)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
vl_api_fib_path_type_t type
vlib_node_registration_t ip4_policer_classify_node
(constructor) VLIB_REGISTER_NODE (ip4_policer_classify_node)
static clib_error_t * policer_classify_init(vlib_main_t *vm)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)