FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
vnet_classify.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_vnet_classify_h__
16 #define __included_vnet_classify_h__
17 
18 #include <vnet/vnet.h>
19 #include <vnet/api_errno.h> /* for API error numbers */
20 
21 #include <vppinfra/error.h>
22 #include <vppinfra/hash.h>
23 #include <vppinfra/cache.h>
24 #include <vppinfra/crc32.h>
25 #include <vppinfra/xxhash.h>
26 
29 
30 #define CLASSIFY_TRACE 0
31 
32 /*
33  * Classify table option to process packets
34  * CLASSIFY_FLAG_USE_CURR_DATA:
35  * - classify packets starting from VPP node’s current data pointer
36  */
38 {
41 } __clib_packed vnet_classify_flags_t;
42 
43 /*
44  * Classify session action
45  * CLASSIFY_ACTION_SET_IP4_FIB_INDEX:
46  * - Classified IP packets will be looked up
47  * from the specified ipv4 fib table
48  * CLASSIFY_ACTION_SET_IP6_FIB_INDEX:
49  * - Classified IP packets will be looked up
50  * from the specified ipv6 fib table
51  */
53 {
58 } __clib_packed vnet_classify_action_t;
59 
60 struct _vnet_classify_main;
61 typedef struct _vnet_classify_main vnet_classify_main_t;
62 
63 #define foreach_size_in_u32x4 \
64 _(1) \
65 _(2) \
66 _(3) \
67 _(4) \
68 _(5)
69 
70 typedef struct _vnet_classify_entry
71 {
72  /* put into vnet_buffer(b)->l2_classfy.opaque_index */
73  union
74  {
75  struct
76  {
77  u32 opaque_index;
78  /* advance on hit, note it's a signed quantity... */
79  i32 advance;
80  };
81  u64 opaque_count;
82  };
83  /* Hit counter */
84  union
85  {
86  u64 hits;
87  struct _vnet_classify_entry *next_free;
88  };
89  /* last heard time */
90  f64 last_heard;
91 
92  /* Really only need 1 bit */
93  u8 flags;
94 #define VNET_CLASSIFY_ENTRY_FREE (1<<0)
95 
97  u16 metadata;
98  /* Graph node next index */
100 
101  /* Must be aligned to a 16-octet boundary */
102  u32x4 key[0];
104 
105 /**
106  * Check there's no padding in the entry. the key lies on a 16 byte boundary.
107  */
109 
110 static inline int
112 {
113  return e->flags & VNET_CLASSIFY_ENTRY_FREE;
114 }
115 
116 static inline int
118 {
119  return ((e->flags & VNET_CLASSIFY_ENTRY_FREE) == 0);
120 }
121 
122 /* Need these to con the vector allocator */
123 #define _(size) \
124  typedef struct \
125  { \
126  vnet_classify_entry_t e; \
127  u32x4 key[size]; \
128  } __clib_packed vnet_classify_entry_##size##_t;
130 #undef _
131 
132 typedef struct
133 {
134  union
135  {
136  struct
137  {
140  u8 pad[2];
142  };
144  };
146 
147 typedef struct
148 {
149  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
150  /* hash Buckets */
152 
153  /* Private allocation arena, protected by the writer lock,
154  * where the entries are stored. */
155  void *mheap;
156 
157  /* User/client data associated with the table */
159 
165 
166  /* Index of next table to try */
168 
169  /* packet offsets */
172  /* Miss next index, return if next_table_index = 0 */
174 
175  /**
176  * All members accessed in the DP above here
177  */
178  CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
179 
180  /* Config parameters */
184 
185  /* Per-bucket working copies, one per thread */
189 
190  /* Free entry freelists */
192 
193  /* Writer (only) lock for this table */
195 
196  CLIB_CACHE_LINE_ALIGN_MARK (cacheline2);
197  /* Mask to apply after skipping N vectors */
199 
201 
202 /**
203  * Ensure DP fields don't spill over to cache-line 2
204  */
207 
208 /**
209  * The vector size for the classifier
210  * in the add/del table 'match' is the number of vectors of this size
211  */
212 #define VNET_CLASSIFY_VECTOR_SIZE \
213  sizeof (((vnet_classify_table_t *) 0)->mask[0])
214 
215 struct _vnet_classify_main
216 {
217  /* Table pool */
218  vnet_classify_table_t *tables;
219 
220  /* Registered next-index, opaque unformat fcns */
221  unformat_function_t **unformat_l2_next_index_fns;
222  unformat_function_t **unformat_ip_next_index_fns;
223  unformat_function_t **unformat_acl_next_index_fns;
224  unformat_function_t **unformat_policer_next_index_fns;
225  unformat_function_t **unformat_opaque_index_fns;
226 
227  /* Per-interface filter table. [0] is used for pcap */
228  u32 *classify_table_index_by_sw_if_index;
229 
230  /* convenience variables */
233 };
234 
236 
237 u8 *format_classify_table (u8 * s, va_list * args);
238 u8 *format_vnet_classify_table (u8 *s, va_list *args);
239 
241 
244 {
246 
247  return (pool_elt_at_index (vcm->tables, table_index));
248 }
249 
250 static inline u64
252 {
253  u64 xor_sum;
254  ASSERT (t);
255  h += t->skip_n_vectors * 16;
256 
257 #if defined(CLIB_HAVE_VEC128)
258  u64x2 *mask = (u64x2 *) t->mask;
259  u64x2u *data = (u64x2u *) h;
260  u64x2 xor_sum_x2;
261 
262  xor_sum_x2 = data[0] & mask[0];
263 
264  switch (t->match_n_vectors)
265  {
266  case 5:
267  xor_sum_x2 ^= data[4] & mask[4];
268  /* FALLTHROUGH */
269  case 4:
270  xor_sum_x2 ^= data[3] & mask[3];
271  /* FALLTHROUGH */
272  case 3:
273  xor_sum_x2 ^= data[2] & mask[2];
274  /* FALLTHROUGH */
275  case 2:
276  xor_sum_x2 ^= data[1] & mask[1];
277  /* FALLTHROUGH */
278  case 1:
279  break;
280  default:
281  abort ();
282  }
283  xor_sum = xor_sum_x2[0] ^ xor_sum_x2[1];
284 #else
285  u64 *data = (u64 *) h;
286  u64 *mask = (u64 *) t->mask;
287 
288  xor_sum = (data[0] & mask[0]) ^ (data[1] & mask[1]);
289 
290  switch (t->match_n_vectors)
291  {
292  case 5:
293  xor_sum ^= (data[8] & mask[8]) ^ (data[9] & mask[9]);
294  /* FALLTHROUGH */
295  case 4:
296  xor_sum ^= (data[6] & mask[6]) ^ (data[7] & mask[7]);
297  /* FALLTHROUGH */
298  case 3:
299  xor_sum ^= (data[4] & mask[4]) ^ (data[5] & mask[5]);
300  /* FALLTHROUGH */
301  case 2:
302  xor_sum ^= (data[2] & mask[2]) ^ (data[3] & mask[3]);
303  /* FALLTHROUGH */
304  case 1:
305  break;
306 
307  default:
308  abort ();
309  }
310 #endif /* CLIB_HAVE_VEC128 */
311 
312 #ifdef clib_crc32c_uses_intrinsics
313  return clib_crc32c ((u8 *) & xor_sum, sizeof (xor_sum));
314 #else
315  return clib_xxhash (xor_sum.as_u64[0] ^ xor_sum.as_u64[1]);
316 #endif
317 }
318 
319 static inline void
321 {
322  u32 bucket_index;
323 
324  ASSERT (is_pow2 (t->nbuckets));
325 
326  bucket_index = hash & (t->nbuckets - 1);
327 
328  clib_prefetch_load (&t->buckets[bucket_index]);
329 }
330 
331 static inline vnet_classify_entry_t *
333 {
334  u8 *hp = clib_mem_get_heap_base (t->mheap);
335  u8 *vp = hp + offset;
336 
337  return (vnet_classify_entry_t *) vp;
338 }
339 
340 static inline uword
343 {
344  u8 *hp, *vp;
345 
346  hp = (u8 *) clib_mem_get_heap_base (t->mheap);
347  vp = (u8 *) v;
348 
349  ASSERT ((vp - hp) < 0x100000000ULL);
350  return vp - hp;
351 }
352 
353 static inline vnet_classify_entry_t *
356 {
357  u8 *eu8;
358 
359  eu8 = (u8 *) e;
360 
361  eu8 += index * (sizeof (vnet_classify_entry_t) +
362  (t->match_n_vectors * sizeof (u32x4)));
363 
364  return (vnet_classify_entry_t *) eu8;
365 }
366 
367 static inline void
369 {
370  u32 bucket_index;
371  u32 value_index;
374 
375  bucket_index = hash & (t->nbuckets - 1);
376 
377  b = &t->buckets[bucket_index];
378 
379  if (b->offset == 0)
380  return;
381 
382  hash >>= t->log2_nbuckets;
383 
384  e = vnet_classify_get_entry (t, b->offset);
385  value_index = hash & ((1 << b->log2_pages) - 1);
386 
387  e = vnet_classify_entry_at_index (t, e, value_index);
388 
389  clib_prefetch_load (e);
390 }
391 
393  u8 * h, u64 hash, f64 now);
394 
397  u32 match_n_vectors)
398 {
399 #ifdef CLIB_HAVE_VEC128
400  u64x2u *data = (u64x2 *) d;
401  u64x2 *key = (u64x2 *) v->key;
402  u64x2 *mask = (u64x2 *) m;
403  u64x2 r;
404 
405  r = (data[0] & mask[0]) ^ key[0];
406  switch (match_n_vectors)
407  {
408  case 5:
409  r |= (data[4] & mask[4]) ^ key[4];
410  /* fall through */
411  case 4:
412  r |= (data[3] & mask[3]) ^ key[3];
413  /* fall through */
414  case 3:
415  r |= (data[2] & mask[2]) ^ key[2];
416  /* fall through */
417  case 2:
418  r |= (data[1] & mask[1]) ^ key[1];
419  /* fall through */
420  case 1:
421  break;
422  default:
423  abort ();
424  }
425 
426  if (u64x2_is_all_zero (r))
427  return 1;
428 
429 #else
430  u64 *data = (u64 *) d;
431  u64 *key = (u64 *) v->key;
432  u64 *mask = (u64 *) m;
433  u64 r;
434 
435  r = ((data[0] & mask[0]) ^ key[0]) | ((data[1] & mask[1]) ^ key[1]);
436  switch (match_n_vectors)
437  {
438  case 5:
439  r |= ((data[8] & mask[8]) ^ key[8]) | ((data[9] & mask[9]) ^ key[9]);
440  /* fall through */
441  case 4:
442  r |= ((data[6] & mask[6]) ^ key[6]) | ((data[7] & mask[7]) ^ key[7]);
443  /* fall through */
444  case 3:
445  r |= ((data[4] & mask[4]) ^ key[4]) | ((data[5] & mask[5]) ^ key[5]);
446  /* fall through */
447  case 2:
448  r |= ((data[2] & mask[2]) ^ key[2]) | ((data[3] & mask[3]) ^ key[3]);
449  /* fall through */
450  case 1:
451  break;
452  default:
453  abort ();
454  }
455 
456  if (r == 0)
457  return 1;
458 
459 #endif /* CLIB_HAVE_VEC128 */
460  return 0;
461 }
462 
463 static inline vnet_classify_entry_t *
465  u64 hash, f64 now)
466 {
469  u32 bucket_index, limit, pages, match_n_vectors = t->match_n_vectors;
470  u8 *mask = (u8 *) t->mask;
471  int i;
472 
473  bucket_index = hash & (t->nbuckets - 1);
474  b = &t->buckets[bucket_index];
475 
476  if (b->offset == 0)
477  return 0;
478 
479  pages = 1 << b->log2_pages;
480  v = vnet_classify_get_entry (t, b->offset);
481  limit = t->entries_per_page;
482  if (PREDICT_FALSE (b->linear_search))
483  {
484  limit *= pages;
485  v = vnet_classify_entry_at_index (t, v, 0);
486  }
487  else
488  {
489  hash >>= t->log2_nbuckets;
490  v = vnet_classify_entry_at_index (t, v, hash & (pages - 1));
491  }
492 
493  h += t->skip_n_vectors * 16;
494 
495  for (i = 0; i < limit; i++)
496  {
497  if (vnet_classify_entry_is_equal (v, h, mask, match_n_vectors))
498  {
499  if (PREDICT_TRUE (now))
500  {
501  v->hits++;
502  v->last_heard = now;
503  }
504  return (v);
505  }
506  v = vnet_classify_entry_at_index (t, v, 1);
507  }
508  return 0;
509 }
510 
512  const u8 *mask, u32 nbuckets,
514  u32 skip_n_vectors,
515  u32 match_n_vectors);
516 
518  const u8 *match, u32 hit_next_index,
519  u32 opaque_index, i32 advance, u8 action,
520  u16 metadata, int is_add);
521 
523  u32 nbuckets, u32 memory_size, u32 skip,
524  u32 match, u32 next_table_index,
525  u32 miss_next_index, u32 *table_index,
526  u8 current_data_flag, i16 current_data_offset,
527  int is_add, int del_chain);
529  u32 table_index, int del_chain);
530 
545 
547  (unformat_function_t * fn);
548 
550  (unformat_function_t * fn);
551 
553  (unformat_function_t * fn);
554 
556  (unformat_function_t * fn);
557 
559  fn);
560 
563  u32 sw_if_index, u32 table_index);
564 
567 
569 u32 classify_lookup_chain (u32 table_index,
570  u8 * mask, u32 n_skip, u32 n_match);
571 
572 #endif /* __included_vnet_classify_h__ */
573 
574 /*
575  * fd.io coding-style-patch-verification: ON
576  *
577  * Local Variables:
578  * eval: (c-set-style "gnu")
579  * End:
580  */
CLASSIFY_FLAG_USE_CURR_DATA
@ CLASSIFY_FLAG_USE_CURR_DATA
Definition: vnet_classify.h:40
vnet_classify_bucket_t::as_u64
u64 as_u64
Definition: vnet_classify.h:143
vnet_classify_hash_packet_inline
static u64 vnet_classify_hash_packet_inline(vnet_classify_table_t *t, const u8 *h)
Definition: vnet_classify.h:251
unformat_l3_match
unformat_function_t unformat_l3_match
Definition: vnet_classify.h:540
unformat_l3_mask
unformat_function_t unformat_l3_mask
Definition: vnet_classify.h:533
vnet_classify_entry_t
struct _vnet_classify_entry vnet_classify_entry_t
unformat_l2_next_index
unformat_function_t unformat_l2_next_index
Definition: vnet_classify.h:536
vnet_classify_table_t::saved_bucket
vnet_classify_bucket_t saved_bucket
Definition: vnet_classify.h:188
ip4_classify_node
vlib_node_registration_t ip4_classify_node
(constructor) VLIB_REGISTER_NODE (ip4_classify_node)
Definition: ip_classify.c:313
ip6_classify_node
vlib_node_registration_t ip6_classify_node
(constructor) VLIB_REGISTER_NODE (ip6_classify_node)
Definition: ip_classify.c:334
vnet_classify_table_get
static_always_inline vnet_classify_table_t * vnet_classify_table_get(u32 table_index)
Definition: vnet_classify.h:243
vnet_classify_entry_is_free
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
Definition: vnet_classify.h:111
vnet_classify_table_t::miss_next_index
u32 miss_next_index
Definition: vnet_classify.h:173
clib_mem_get_heap_base
void * clib_mem_get_heap_base(clib_mem_heap_t *heap)
Definition: mem_dlmalloc.c:586
vnet_classify_table_t::current_data_offset
i16 current_data_offset
Definition: vnet_classify.h:170
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
vnet_classify_add_del_session
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)
Definition: vnet_classify.c:2746
classify_set_pcap_chain
void classify_set_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index, u32 table_index)
Definition: vnet_classify.c:1760
vnet_classify_main
vnet_classify_main_t vnet_classify_main
Definition: vnet_classify.c:32
unformat_ip_next_index
unformat_function_t unformat_ip_next_index
Definition: vnet_classify.h:537
vnet_classify_delete_table_index
void vnet_classify_delete_table_index(vnet_classify_main_t *cm, u32 table_index, int del_chain)
Definition: vnet_classify.c:164
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
unformat_ip4_match
unformat_function_t unformat_ip4_match
Definition: vnet_classify.h:538
classify_sort_table_chain
u32 classify_sort_table_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1679
classify_get_trace_chain
u32 classify_get_trace_chain(void)
Definition: pnat_test_stubs.h:30
vnet_classify_find_entry
vnet_classify_entry_t * vnet_classify_find_entry(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
Definition: vnet_classify.c:656
unformat_l4_match
unformat_function_t unformat_l4_match
Definition: vnet_classify.h:541
vnet_classify_action_t_
vnet_classify_action_t_
Definition: vnet_classify.h:52
vnet_classify_entry_at_index
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
Definition: vnet_classify.h:354
u16
unsigned short u16
Definition: types.h:57
vnet_classify_get_entry
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
Definition: vnet_classify.h:332
unformat_l2_match
unformat_function_t unformat_l2_match
Definition: vnet_classify.h:543
u64x2
epu8_epi32 epu16_epi32 u64x2
Definition: vector_sse42.h:444
vnet_classify_table_t::entries_per_page
u32 entries_per_page
Definition: vnet_classify.h:162
vnet_classify_bucket_t::offset
u32 offset
Definition: vnet_classify.h:138
vnet_classify_entry_is_equal
static_always_inline int vnet_classify_entry_is_equal(vnet_classify_entry_t *v, const u8 *d, u8 *m, u32 match_n_vectors)
Definition: vnet_classify.h:396
vnet_classify_register_unformat_l2_next_index_fn
void vnet_classify_register_unformat_l2_next_index_fn(unformat_function_t *fn)
Definition: vnet_classify.c:90
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
memory_size
u64 memory_size
Definition: vhost_user.h:124
h
h
Definition: flowhash_template.h:372
key
typedef key
Definition: ipsec_types.api:91
i32
signed int i32
Definition: types.h:77
unformat_classify_match
unformat_function_t unformat_classify_match
Definition: vnet_classify.h:544
unformat_l2_mask
unformat_function_t unformat_l2_mask
Definition: vnet_classify.h:534
vnet_classify_table_t::mask
u32x4 mask[8]
Definition: vnet_classify.h:198
i16
signed short i16
Definition: types.h:46
CLASSIFY_ACTION_NONE
@ CLASSIFY_ACTION_NONE
Definition: vnet_classify.h:54
unformat_ip6_mask
unformat_function_t unformat_ip6_mask
Definition: vnet_classify.h:532
hash.h
vnet_classify_register_unformat_acl_next_index_fn
void vnet_classify_register_unformat_acl_next_index_fn(unformat_function_t *fn)
Definition: vnet_classify.c:106
vnet_classify_table_t::skip_n_vectors
u32 skip_n_vectors
Definition: vnet_classify.h:163
error.h
unformat_ip4_mask
unformat_function_t unformat_ip4_mask
Definition: vnet_classify.h:531
vnet_classify_entry_is_busy
static int vnet_classify_entry_is_busy(vnet_classify_entry_t *e)
Definition: vnet_classify.h:117
vnet_classify_table_t::working_copy_lengths
int * working_copy_lengths
Definition: vnet_classify.h:187
offset
struct clib_bihash_value offset
template key/value backing page structure
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
vnet_classify_action_t
enum vnet_classify_action_t_ vnet_classify_action_t
STATIC_ASSERT_OFFSET_OF
STATIC_ASSERT_OFFSET_OF(vnet_classify_entry_t, key, 32)
Check there's no padding in the entry.
static_always_inline
#define static_always_inline
Definition: clib.h:112
clib_spinlock_s
Definition: lock.h:51
vnet_classify_table_t::freelists
vnet_classify_entry_t ** freelists
Definition: vnet_classify.h:191
vnet_classify_prefetch_entry
static void vnet_classify_prefetch_entry(vnet_classify_table_t *t, u64 hash)
Definition: vnet_classify.h:368
vnet_classify_flags_t
enum vnet_classify_flags_t_ vnet_classify_flags_t
uword
u64 uword
Definition: types.h:112
crc32.h
vnet_classify_prefetch_bucket
static void vnet_classify_prefetch_bucket(vnet_classify_table_t *t, u64 hash)
Definition: vnet_classify.h:320
vnet_classify_register_unformat_ip_next_index_fn
void vnet_classify_register_unformat_ip_next_index_fn(unformat_function_t *fn)
Definition: vnet_classify.c:98
vnet_classify_table_t::buckets
vnet_classify_bucket_t * buckets
Definition: vnet_classify.h:151
VNET_CLASSIFY_ENTRY_FREE
#define VNET_CLASSIFY_ENTRY_FREE
Definition: vnet_classify.h:94
vnet_classify_flags_t_
vnet_classify_flags_t_
Definition: vnet_classify.h:37
f64
double f64
Definition: types.h:142
mask
vl_api_pnat_mask_t mask
Definition: pnat.api:45
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:594
vnet_classify_table_t::working_copies
vnet_classify_entry_t ** working_copies
Definition: vnet_classify.h:186
clib_xxhash
static u64 clib_xxhash(u64 key)
Definition: xxhash.h:58
vnet_classify_table_t
Definition: vnet_classify.h:147
CLASSIFY_ACTION_SET_METADATA
@ CLASSIFY_ACTION_SET_METADATA
Definition: vnet_classify.h:57
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
vnet_classify_table_t::user_ctx
uword user_ctx
Definition: vnet_classify.h:158
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vnet_classify_table_t::nbuckets
u32 nbuckets
Definition: vnet_classify.h:160
CLASSIFY_ACTION_SET_IP6_FIB_INDEX
@ CLASSIFY_ACTION_SET_IP6_FIB_INDEX
Definition: vnet_classify.h:56
data
u8 data[128]
Definition: ipsec_types.api:95
CLASSIFY_FLAG_NONE
@ CLASSIFY_FLAG_NONE
Definition: vnet_classify.h:39
vnet_classify_table_t::next_table_index
u32 next_table_index
Definition: vnet_classify.h:167
xxhash.h
vnet_main_t
Definition: vnet.h:76
unformat_classify_mask
unformat_function_t unformat_classify_mask
Definition: vnet_classify.h:535
index
u32 index
Definition: flow_types.api:221
classify_lookup_chain
u32 classify_lookup_chain(u32 table_index, u8 *mask, u32 n_skip, u32 n_match)
Definition: vnet_classify.c:1799
vnet_classify_register_unformat_opaque_index_fn
void vnet_classify_register_unformat_opaque_index_fn(unformat_function_t *fn)
Definition: vnet_classify.c:123
clib_bihash_value
template key/value backing page structure
Definition: bihash_doc.h:44
u64
unsigned long u64
Definition: types.h:89
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
cache.h
vnet_classify_table_t::match_n_vectors
u32 match_n_vectors
Definition: vnet_classify.h:164
u32
unsigned int u32
Definition: types.h:88
vnet_classify_new_table
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)
Definition: vnet_classify.c:131
format_vnet_classify_table
u8 * format_vnet_classify_table(u8 *s, va_list *args)
Definition: vnet_classify.c:2206
clib_prefetch_load
static_always_inline void clib_prefetch_load(void *p)
Definition: cache.h:92
u32x4
unsigned long long u32x4
Definition: ixge.c:28
vnet_classify_main_t
struct _vnet_classify_main vnet_classify_main_t
Definition: vnet_classify.h:61
unformat_function_t
uword() unformat_function_t(unformat_input_t *input, va_list *args)
Definition: format.h:225
vnet_classify_find_entry_inline
static vnet_classify_entry_t * vnet_classify_find_entry_inline(vnet_classify_table_t *t, const u8 *h, u64 hash, f64 now)
Definition: vnet_classify.h:464
CLASSIFY_ACTION_SET_IP4_FIB_INDEX
@ CLASSIFY_ACTION_SET_IP4_FIB_INDEX
Definition: vnet_classify.h:55
unformat_vlan_tag
unformat_function_t unformat_vlan_tag
Definition: vnet_classify.h:542
vnet_classify_bucket_t::linear_search
u8 linear_search
Definition: vnet_classify.h:139
vnet_classify_table_t::mheap
void * mheap
Definition: vnet_classify.h:155
vnet_classify_hash_packet
u64 vnet_classify_hash_packet(vnet_classify_table_t *t, u8 *h)
vnet_classify_get_offset
static uword vnet_classify_get_offset(vnet_classify_table_t *t, vnet_classify_entry_t *v)
Definition: vnet_classify.h:341
now
f64 now
Definition: nat44_ei_out2in.c:710
vnet_main
vnet_main_t vnet_main
Definition: misc.c:43
vnet_classify_bucket_t::log2_pages
u8 log2_pages
Definition: vnet_classify.h:141
vlib_main_t
Definition: main.h:102
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
vnet_classify_table_t::writer_lock
clib_spinlock_t writer_lock
Definition: vnet_classify.h:194
i
int i
Definition: flowhash_template.h:376
vnet_classify_add_del_table
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)
Definition: vnet_classify.c:746
pad
u8 pad[3]
log2 (size of the packing page block)
Definition: bihash_doc.h:61
vnet_classify_register_unformat_policer_next_index_fn
void vnet_classify_register_unformat_policer_next_index_fn(unformat_function_t *fn)
Definition: vnet_classify.c:114
vlib_main
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
Definition: main.c:1914
vnet_classify_table_t::current_data_flag
vnet_classify_flags_t current_data_flag
Definition: vnet_classify.h:171
vnet.h
api_errno.h
vnet_classify_table_t::log2_nbuckets
u32 log2_nbuckets
Definition: vnet_classify.h:161
foreach_size_in_u32x4
#define foreach_size_in_u32x4
Definition: vnet_classify.h:63
PREDICT_TRUE
#define PREDICT_TRUE(x)
Definition: clib.h:125
is_pow2
static uword is_pow2(uword x)
Definition: clib.h:267
action
vl_api_mac_event_action_t action
Definition: l2.api:211
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
unformat_ip6_match
unformat_function_t unformat_ip6_match
Definition: vnet_classify.h:539
vnet_classify_bucket_t
Definition: vnet_classify.h:132
format_classify_table
u8 * format_classify_table(u8 *s, va_list *args)
Definition: vnet_classify.c:686
vnet_classify_table_t::data_offset
u32 data_offset
Definition: vnet_classify.h:183
vnet_classify_table_t::linear_buckets
u32 linear_buckets
Definition: vnet_classify.h:181
classify_get_pcap_chain
u32 classify_get_pcap_chain(vnet_classify_main_t *cm, u32 sw_if_index)
Definition: vnet_classify.c:1748
vnet_classify_table_t::active_elements
u32 active_elements
Definition: vnet_classify.h:182
classify_set_trace_chain
void classify_set_trace_chain(vnet_classify_main_t *cm, u32 table_index)
Definition: vnet_classify.c:1733
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105