|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
61 sp->
seed = 0xdeaddabe;
77 int level, comp_result;
95 _vec_len (sp->
path) = level + 1;
99 u32 next_index_this_level;
106 prefetch_elt = sp->
elts +
112 comp_result = (search_elt == head_elt) ? 1 :
137 if (comp_result == 0)
144 if (need_full_path && level > 0)
151 sp->
path[level] = search_elt - sp->
elts;
152 _vec_len (sp->
path) = level + 1;
159 sp->
path[level] = search_elt - sp->
elts;
162 next_index_this_level =
164 if (next_index_this_level == (
u32) ~ 0)
185 return elt->user_pool_index;
205 elt->user_pool_index = user_pool_index;
214 for (level = 0; level <
vec_len (sp->
path); level++)
217 u32 prev_elt_next_index_this_level;
222 (prev_elt_this_level, level);
259 return search_result;
264 for (level = 0; level <
vec_len (sp->
path) - 1; level++)
267 u32 path_elt_next_index;
273 if (path_elt_next_index == del_elt - sp->
elts)
282 if (!(del_elt->
n.
next0[0] & 1))
292 int verbose = va_arg (*args,
int);
296 s =
format (s,
"slist 0x%x, %u items, branching_factor %.2f\n", sl,
306 s =
format (s,
"level %d: %d elts\n",
i,
309 if (verbose && head_elt->
n.
nexts[
i] != (
u32) ~ 0)
nat44_ei_hairpin_src_next_t next_index
clib_slist_search_result_t clib_slist_del(clib_slist_t *sp, void *key)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define pool_put(P, E)
Free an object E in pool P.
static u32 clib_slist_get_next_at_level(clib_slist_elt_t *elt, int level)
clib_slist_key_compare_function_t * compare
clib_error_t * clib_slist_init(clib_slist_t *sp, f64 branching_factor, clib_slist_key_compare_function_t compare, format_function_t format_user_element)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
static clib_slist_search_result_t slist_search_internal(clib_slist_t *sp, void *key, int need_full_path)
#define CLIB_PREFETCH(addr, size, type)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
union clib_slist_elt_t::@827 n
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
static void clib_slist_set_next_at_level(clib_slist_elt_t *elt, u32 index, int level)
#define vec_free(V)
Free vector's memory (no header).
u8 * format_slist(u8 *s, va_list *args)
description fragment has unexpected format
static uword pool_elts(void *v)
Number of active elements in a pool.
format_function_t * format_user_element
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 clib_slist_search(clib_slist_t *sp, void *key, u32 *ncompares)
word() clib_slist_key_compare_function_t(void *key, u32 elt_pool_index)
clib_slist_search_result_t
void clib_slist_add(clib_slist_t *sp, void *key, u32 user_pool_index)