|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
56 s =
format (s,
"l2-classify: sw_if_index %d, table %d, offset %x, next %d",
64 #ifndef CLIB_MARCH_VARIANT
69 #define foreach_l2_output_classify_error \
70 _(MISS, "Classify misses") \
71 _(HIT, "Classify hits") \
72 _(CHAIN_HIT, "Classify hits after chain walk") \
73 _(DROP, "L2 Classify Drops")
77 #define _(sym,str) L2_OUTPUT_CLASSIFY_ERROR_##sym,
84 #define _(sym,string) string,
156 n_next_nodes =
node->n_next_nodes;
170 u32 sw_if_index0, sw_if_index1;
172 int type_index0, type_index1;
174 u32 table_index0, table_index1;
206 type0 = clib_net_to_host_u16 (h0->
type);
207 type1 = clib_net_to_host_u16 (h1->
type);
209 type_index0 = (type0 == ETHERNET_TYPE_IP4)
211 type_index0 = (type0 == ETHERNET_TYPE_IP6)
214 type_index1 = (type1 == ETHERNET_TYPE_IP4)
216 type_index1 = (type1 == ETHERNET_TYPE_IP6)
221 rt->l2cm->classify_table_index_by_sw_if_index
222 [type_index0][sw_if_index0];
224 if (table_index0 != ~0)
235 rt->l2cm->classify_table_index_by_sw_if_index
236 [type_index1][sw_if_index1];
238 if (table_index1 != ~0)
270 type0 = clib_net_to_host_u16 (h0->
type);
272 type_index0 = (type0 == ETHERNET_TYPE_IP4)
274 type_index0 = (type0 == ETHERNET_TYPE_IP6)
278 table_index0 =
rt->l2cm->classify_table_index_by_sw_if_index
279 [type_index0][sw_if_index0];
281 if (table_index0 != ~0)
326 table_index2 =
vnet_buffer (p2)->l2_classify.table_index;
346 table_index0 =
vnet_buffer (b0)->l2_classify.table_index;
361 next0 = (e0->next_index < n_next_nodes) ?
362 e0->next_index : next0;
388 next0 = (e0->next_index < n_next_nodes) ?
389 e0->next_index : next0;
399 b0->
error =
node->errors[L2_OUTPUT_CLASSIFY_ERROR_DROP];
404 L2OUTPUT_FEAT_OUTPUT_CLASSIFY);
407 ~L2OUTPUT_FEAT_OUTPUT_CLASSIFY;
410 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
422 to_next, n_left_to_next,
430 L2_OUTPUT_CLASSIFY_ERROR_MISS, misses);
432 L2_OUTPUT_CLASSIFY_ERROR_HIT, hits);
434 L2_OUTPUT_CLASSIFY_ERROR_CHAIN_HIT,
436 return frame->n_vectors;
441 .name =
"l2-output-classify",
442 .vector_size =
sizeof (
u32),
460 #ifndef CLIB_MARCH_VARIANT
479 cm->l2_out_feat_next);
481 rt->vcm =
cm->vnet_classify_main;
497 rt->vcm =
cm->vnet_classify_main;
510 (
u32) enable_disable);
528 u32 other_table_index)
535 if (ip4_table_index != ~0 &&
537 return VNET_API_ERROR_NO_SUCH_TABLE;
539 if (ip6_table_index != ~0 &&
541 return VNET_API_ERROR_NO_SUCH_TABLE2;
543 if (other_table_index != ~0 &&
545 return VNET_API_ERROR_NO_SUCH_TABLE3;
579 u32 ip4_table_index = ~0;
580 u32 ip6_table_index = ~0;
581 u32 other_table_index = ~0;
589 else if (
unformat (input,
"ip4-table %d", &ip4_table_index))
591 else if (
unformat (input,
"ip6-table %d", &ip6_table_index))
593 else if (
unformat (input,
"other-table %d", &other_table_index))
603 if (ip4_table_index == ~0 && ip6_table_index == ~0
604 && other_table_index == ~0)
640 .path =
"set interface l2 output classify",
642 "set interface l2 output classify intfc <<interface-name>> [ip4-table <n>]\n"
643 " [ip6-table <n>] [other-table <n>]",
u32 next_index
graph arc index selected for this packet
VLIB_WORKER_INIT_FUNCTION(l2_output_classify_worker_init)
struct _vnet_classify_entry vnet_classify_entry_t
vlib_node_registration_t l2_output_classify_node
(constructor) VLIB_REGISTER_NODE (l2_output_classify_node)
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u32 session_offset
offset in classifier heap of the corresponding session
nat44_ei_hairpin_src_next_t next_index
struct _l2_classify_main l2_output_classify_main_t
clib_error_t * l2_output_classify_worker_init(vlib_main_t *vm)
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_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
vnet_classify_main_t vnet_classify_main
l2_output_classify_main_t * l2cm
l2 input classifier main object pointer
#define clib_error_return(e, args...)
@ L2_OUTPUT_CLASSIFY_NEXT_DROP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ L2_OUTPUT_CLASSIFY_TABLE_IP4
l2_output_classify_error_t
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
vnet_classify_entry_t * vnet_classify_find_entry(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
char ** l2output_get_feat_names(void)
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
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)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
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)
@ L2_OUTPUT_CLASSIFY_TABLE_OTHER
int vnet_l2_output_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface output classification tables.
vnet_feature_config_main_t * cm
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * int_l2_output_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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...
clib_error_t * l2_output_classify_init(vlib_main_t *vm)
l2 output classsifier feature initialization.
#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.
u32 sw_if_index
interface handle for the ith packet
static vlib_cli_command_t int_l2_output_classify_cli
(constructor) VLIB_CLI_COMMAND (int_l2_output_classify_cli)
l2_output_classify_main_t l2_output_classify_main
l2 output classifier main data structure.
void l2output_intf_bitmap_enable(u32 sw_if_index, l2output_feat_masks_t feature_bitmap, u32 enable)
Enable (or disable) the feature in the bitmap for the given interface.
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
#define VLIB_INIT_FUNCTION(x)
vnet_classify_main_t * vcm
use-case independent main object pointer
struct _vnet_classify_main vnet_classify_main_t
static char * l2_output_classify_error_strings[]
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)
@ L2_OUTPUT_CLASSIFY_N_ERROR
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
@ L2_OUTPUT_CLASSIFY_N_NEXT
l2_output_classify_next_t
#define foreach_l2_output_classify_error
static u8 * format_l2_output_classify_trace(u8 *s, va_list *args)
Packet trace format function.
u32 table_index
classifier table which provided the final result
static f64 vlib_time_now(vlib_main_t *vm)
@ L2_OUTPUT_CLASSIFY_TABLE_IP6
static_always_inline void clib_prefetch_store(void *p)
vl_api_interface_index_t sw_if_index
#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 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
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,...)