47 result =
vec_dup (feature_vector);
72 if (last_node_index != ~0)
93 u32 last_node_index = ~0;
102 _vec_len (config_string) = 0;
118 if (last_node_index == ~0 || last_node_index != cm->
end_node_index)
121 vec_add1 (config_string, next_index);
163 char * start_node_names[],
164 int n_start_node_names,
165 char * feature_node_names[],
166 int n_feature_node_names)
171 memset (cm, 0,
sizeof (cm[0]));
175 ASSERT (n_start_node_names >= 1);
176 ASSERT (n_feature_node_names >= 1);
179 for (i = 0; i < n_start_node_names; i++)
188 for (i = 0; i < n_feature_node_names; i++)
190 if (! feature_node_names[i])
198 if (i + 1 == n_feature_node_names)
235 u32 config_string_heap_index,
237 void * feature_config,
238 u32 n_feature_config_bytes)
242 u32 n_feature_config_u32s;
245 if (node_index == ~0)
246 return config_string_heap_index;
248 if (config_string_heap_index == ~0)
270 if (
vec_len (new_features) > 1)
277 new->reference_count += 1;
281 return new->config_string_heap_index + 1;
286 u32 config_string_heap_index,
288 void * feature_config,
289 u32 n_feature_config_bytes)
293 u32 n_feature_config_u32s;
308 && (n_feature_config_u32s == 0
309 || ! memcmp (f->
feature_config, feature_config, n_feature_config_bytes)))
315 return config_string_heap_index;
318 f = new_features + (f - old->
features);
320 vec_delete (new_features, 1, f - new_features);
328 new->reference_count += 1;
330 return new->config_string_heap_index + 1;
always_inline uword round_pow2(uword x, uword pow2)
sll srl srl sll sra u16x4 i
vnet_config_feature_t * features
void vnet_config_init(vlib_main_t *vm, vnet_config_main_t *cm, char *start_node_names[], int n_start_node_names, char *feature_node_names[], int n_feature_node_names)
#define hash_unset(h, key)
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
static void remove_reference(vnet_config_main_t *cm, vnet_config_t *c)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define heap_elt_at_index(v, index)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define hash_set_mem(h, key, value)
u32 config_string_heap_handle
u32 * config_string_vector
#define vec_bytes(v)
Number of data bytes in vector.
u32 * node_index_by_feature_index
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
static int feature_cmp(void *a1, void *a2)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
always_inline void vnet_config_free(vnet_config_main_t *cm, vnet_config_t *c)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define vec_end(v)
End (last data address) of vector.
#define pool_elt_at_index(p, i)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
always_inline u32 * vnet_get_config_heap(vnet_config_main_t *cm, u32 ci)
static void free_feature_vector(vnet_config_feature_t *feature_vector)
static vnet_config_t * find_config_with_features(vlib_main_t *vm, vnet_config_main_t *cm, vnet_config_feature_t *feature_vector)
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
static vnet_config_feature_t * duplicate_feature_vector(vnet_config_feature_t *feature_vector)
always_inline void vnet_config_feature_free(vnet_config_feature_t *f)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
#define heap_alloc(v, size, handle)
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static u32 add_next(vlib_main_t *vm, vnet_config_main_t *cm, u32 last_node_index, u32 this_node_index)
#define vec_elt(v, i)
Get vector value at index i.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define hash_create_vec(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define hash_get_mem(h, key)
#define STRUCT_SIZE_OF(t, f)
vnet_config_t * config_pool
#define vec_foreach(var, vec)
Vector iterator.
uword * config_string_hash
u32 config_string_heap_index