47 result =
vec_dup (feature_vector);
68 if (last_node_index != ~0)
90 u32 last_node_index = ~0;
99 _vec_len (config_string) = 0;
115 if (last_node_index == ~0 || last_node_index != cm->
end_node_index)
118 vec_add1 (config_string, next_index);
163 char *start_node_names[],
164 int n_start_node_names,
165 char *feature_node_names[],
int n_feature_node_names)
170 memset (cm, 0,
sizeof (cm[0]));
177 ASSERT (n_feature_node_names >= 1);
180 for (i = 0; i < n_start_node_names; i++)
189 for (i = 0; i < n_feature_node_names; i++)
191 if (!feature_node_names[i])
199 if (i + 1 == n_feature_node_names)
240 u32 config_string_heap_index,
242 void *feature_config,
u32 n_feature_config_bytes)
246 u32 n_feature_config_u32s;
249 if (node_index == ~0)
250 return config_string_heap_index;
252 if (config_string_heap_index == ~0)
270 n_feature_config_u32s =
277 if (
vec_len (new_features) > 1)
284 new->reference_count += 1;
292 new->config_string_heap_index + 1);
301 u32 config_string_heap_index,
303 void *feature_config,
u32 n_feature_config_bytes)
307 u32 n_feature_config_u32s;
315 n_feature_config_u32s =
325 && (n_feature_config_u32s == 0
327 n_feature_config_bytes)))
333 return config_string_heap_index;
336 f = new_features + (f - old->
features);
338 vec_delete (new_features, 1, f - new_features);
346 new->reference_count += 1;
349 new->config_string_heap_index + 1);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
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.
static void vnet_config_feature_free(vnet_config_feature_t *f)
#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)
Returns pointer to element at given index.
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
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)
u32 * config_pool_index_by_user_index
static void vnet_config_free(vnet_config_main_t *cm, vnet_config_t *c)
static u32 * vnet_get_config_heap(vnet_config_main_t *cm, u32 ci)
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
static uword round_pow2(uword x, uword pow2)
static vnet_config_feature_t * duplicate_feature_vector(vnet_config_feature_t *feature_vector)
#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)
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