FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
vnet_classify.c File Reference
+ Include dependency graph for vnet_classify.c:

Go to the source code of this file.

Data Structures

struct  tcpudp_header_t
 

Macros

#define foreach_tcp_proto_field
 
#define foreach_udp_proto_field
 
#define foreach_ip4_proto_field
 
#define foreach_ip6_proto_field
 
#define foreach_l2_input_next
 
#define foreach_l2_output_next   _(drop, DROP)
 
#define foreach_ip_next
 
#define foreach_acl_next   _(deny, DENY)
 
#define TEST_CODE   1
 

Functions

void mv (vnet_classify_table_t *t)
 
void rogue (vnet_classify_table_t *t)
 
void vnet_classify_register_unformat_l2_next_index_fn (unformat_function_t *fn)
 
void vnet_classify_register_unformat_ip_next_index_fn (unformat_function_t *fn)
 
void vnet_classify_register_unformat_acl_next_index_fn (unformat_function_t *fn)
 
void vnet_classify_register_unformat_policer_next_index_fn (unformat_function_t *fn)
 
void vnet_classify_register_unformat_opaque_index_fn (unformat_function_t *fn)
 
vnet_classify_table_tvnet_classify_new_table (vnet_classify_main_t *cm, u8 *mask, u32 nbuckets, u32 memory_size, u32 skip_n_vectors, u32 match_n_vectors)
 
void vnet_classify_delete_table_index (vnet_classify_main_t *cm, u32 table_index, int del_chain)
 
static vnet_classify_entry_t * vnet_classify_entry_alloc (vnet_classify_table_t *t, u32 log2_pages)
 
static void vnet_classify_entry_free (vnet_classify_table_t *t, vnet_classify_entry_t *v)
 
static void make_working_copy (vnet_classify_table_t *t, vnet_classify_bucket_t *b)
 
static vnet_classify_entry_t * split_and_rehash (vnet_classify_table_t *t, vnet_classify_entry_t *old_values, u32 new_log2_pages)
 
int vnet_classify_add_del (vnet_classify_table_t *t, vnet_classify_entry_t *add_v, int is_add)
 
typedef CLIB_PACKED (struct{ethernet_header_t eh;ip4_header_t ip;})
 
vnet_classify_entry_t * vnet_classify_find_entry (vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
 
static u8format_classify_entry (u8 *s, va_list *args)
 
u8format_classify_table (u8 *s, va_list *args)
 
int vnet_classify_add_del_table (vnet_classify_main_t *cm, u8 *mask, u32 nbuckets, u32 memory_size, u32 skip, u32 match, u32 next_table_index, u32 miss_next_index, u32 *table_index, u8 current_data_flag, i16 current_data_offset, int is_add, int del_chain)
 
uword unformat_tcp_mask (unformat_input_t *input, va_list *args)
 
uword unformat_udp_mask (unformat_input_t *input, va_list *args)
 
uword unformat_l4_mask (unformat_input_t *input, va_list *args)
 
uword unformat_ip4_mask (unformat_input_t *input, va_list *args)
 
uword unformat_ip6_mask (unformat_input_t *input, va_list *args)
 
uword unformat_l3_mask (unformat_input_t *input, va_list *args)
 
uword unformat_l2_mask (unformat_input_t *input, va_list *args)
 
uword unformat_classify_mask (unformat_input_t *input, va_list *args)
 
uword unformat_l2_input_next_index (unformat_input_t *input, va_list *args)
 
uword unformat_l2_output_next_index (unformat_input_t *input, va_list *args)
 
uword unformat_ip_next_index (unformat_input_t *input, va_list *args)
 
uword unformat_acl_next_index (unformat_input_t *input, va_list *args)
 
uword unformat_policer_next_index (unformat_input_t *input, va_list *args)
 
static clib_error_tclassify_table_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u8format_vnet_classify_table (u8 *s, va_list *args)
 
static clib_error_tshow_classify_tables_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
uword unformat_l4_match (unformat_input_t *input, va_list *args)
 
uword unformat_ip4_match (unformat_input_t *input, va_list *args)
 
uword unformat_ip6_match (unformat_input_t *input, va_list *args)
 
uword unformat_l3_match (unformat_input_t *input, va_list *args)
 
uword unformat_vlan_tag (unformat_input_t *input, va_list *args)
 
uword unformat_l2_match (unformat_input_t *input, va_list *args)
 
uword unformat_classify_match (unformat_input_t *input, va_list *args)
 
int vnet_classify_add_del_session (vnet_classify_main_t *cm, u32 table_index, u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u32 metadata, int is_add)
 
static clib_error_tclassify_session_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static uword unformat_opaque_sw_if_index (unformat_input_t *input, va_list *args)
 
static uword unformat_ip_next_node (unformat_input_t *input, va_list *args)
 
static uword unformat_acl_next_node (unformat_input_t *input, va_list *args)
 
static uword unformat_l2_input_next_node (unformat_input_t *input, va_list *args)
 
static uword unformat_l2_output_next_node (unformat_input_t *input, va_list *args)
 
static clib_error_tvnet_classify_init (vlib_main_t *vm)
 
static clib_error_ttest_classify_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

vnet_classify_main_t vnet_classify_main
 
static vlib_cli_command_t classify_table
 (constructor) VLIB_CLI_COMMAND (classify_table) More...
 
static vlib_cli_command_t show_classify_table_command
 (constructor) VLIB_CLI_COMMAND (show_classify_table_command) More...
 
static vlib_cli_command_t classify_session_command
 (constructor) VLIB_CLI_COMMAND (classify_session_command) More...
 
static vlib_cli_command_t test_classify_command
 (constructor) VLIB_CLI_COMMAND (test_classify_command) More...
 

Macro Definition Documentation

#define foreach_acl_next   _(deny, DENY)

Definition at line 1306 of file vnet_classify.c.

#define foreach_ip4_proto_field
Value:
_(src_address) \
_(dst_address) \
_(tos) \
_(length) \
_(fragment_id) \
_(ttl) \
_(protocol) \
_(checksum)

Definition at line 705 of file vnet_classify.c.

#define foreach_ip6_proto_field
Value:
_(src_address) \
_(dst_address) \
_(payload_length) \
_(hop_limit) \
_(protocol)

Definition at line 895 of file vnet_classify.c.

#define foreach_ip_next
Value:
_(drop, DROP) \
_(rewrite, REWRITE)
DROP
Definition: error.def:41

Definition at line 1266 of file vnet_classify.c.

#define foreach_l2_input_next
Value:
_(drop, DROP) \
_(ethernet, ETHERNET_INPUT) \
_(ip4, IP4_INPUT) \
_(ip6, IP6_INPUT) \
_(li, LI)
DROP
Definition: error.def:41

Definition at line 1184 of file vnet_classify.c.

#define foreach_l2_output_next   _(drop, DROP)

Definition at line 1227 of file vnet_classify.c.

#define foreach_tcp_proto_field
Value:
_(src_port) \
_(dst_port)

Definition at line 697 of file vnet_classify.c.

#define foreach_udp_proto_field
Value:
_(src_port) \
_(dst_port)

Definition at line 701 of file vnet_classify.c.

#define TEST_CODE   1

Definition at line 2283 of file vnet_classify.c.

Function Documentation

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

Definition at line 2050 of file vnet_classify.c.

+ Here is the call graph for this function:

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

Definition at line 1382 of file vnet_classify.c.

+ Here is the call graph for this function:

typedef CLIB_PACKED ( struct{ethernet_header_t eh;ip4_header_t ip;}  )

Definition at line 553 of file vnet_classify.c.

+ Here is the call graph for this function:

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

Definition at line 570 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_classify_table ( u8 s,
va_list *  args 
)

Definition at line 592 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1486 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void make_working_copy ( vnet_classify_table_t t,
vnet_classify_bucket_t b 
)
inlinestatic

Definition at line 244 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mv ( vnet_classify_table_t t)

Definition at line 66 of file vnet_classify.c.

void rogue ( vnet_classify_table_t t)

Definition at line 67 of file vnet_classify.c.

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

Definition at line 1521 of file vnet_classify.c.

+ Here is the call graph for this function:

static vnet_classify_entry_t* split_and_rehash ( vnet_classify_table_t t,
vnet_classify_entry_t *  old_values,
u32  new_log2_pages 
)
static

Definition at line 325 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 2287 of file vnet_classify.c.

+ Here is the call graph for this function:

uword unformat_acl_next_index ( unformat_input_t input,
va_list *  args 
)

Definition at line 1309 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_acl_next_node ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 2189 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_classify_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 1094 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_classify_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1929 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip4_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 834 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip4_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1602 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip6_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 902 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip6_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1697 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip_next_index ( unformat_input_t input,
va_list *  args 
)

Definition at line 1270 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_ip_next_node ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 2162 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l2_input_next_index ( unformat_input_t input,
va_list *  args 
)

Definition at line 1191 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_l2_input_next_node ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 2216 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l2_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 987 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l2_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1815 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l2_output_next_index ( unformat_input_t input,
va_list *  args 
)

Definition at line 1230 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_l2_output_next_node ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 2236 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l3_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 972 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l3_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1784 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l4_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 799 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_l4_match ( unformat_input_t input,
va_list *  args 
)

Definition at line 1572 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_opaque_sw_if_index ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 2147 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_policer_next_index ( unformat_input_t input,
va_list *  args 
)

Definition at line 1350 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_tcp_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 715 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_udp_mask ( unformat_input_t input,
va_list *  args 
)

Definition at line 755 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_vlan_tag ( unformat_input_t input,
va_list *  args 
)

Definition at line 1800 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_classify_add_del ( vnet_classify_table_t t,
vnet_classify_entry_t *  add_v,
int  is_add 
)

Definition at line 378 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_classify_add_del_session ( vnet_classify_main_t cm,
u32  table_index,
u8 match,
u32  hit_next_index,
u32  opaque_index,
i32  advance,
u8  action,
u32  metadata,
int  is_add 
)

Definition at line 2002 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_classify_add_del_table ( vnet_classify_main_t cm,
u8 mask,
u32  nbuckets,
u32  memory_size,
u32  skip,
u32  match,
u32  next_table_index,
u32  miss_next_index,
u32 table_index,
u8  current_data_flag,
i16  current_data_offset,
int  is_add,
int  del_chain 
)

Definition at line 649 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vnet_classify_delete_table_index ( vnet_classify_main_t cm,
u32  table_index,
int  del_chain 
)

Definition at line 144 of file vnet_classify.c.

+ Here is the caller graph for this function:

static vnet_classify_entry_t* vnet_classify_entry_alloc ( vnet_classify_table_t t,
u32  log2_pages 
)
static

Definition at line 166 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vnet_classify_entry_free ( vnet_classify_table_t t,
vnet_classify_entry_t *  v 
)
static

Definition at line 228 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vnet_classify_entry_t* vnet_classify_find_entry ( vnet_classify_table_t t,
u8 h,
u64  hash,
f64  now 
)

Definition at line 564 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* vnet_classify_init ( vlib_main_t vm)
static

Definition at line 2256 of file vnet_classify.c.

+ Here is the call graph for this function:

vnet_classify_table_t* vnet_classify_new_table ( vnet_classify_main_t cm,
u8 mask,
u32  nbuckets,
u32  memory_size,
u32  skip_n_vectors,
u32  match_n_vectors 
)

Definition at line 108 of file vnet_classify.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vnet_classify_register_unformat_acl_next_index_fn ( unformat_function_t fn)

Definition at line 85 of file vnet_classify.c.

+ Here is the caller graph for this function:

void vnet_classify_register_unformat_ip_next_index_fn ( unformat_function_t fn)

Definition at line 77 of file vnet_classify.c.

+ Here is the caller graph for this function:

void vnet_classify_register_unformat_l2_next_index_fn ( unformat_function_t fn)

Definition at line 70 of file vnet_classify.c.

+ Here is the caller graph for this function:

void vnet_classify_register_unformat_opaque_index_fn ( unformat_function_t fn)

Definition at line 100 of file vnet_classify.c.

+ Here is the caller graph for this function:

void vnet_classify_register_unformat_policer_next_index_fn ( unformat_function_t fn)

Definition at line 93 of file vnet_classify.c.

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t classify_session_command
static
Initial value:
= {
.path = "classify session",
.short_help =
"classify session [hit-next|l2-hit-next|"
"acl-hit-next <next_index>|policer-hit-next <policer_name>]"
"\n table-index <nn> match [hex] [l2] [l3 ip4] [opaque-index <index>]"
"\n [action set-ip4-fib-id <n>] [action set-ip6-fib-id <n>] [del]",
}
static clib_error_t * classify_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (classify_session_command)

Definition at line 2136 of file vnet_classify.c.

vlib_cli_command_t classify_table
static
Initial value:
= {
.path = "classify table",
.short_help =
"classify table [miss-next|l2-miss_next|acl-miss-next <next_index>]"
"\n mask <mask-value> buckets <nn> [skip <n>] [match <n>]"
"\n [current-data-flag <n>] [current-data-offset <n>] [table <n>]"
"\n [del] [del-chain]",
}
static clib_error_t * classify_table_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (classify_table)

Definition at line 1476 of file vnet_classify.c.

vlib_cli_command_t show_classify_table_command
static
Initial value:
= {
.path = "show classify tables",
.short_help = "show classify tables [index <nn>]",
}
static clib_error_t * show_classify_tables_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (show_classify_table_command)

Definition at line 1566 of file vnet_classify.c.

vlib_cli_command_t test_classify_command
static
Initial value:
= {
.path = "test classify",
.short_help =
"test classify [src <ip>] [sessions <nn>] [buckets <nn>] [table <nn>] [del]",
}
static clib_error_t * test_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (test_classify_command)

Definition at line 2430 of file vnet_classify.c.

vnet_classify_main_t vnet_classify_main

Definition at line 22 of file vnet_classify.c.