|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
15 #ifndef __included_vnet_classify_h__
16 #define __included_vnet_classify_h__
30 #define CLASSIFY_TRACE 0
60 struct _vnet_classify_main;
63 #define foreach_size_in_u32x4 \
70 typedef struct _vnet_classify_entry
87 struct _vnet_classify_entry *next_free;
94 #define VNET_CLASSIFY_ENTRY_FREE (1<<0)
126 vnet_classify_entry_t e; \
128 } __clib_packed vnet_classify_entry_##size##_t;
211 #define VNET_CLASSIFY_VECTOR_SIZE \
212 sizeof (((vnet_classify_table_t *) 0)->mask[0])
214 struct _vnet_classify_main
227 u32 *classify_table_index_by_sw_if_index;
258 } xor_sum __attribute__ ((aligned (
sizeof (
u32x4))));
262 #ifdef CLIB_HAVE_VEC128
263 u32x4u *
data = (u32x4u *)
h;
287 xor_sum.as_u64[0] = data64[0 + skip_u64] & ((
u64 *)
mask)[0];
288 xor_sum.as_u64[1] = data64[1 + skip_u64] & ((
u64 *)
mask)[1];
292 xor_sum.as_u64[0] ^= data64[8 + skip_u64] & ((
u64 *)
mask)[8];
293 xor_sum.as_u64[1] ^= data64[9 + skip_u64] & ((
u64 *)
mask)[9];
296 xor_sum.as_u64[0] ^= data64[6 + skip_u64] & ((
u64 *)
mask)[6];
297 xor_sum.as_u64[1] ^= data64[7 + skip_u64] & ((
u64 *)
mask)[7];
300 xor_sum.as_u64[0] ^= data64[4 + skip_u64] & ((
u64 *)
mask)[4];
301 xor_sum.as_u64[1] ^= data64[5 + skip_u64] & ((
u64 *)
mask)[5];
304 xor_sum.as_u64[0] ^= data64[2 + skip_u64] & ((
u64 *)
mask)[2];
305 xor_sum.as_u64[1] ^= data64[3 + skip_u64] & ((
u64 *)
mask)[3];
315 #ifdef clib_crc32c_uses_intrinsics
316 return clib_crc32c ((
u8 *) & xor_sum,
sizeof (xor_sum));
318 return clib_xxhash (xor_sum.as_u64[0] ^ xor_sum.as_u64[1]);
329 bucket_index = hash & (t->
nbuckets - 1);
352 ASSERT ((vp - hp) < 0x100000000ULL);
378 bucket_index = hash & (t->
nbuckets - 1);
388 value_index = hash & ((1 <<
b->log2_pages) - 1);
408 } result __attribute__ ((aligned (
sizeof (
u32x4))));
415 bucket_index = hash & (t->
nbuckets - 1);
425 value_index = hash & ((1 <<
b->log2_pages) - 1);
430 limit *= (1 <<
b->log2_pages);
435 #ifdef CLIB_HAVE_VEC128
436 const u32x4u *
data = (
const u32x4u *)
h;
437 for (
i = 0;
i < limit;
i++)
474 const u64 *data64 = (
const u64 *)
h;
475 for (
i = 0;
i < limit;
i++)
480 (data64[0 + skip_u64] & ((
u64 *)
mask)[0]) ^ ((
u64 *)
key)[0];
482 (data64[1 + skip_u64] & ((
u64 *)
mask)[1]) ^ ((
u64 *)
key)[1];
487 (data64[8 + skip_u64] & ((
u64 *)
mask)[8]) ^ ((
u64 *)
key)[8];
489 (data64[9 + skip_u64] & ((
u64 *)
mask)[9]) ^ ((
u64 *)
key)[9];
493 (data64[6 + skip_u64] & ((
u64 *)
mask)[6]) ^ ((
u64 *)
key)[6];
495 (data64[7 + skip_u64] & ((
u64 *)
mask)[7]) ^ ((
u64 *)
key)[7];
499 (data64[4 + skip_u64] & ((
u64 *)
mask)[4]) ^ ((
u64 *)
key)[4];
501 (data64[5 + skip_u64] & ((
u64 *)
mask)[5]) ^ ((
u64 *)
key)[5];
505 (data64[2 + skip_u64] & ((
u64 *)
mask)[2]) ^ ((
u64 *)
key)[2];
507 (data64[3 + skip_u64] & ((
u64 *)
mask)[3]) ^ ((
u64 *)
key)[3];
515 if (result.as_u64[0] == 0 && result.as_u64[1] == 0)
535 u32 match_n_vectors);
538 const u8 *match,
u32 hit_next_index,
540 u16 metadata,
int is_add);
544 u32 match,
u32 next_table_index,
545 u32 miss_next_index,
u32 *table_index,
546 u8 current_data_flag,
i16 current_data_offset,
547 int is_add,
int del_chain);
549 u32 table_index,
int del_chain);
@ CLASSIFY_FLAG_USE_CURR_DATA
static u64 vnet_classify_hash_packet_inline(vnet_classify_table_t *t, const u8 *h)
unformat_function_t unformat_l3_match
unformat_function_t unformat_l3_mask
struct _vnet_classify_entry vnet_classify_entry_t
unformat_function_t unformat_l2_next_index
vnet_classify_bucket_t saved_bucket
vlib_node_registration_t ip4_classify_node
(constructor) VLIB_REGISTER_NODE (ip4_classify_node)
vlib_node_registration_t ip6_classify_node
(constructor) VLIB_REGISTER_NODE (ip6_classify_node)
static_always_inline vnet_classify_table_t * vnet_classify_table_get(u32 table_index)
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
void * clib_mem_get_heap_base(clib_mem_heap_t *heap)
nat44_ei_hairpin_src_next_t next_index
int vnet_classify_add_del_session(vnet_classify_main_t *cm, u32 table_index, const u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u16 metadata, int is_add)
void classify_set_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index, u32 table_index)
vnet_classify_main_t vnet_classify_main
unformat_function_t unformat_ip_next_index
void vnet_classify_delete_table_index(vnet_classify_main_t *cm, u32 table_index, int del_chain)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
unformat_function_t unformat_ip4_match
u32 classify_sort_table_chain(vnet_classify_main_t *cm, u32 table_index)
u32 classify_get_trace_chain(void)
vnet_classify_entry_t * vnet_classify_find_entry(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
unformat_function_t unformat_l4_match
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
unformat_function_t unformat_l2_match
static u32 u32x4_zero_byte_mask(u32x4 x)
void vnet_classify_register_unformat_l2_next_index_fn(unformat_function_t *fn)
unformat_function_t unformat_classify_match
unformat_function_t unformat_l2_mask
#define CLIB_PREFETCH(addr, size, type)
unformat_function_t unformat_ip6_mask
void vnet_classify_register_unformat_acl_next_index_fn(unformat_function_t *fn)
unformat_function_t unformat_ip4_mask
static int vnet_classify_entry_is_busy(vnet_classify_entry_t *e)
int * working_copy_lengths
struct clib_bihash_value offset
template key/value backing page structure
enum vnet_classify_action_t_ vnet_classify_action_t
STATIC_ASSERT_OFFSET_OF(vnet_classify_entry_t, key, 32)
Check there's no padding in the entry.
#define static_always_inline
vnet_classify_entry_t ** freelists
static void vnet_classify_prefetch_entry(vnet_classify_table_t *t, u64 hash)
enum vnet_classify_flags_t_ vnet_classify_flags_t
static void vnet_classify_prefetch_bucket(vnet_classify_table_t *t, u64 hash)
void vnet_classify_register_unformat_ip_next_index_fn(unformat_function_t *fn)
vnet_classify_bucket_t * buckets
#define VNET_CLASSIFY_ENTRY_FREE
sll srl srl sll sra u16x4 i
vnet_feature_config_main_t * cm
vnet_classify_entry_t ** working_copies
static u64 clib_xxhash(u64 key)
@ CLASSIFY_ACTION_SET_METADATA
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
@ CLASSIFY_ACTION_SET_IP6_FIB_INDEX
unformat_function_t unformat_classify_mask
u32 classify_lookup_chain(u32 table_index, u8 *mask, u32 n_skip, u32 n_match)
void vnet_classify_register_unformat_opaque_index_fn(unformat_function_t *fn)
template key/value backing page structure
vnet_classify_table_t * vnet_classify_new_table(vnet_classify_main_t *cm, const u8 *mask, u32 nbuckets, u32 memory_size, u32 skip_n_vectors, u32 match_n_vectors)
u8 * format_vnet_classify_table(u8 *s, va_list *args)
struct _vnet_classify_main vnet_classify_main_t
static vnet_classify_entry_t * vnet_classify_find_entry_inline(vnet_classify_table_t *t, const u8 *h, u64 hash, f64 now)
@ CLASSIFY_ACTION_SET_IP4_FIB_INDEX
unformat_function_t unformat_vlan_tag
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)
clib_spinlock_t writer_lock
int vnet_classify_add_del_table(vnet_classify_main_t *cm, const 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)
u8 pad[3]
log2 (size of the packing page block)
void vnet_classify_register_unformat_policer_next_index_fn(unformat_function_t *fn)
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
vnet_classify_flags_t current_data_flag
#define foreach_size_in_u32x4
static uword is_pow2(uword x)
vl_api_mac_event_action_t action
vl_api_interface_index_t sw_if_index
unformat_function_t unformat_ip6_match
u8 * format_classify_table(u8 *s, va_list *args)
u32 classify_get_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index)
void classify_set_trace_chain(vnet_classify_main_t *cm, u32 table_index)
vl_api_wireguard_peer_flags_t flags