88 while (*s && *s !=
',')
120 char **feature_start_nodes,
121 int num_feature_start_nodes,
123 char ***in_feature_nodes)
125 uword *index_by_name;
129 char **these_constraints;
130 char *this_constraint_c;
131 u8 **constraints = 0;
132 u8 *constraint_tuple;
134 u8 **orig, **closure;
138 int a_index, b_index;
142 char **feature_nodes = 0;
144 u8 **keys_to_delete = 0;
149 this_reg = first_reg;
154 node_name =
format (0,
"%s%c", this_reg->node_name, 0);
161 these_constraints = this_reg->runs_before;
162 while (these_constraints && these_constraints[0])
164 this_constraint_c = these_constraints[0];
166 constraint_tuple =
format (0,
"%s,%s%c", node_name,
167 this_constraint_c, 0);
168 vec_add1 (constraints, constraint_tuple);
172 these_constraints = this_reg->runs_after;
173 while (these_constraints && these_constraints[0])
175 this_constraint_c = these_constraints[0];
177 constraint_tuple =
format (0,
"%s,%s%c",
178 this_constraint_c, node_name, 0);
179 vec_add1 (constraints, constraint_tuple);
183 this_reg = this_reg->next;
186 n_features =
vec_len (node_names);
189 for (i = 0; i <
vec_len (constraints); i++)
191 this_constraint = constraints[
i];
193 if (
comma_split (this_constraint, &a_name, &b_name))
213 orig[a_index][b_index] = 1;
222 for (i = 0; i < n_features; i++)
224 for (j = 0; j < n_features; j++)
227 goto item_constrained;
232 for (k = 0; k < n_features; k++)
246 if (vec_len (result) != n_features)
257 for (i = n_features - 1; i >= 0; i--)
259 p =
hash_get (reg_by_index, result[i]);
262 if (this_reg->feature_index_ptr)
263 *this_reg->feature_index_ptr = n_features - (i + 1);
264 this_reg->feature_index = n_features - (i + 1);
265 vec_add1 (feature_nodes, this_reg->node_name);
271 num_feature_start_nodes,
272 feature_nodes, vec_len (feature_nodes));
275 *in_feature_nodes = feature_nodes;
285 for (i = 0; i <
vec_len (keys_to_delete); i++)
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
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 vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define hash_set_mem(h, key, value)
clib_error_t * vnet_feature_arc_init(vlib_main_t *vm, vnet_config_main_t *vcm, char **feature_start_nodes, int num_feature_start_nodes, vnet_feature_registration_t *first_reg, char ***in_feature_nodes)
Initialize a feature graph arc.
#define clib_error_return(e, args...)
#define hash_create_string(elts, value_bytes)
u8 ** clib_ptclosure_alloc(int n)
void clib_ptclosure_free(u8 **ptc)
#define vec_free(V)
Free vector's memory (no header).
#define hash_create(elts, value_bytes)
static int comma_split(u8 *s, u8 **a, u8 **b)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
u8 ** clib_ptclosure(u8 **orig)
#define hash_get_mem(h, key)
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object