summaryrefslogtreecommitdiffstats
path: root/src/vnet/feature/feature.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/feature/feature.c')
-rw-r--r--src/vnet/feature/feature.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/vnet/feature/feature.c b/src/vnet/feature/feature.c
index 6525bcbdce5..2cdbcff88c8 100644
--- a/src/vnet/feature/feature.c
+++ b/src/vnet/feature/feature.c
@@ -24,6 +24,7 @@ vnet_feature_init (vlib_main_t * vm)
vnet_feature_main_t *fm = &feature_main;
vnet_feature_registration_t *freg;
vnet_feature_arc_registration_t *areg;
+ vnet_feature_constraint_registration_t *creg;
u32 arc_index = 0;
fm->arc_index_by_name = hash_create_string (0, sizeof (uword));
@@ -58,6 +59,7 @@ vnet_feature_init (vlib_main_t * vm)
vec_validate (fm->next_feature_by_name, arc_index - 1);
vec_validate (fm->sw_if_index_has_features, arc_index - 1);
vec_validate (fm->feature_count_by_sw_if_index, arc_index - 1);
+ vec_validate (fm->next_constraint_by_arc, arc_index - 1);
freg = fm->next_feature;
while (freg)
@@ -82,6 +84,31 @@ vnet_feature_init (vlib_main_t * vm)
freg = next;
}
+ /* Move bulk constraints to the constraint by arc lists */
+ creg = fm->next_constraint;
+ while (creg)
+ {
+ vnet_feature_constraint_registration_t *next;
+ uword *p = hash_get_mem (fm->arc_index_by_name, creg->arc_name);
+ if (p == 0)
+ {
+ /* Don't start vpp with broken features arcs */
+ clib_warning ("Unknown feature arc '%s'", creg->arc_name);
+ os_exit (1);
+ }
+
+ areg = uword_to_pointer (p[0], vnet_feature_arc_registration_t *);
+ arc_index = areg->feature_arc_index;
+
+ next = creg->next;
+ creg->next_in_arc = fm->next_constraint_by_arc[arc_index];
+ fm->next_constraint_by_arc[arc_index] = creg;
+
+ /* next */
+ creg = next;
+ }
+
+
areg = fm->next_arc;
while (areg)
{
@@ -92,11 +119,11 @@ vnet_feature_init (vlib_main_t * vm)
arc_index = areg->feature_arc_index;
cm = &fm->feature_config_mains[arc_index];
vcm = &cm->config_main;
- if ((error = vnet_feature_arc_init (vm, vcm,
- areg->start_nodes,
- areg->n_start_nodes,
- fm->next_feature_by_arc[arc_index],
- &fm->feature_nodes[arc_index])))
+ if ((error = vnet_feature_arc_init
+ (vm, vcm, areg->start_nodes, areg->n_start_nodes,
+ fm->next_feature_by_arc[arc_index],
+ fm->next_constraint_by_arc[arc_index],
+ &fm->feature_nodes[arc_index])))
{
clib_error_report (error);
os_exit (1);