FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
l2_input_classify.c File Reference

L2 input classifier. More...

+ Include dependency graph for l2_input_classify.c:

Go to the source code of this file.

Data Structures

struct  l2_input_classify_trace_t
 l2_input_classifier packet trace record. More...
 
struct  l2_input_classify_runtime_t
 vlib node runtime. More...
 

Macros

#define foreach_l2_input_classify_error
 

Enumerations

enum  l2_input_classify_error_t { L2_INPUT_CLASSIFY_N_ERROR }
 

Functions

static u8format_l2_input_classify_trace (u8 *s, va_list *args)
 Packet trace format function. More...
 
VLIB_NODE_FN() l2_input_classify_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 l2 input classifier node. More...
 
clib_error_tl2_input_classify_init (vlib_main_t *vm)
 l2 input classsifier feature initialization. More...
 
clib_error_tl2_input_classify_worker_init (vlib_main_t *vm)
 
 VLIB_WORKER_INIT_FUNCTION (l2_input_classify_worker_init)
 
void vnet_l2_input_classify_enable_disable (u32 sw_if_index, int enable_disable)
 Enable/disable l2 input classification on a specific interface. More...
 
int vnet_l2_input_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 input classification tables. More...
 
static clib_error_tint_l2_input_classify_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

l2_input_classify_main_t l2_input_classify_main
 l2 input classifier main data structure. More...
 
static char * l2_input_classify_error_strings []
 
vlib_node_registration_t l2_input_classify_node
 (constructor) VLIB_REGISTER_NODE (l2_input_classify_node) More...
 
static vlib_cli_command_t int_l2_input_classify_cli
 (constructor) VLIB_CLI_COMMAND (int_l2_input_classify_cli) More...
 

Detailed Description

Macro Definition Documentation

◆ foreach_l2_input_classify_error

#define foreach_l2_input_classify_error
Value:
_(MISS, "Classify misses") \
_(HIT, "Classify hits") \
_(CHAIN_HIT, "Classify hits after chain walk") \
_(DROP, "L2 Classify Drops")

Definition at line 77 of file l2_input_classify.c.

Enumeration Type Documentation

◆ l2_input_classify_error_t

Enumerator
L2_INPUT_CLASSIFY_N_ERROR 

Definition at line 83 of file l2_input_classify.c.

Function Documentation

◆ format_l2_input_classify_trace()

static u8* format_l2_input_classify_trace ( u8 s,
va_list *  args 
)
static

Packet trace format function.

Definition at line 58 of file l2_input_classify.c.

◆ int_l2_input_classify_command_fn()

static clib_error_t* int_l2_input_classify_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 582 of file l2_input_classify.c.

+ Here is the call graph for this function:

◆ l2_input_classify_init()

clib_error_t* l2_input_classify_init ( vlib_main_t vm)

l2 input classsifier feature initialization.

Definition at line 474 of file l2_input_classify.c.

+ Here is the call graph for this function:

◆ l2_input_classify_node()

VLIB_NODE_FN() l2_input_classify_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

l2 input classifier node.

Node Identifier:
l2-input-classify

This is the l2 input classifier dispatch node

Parameters
vmvlib_main_t corresponding to the current thread.
nodevlib_node_runtime_t data for this node.
framevlib_frame_t whose contents should be dispatched.
Graph mechanics: buffer metadata, next index usage

Uses:

  • (l2_input_classify_runtime_t *) rt->classify_table_index_by_sw_if_index
    • Head of the per-interface, per-protocol classifier table chain for a specific interface.
    • ~0 => send pkts to the next feature in the L2 feature chain.
  • vnet_buffer(b)->sw_if_index[VLIB_RX]
    • Indicates the sw_if_index value of the interface that the packet was received on.
  • vnet_buffer(b0)->l2.feature_bitmap
    • Used to steer packets across l2 features enabled on the interface
  • (vnet_classify_entry_t) e0->next_index
    • Used to steer traffic when the classifier hits on a session
  • (vnet_classify_entry_t) e0->advance
    • Signed quantity applied via vlib_buffer_advance when the classifier hits on a session
  • (vnet_classify_table_t) t0->miss_next_index
    • Used to steer traffic when the classifier misses

Sets:

  • vnet_buffer (b0)->l2_classify.table_index
    • Classifier table index of the first classifier table in the classifier table chain
  • vnet_buffer (b0)->l2_classify.hash
    • Bounded-index extensible hash corresponding to the masked fields in the current packet
  • vnet_buffer (b0)->l2.feature_bitmap
    • Used to steer packets across l2 features enabled on the interface
  • vnet_buffer (b0)->l2_classify.opaque_index
    • Copied from the classifier session object upon classifier hit

Counters:

  • L2_INPUT_CLASSIFY_ERROR_MISS Classifier misses
  • L2_INPUT_CLASSIFY_ERROR_HIT Classifier hits
  • L2_INPUT_CLASSIFY_ERROR_CHAIN_HIT Classifier hits in other than the first table

Definition at line 147 of file l2_input_classify.c.

+ Here is the call graph for this function:

◆ l2_input_classify_worker_init()

clib_error_t* l2_input_classify_worker_init ( vlib_main_t vm)

Definition at line 500 of file l2_input_classify.c.

+ Here is the call graph for this function:

◆ VLIB_WORKER_INIT_FUNCTION()

VLIB_WORKER_INIT_FUNCTION ( l2_input_classify_worker_init  )

◆ vnet_l2_input_classify_enable_disable()

void vnet_l2_input_classify_enable_disable ( u32  sw_if_index,
int  enable_disable 
)

Enable/disable l2 input classification on a specific interface.

Definition at line 517 of file l2_input_classify.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_l2_input_classify_set_tables()

int vnet_l2_input_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 input classification tables.

Parameters
sw_if_indexinterface handle
ip4_table_indexip4 classification table index, or ~0
ip6_table_indexip6 classification table index, or ~0
other_table_indexnon-ip4, non-ip6 classification table index, or ~0
Returns
0 on success, VNET_API_ERROR_NO_SUCH_TABLE, TABLE2, TABLE3 if the indicated (non-~0) table does not exist.

Definition at line 535 of file l2_input_classify.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ int_l2_input_classify_cli

vlib_cli_command_t int_l2_input_classify_cli
static
Initial value:
= {
.path = "set interface l2 input classify",
.short_help =
"set interface l2 input classify intfc <interface-name> [ip4-table <n>]\n"
" [ip6-table <n>] [other-table <n>]",
}

(constructor) VLIB_CLI_COMMAND (int_l2_input_classify_cli)

Definition at line 647 of file l2_input_classify.c.

◆ l2_input_classify_error_strings

char* l2_input_classify_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}

Definition at line 91 of file l2_input_classify.c.

◆ l2_input_classify_main

l2_input_classify_main_t l2_input_classify_main

l2 input classifier main data structure.

Definition at line 74 of file l2_input_classify.c.

◆ l2_input_classify_node

vlib_node_registration_t l2_input_classify_node
Initial value:
= {
.name = "l2-input-classify",
.vector_size = sizeof (u32),
.runtime_data_bytes = sizeof (l2_input_classify_runtime_t),
.n_next_nodes = L2_INPUT_CLASSIFY_N_NEXT,
.next_nodes = {
[L2_INPUT_CLASSIFY_NEXT_DROP] = "error-drop",
[L2_INPUT_CLASSIFY_NEXT_ETHERNET_INPUT] = "ethernet-input-not-l2",
},
}

(constructor) VLIB_REGISTER_NODE (l2_input_classify_node)

Definition at line 447 of file l2_input_classify.c.

L2_INPUT_CLASSIFY_NEXT_LI
@ L2_INPUT_CLASSIFY_NEXT_LI
Definition: l2_classify.h:42
int_l2_input_classify_command_fn
static clib_error_t * int_l2_input_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_input_classify.c:582
L2_INPUT_CLASSIFY_NEXT_IP6_INPUT
@ L2_INPUT_CLASSIFY_NEXT_IP6_INPUT
Definition: l2_classify.h:41
format_l2_input_classify_trace
static u8 * format_l2_input_classify_trace(u8 *s, va_list *args)
Packet trace format function.
Definition: l2_input_classify.c:58
l2_input_classify_runtime_t
vlib node runtime.
Definition: l2_input_classify.c:48
DROP
DROP
Definition: error.def:41
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
L2_INPUT_CLASSIFY_N_NEXT
@ L2_INPUT_CLASSIFY_N_NEXT
Definition: l2_classify.h:43
l2_input_classify_error_strings
static char * l2_input_classify_error_strings[]
Definition: l2_input_classify.c:91
L2_INPUT_CLASSIFY_NEXT_IP4_INPUT
@ L2_INPUT_CLASSIFY_NEXT_IP4_INPUT
Definition: l2_classify.h:40
L2_INPUT_CLASSIFY_NEXT_ETHERNET_INPUT
@ L2_INPUT_CLASSIFY_NEXT_ETHERNET_INPUT
Definition: l2_classify.h:39
L2_INPUT_CLASSIFY_NEXT_DROP
@ L2_INPUT_CLASSIFY_NEXT_DROP
Definition: l2_classify.h:38
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
foreach_l2_input_classify_error
#define foreach_l2_input_classify_error
Definition: l2_input_classify.c:77
u32
unsigned int u32
Definition: types.h:88
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123