summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/feature/feature.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-11-09 19:54:20 +0100
committerDave Barach <openvpp@barachs.net>2016-11-11 14:39:00 +0000
commit8b3191e6d715760deefe550b59c7d92be4b5cda9 (patch)
tree721dd977986d12864346081fec6b245ea5a250e0 /vnet/vnet/feature/feature.c
parent0178d52384e0428368f1acf3163e664ecda7b64c (diff)
feature: convert all feature nodes to new feature infra
Change-Id: I34c527ba910fb282a95458b78d1d684eb337905e Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/feature/feature.c')
-rw-r--r--vnet/vnet/feature/feature.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/vnet/vnet/feature/feature.c b/vnet/vnet/feature/feature.c
index 25f098d33ad..1f46285aa21 100644
--- a/vnet/vnet/feature/feature.c
+++ b/vnet/vnet/feature/feature.c
@@ -34,6 +34,8 @@ vnet_feature_init (vlib_main_t * vm)
char *s;
int i = 0;
areg->feature_arc_index = arc_index;
+ if (areg->arc_index_ptr)
+ *areg->arc_index_ptr = arc_index;
hash_set_mem (fm->arc_index_by_name, areg->arc_name,
pointer_to_uword (areg));
@@ -111,8 +113,6 @@ vnet_feature_init (vlib_main_t * vm)
arc_index++;
}
- fm->device_input_feature_arc_index =
- vnet_get_feature_arc_index ("device-input");
return 0;
}
@@ -164,29 +164,27 @@ vnet_get_feature_index (u8 arc, const char *s)
return ~0;
reg = uword_to_pointer (p[0], vnet_feature_registration_t *);
- return reg->feature_index_u32;
+ return reg->feature_index;
}
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)
+vnet_feature_enable_disable_with_index (u8 arc_index, u32 feature_index,
+ u32 sw_if_index, int enable_disable,
+ void *feature_config,
+ u32 n_feature_config_bytes)
{
vnet_feature_main_t *fm = &feature_main;
vnet_feature_config_main_t *cm;
- u32 feature_index, ci;
- u8 arc_index;
-
- arc_index = vnet_get_feature_arc_index (arc_name);
+ u32 ci;
if (arc_index == (u8) ~ 0)
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 VNET_API_ERROR_INVALID_VALUE_2;
+
+ cm = &fm->feature_config_mains[arc_index];
+ vec_validate_init_empty (cm->config_index_by_sw_if_index, sw_if_index, ~0);
ci = cm->config_index_by_sw_if_index[sw_if_index];
ci = (enable_disable
@@ -202,6 +200,27 @@ vnet_feature_enable_disable (const char *arc_name, const char *node_name,
return 0;
}
+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)
+{
+ u32 feature_index;
+ u8 arc_index;
+
+ arc_index = vnet_get_feature_arc_index (arc_name);
+
+ if (arc_index == (u8) ~ 0)
+ return VNET_API_ERROR_INVALID_VALUE;
+
+ feature_index = vnet_get_feature_index (arc_index, node_name);
+
+ return vnet_feature_enable_disable_with_index (arc_index, feature_index,
+ sw_if_index, enable_disable,
+ feature_config,
+ n_feature_config_bytes);
+}
+
/** Display the set of available driver features.
Useful for verifying that expected features are present