aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/feature/feature.c25
-rw-r--r--vnet/vnet/feature/feature.h3
2 files changed, 18 insertions, 10 deletions
diff --git a/vnet/vnet/feature/feature.c b/vnet/vnet/feature/feature.c
index bfdea3db..25f098d3 100644
--- a/vnet/vnet/feature/feature.c
+++ b/vnet/vnet/feature/feature.c
@@ -59,6 +59,7 @@ vnet_feature_init (vlib_main_t * vm)
freg = fm->next_feature;
while (freg)
{
+ vnet_feature_registration_t *next;
uword *p = hash_get_mem (fm->arc_index_by_name, freg->arc_name);
if (p == 0)
return clib_error_return (0, "Unknown feature arc '%s'",
@@ -67,12 +68,15 @@ vnet_feature_init (vlib_main_t * vm)
areg = uword_to_pointer (p[0], vnet_feature_arc_registration_t *);
arc_index = areg->feature_arc_index;
- vec_add1 (fm->next_feature_by_arc[arc_index], *freg);
+ next = freg->next;
+ freg->next = fm->next_feature_by_arc[arc_index];
+ fm->next_feature_by_arc[arc_index] = freg;
/* next */
- freg = freg->next;
+ freg = next;
}
+ areg = fm->next_arc;
while (areg)
{
clib_error_t *error;
@@ -163,7 +167,7 @@ vnet_get_feature_index (u8 arc, const char *s)
return reg->feature_index_u32;
}
-void
+int
vnet_feature_enable_disable (const char *arc_name, const char *node_name,
u32 sw_if_index, int enable_disable,
void *feature_config, u32 n_feature_config_bytes)
@@ -176,13 +180,13 @@ vnet_feature_enable_disable (const char *arc_name, const char *node_name,
arc_index = vnet_get_feature_arc_index (arc_name);
if (arc_index == (u8) ~ 0)
- return;
+ return VNET_API_ERROR_INVALID_VALUE;
cm = &fm->feature_config_mains[arc_index];
vec_validate_init_empty (cm->config_index_by_sw_if_index, sw_if_index, ~0);
feature_index = vnet_get_feature_index (arc_index, node_name);
if (feature_index == ~0)
- return;
+ return VNET_API_ERROR_INVALID_VALUE_2;
ci = cm->config_index_by_sw_if_index[sw_if_index];
ci = (enable_disable
@@ -195,6 +199,7 @@ vnet_feature_enable_disable (const char *arc_name, const char *node_name,
vnet_config_update_feature_count (fm, arc_index, sw_if_index,
enable_disable);
+ return 0;
}
@@ -216,10 +221,12 @@ show_features_command_fn (vlib_main_t * vm,
while (areg)
{
vlib_cli_output (vm, "%s:", areg->arc_name);
- vec_foreach (freg, fm->next_feature_by_arc[areg->feature_arc_index])
- {
- vlib_cli_output (vm, " %s\n", freg->node_name);
- }
+ freg = fm->next_feature_by_arc[areg->feature_arc_index];
+ while (freg)
+ {
+ vlib_cli_output (vm, " %s\n", freg->node_name);
+ freg = freg->next;
+ }
/* next */
diff --git a/vnet/vnet/feature/feature.h b/vnet/vnet/feature/feature.h
index 765af356..793678b7 100644
--- a/vnet/vnet/feature/feature.h
+++ b/vnet/vnet/feature/feature.h
@@ -17,6 +17,7 @@
#define included_features_h
#include <vnet/vnet.h>
+#include <vnet/api_errno.h>
/** feature registration object */
typedef struct _vnet_feature_arc_registration
@@ -120,7 +121,7 @@ vnet_config_update_feature_count (vnet_feature_main_t * fm, u8 arc,
u32 vnet_get_feature_index (u8 arc, const char *s);
u8 vnet_get_feature_arc_index (const char *s);
-void
+int
vnet_feature_enable_disable (const char *arc_name, const char *node_name,
u32 sw_if_index, int enable_disable,
void *feature_config,