summaryrefslogtreecommitdiffstats
path: root/plugins/ioam-plugin/ioam
diff options
context:
space:
mode:
authorShwetha Bhandari <shwethab@cisco.com>2016-12-17 11:56:29 +0530
committerShwetha Bhandari <shwethab@cisco.com>2016-12-17 13:01:12 +0530
commitc294c4c92e3e58bccc6926a5e9f96d302018238e (patch)
tree5a1a6ba2488c8b86796dc2e25dc662199809c209 /plugins/ioam-plugin/ioam
parentbd6462e16a55a63561bfaaf75018aa378f201343 (diff)
VPP-563: Fix inter plugin dependency in ioam vxlan-gpe
Change-Id: I31684b3844cd02ba0d0b046d621db59ecac3992d Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
Diffstat (limited to 'plugins/ioam-plugin/ioam')
-rw-r--r--plugins/ioam-plugin/ioam/export-common/ioam_export.h1
-rw-r--r--plugins/ioam-plugin/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c54
-rw-r--r--plugins/ioam-plugin/ioam/export/ioam_export.c1
3 files changed, 24 insertions, 32 deletions
diff --git a/plugins/ioam-plugin/ioam/export-common/ioam_export.h b/plugins/ioam-plugin/ioam/export-common/ioam_export.h
index 82559c9f993..a9ec8d00677 100644
--- a/plugins/ioam-plugin/ioam/export-common/ioam_export.h
+++ b/plugins/ioam-plugin/ioam/export-common/ioam_export.h
@@ -67,7 +67,6 @@ typedef struct
/* convenience */
vlib_main_t *vlib_main;
vnet_main_t *vnet_main;
- ethernet_main_t *ethernet_main;
u32 ip4_lookup_node_index;
uword my_hbh_slot;
diff --git a/plugins/ioam-plugin/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c b/plugins/ioam-plugin/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c
index 6c46ee4d11a..bab8d977062 100644
--- a/plugins/ioam-plugin/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c
+++ b/plugins/ioam-plugin/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c
@@ -83,27 +83,6 @@ do { \
#define foreach_vxlan_gpe_ioam_export_plugin_api_msg \
_(VXLAN_GPE_IOAM_EXPORT_ENABLE_DISABLE, vxlan_gpe_ioam_export_enable_disable)
-/*
- * This routine exists to convince the vlib plugin framework that
- * we haven't accidentally copied a random .dll into the plugin directory.
- *
- * Also collects global variable pointers passed from the vpp engine
- */
-
-clib_error_t *
-vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
- int from_early_init)
-{
- ioam_export_main_t *em = &vxlan_gpe_ioam_export_main;
- clib_error_t *error = 0;
-
- em->vlib_main = vm;
- em->vnet_main = h->vnet_main;
- em->ethernet_main = h->ethernet_main;
-
- return error;
-}
-
extern void vxlan_gpe_set_next_override (uword next);
/* Action function shared between message handler and debug CLI */
int
@@ -113,9 +92,25 @@ vxlan_gpe_ioam_export_enable_disable (ioam_export_main_t * em,
ip4_address_t * src_address)
{
vlib_main_t *vm = em->vlib_main;
+ u32 node_index = export_node.index;
+ vlib_node_t *vxlan_gpe_decap_ioam_node = NULL;
if (is_disable == 0)
{
+ if (em->my_hbh_slot == ~0)
+ {
+ /* Hook this export node to vxlan-gpe-decap-ioam-v4 */
+ vxlan_gpe_decap_ioam_node =
+ vlib_get_node_by_name (vm, (u8 *) "vxlan-gpe-decap-ioam-v4");
+ if (!vxlan_gpe_decap_ioam_node)
+ {
+ /* node does not exist give up */
+ return (-1);
+ }
+ em->my_hbh_slot =
+ vlib_node_add_next (vm, vxlan_gpe_decap_ioam_node->index,
+ node_index);
+ }
if (1 == ioam_export_header_create (em, collector_address, src_address))
{
ioam_export_thread_buffer_init (em, vm);
@@ -221,7 +216,11 @@ set_vxlan_gpe_ioam_export_ipfix_command_fn (vlib_main_t * vm,
/* Turn on the export timer process */
// vlib_process_signal_event (vm, flow_report_process_node.index,
//1, 0);
- vxlan_gpe_ioam_export_enable_disable (em, is_disable, &collector, &src);
+ if (0 !=
+ vxlan_gpe_ioam_export_enable_disable (em, is_disable, &collector, &src))
+ {
+ return clib_error_return (0, "Unable to set ioam vxlan-gpe export");
+ }
return 0;
}
@@ -242,8 +241,6 @@ vxlan_gpe_ioam_export_init (vlib_main_t * vm)
ioam_export_main_t *em = &vxlan_gpe_ioam_export_main;
clib_error_t *error = 0;
u8 *name;
- u32 node_index = export_node.index;
- vlib_node_t *vxlan_gpe_decap_ioam_node = NULL;
name = format (0, "vxlan_gpe_ioam_export_%08x%c", api_version, 0);
@@ -254,12 +251,9 @@ vxlan_gpe_ioam_export_init (vlib_main_t * vm)
em->vlib_time_0 = vlib_time_now (vm);
error = vxlan_gpe_ioam_export_plugin_api_hookup (vm);
-
- /* Hook this export node to vxlan-gpe-decap-ioam-v4 */
- vxlan_gpe_decap_ioam_node =
- vlib_get_node_by_name (vm, (u8 *) "vxlan-gpe-decap-ioam-v4");
- em->my_hbh_slot =
- vlib_node_add_next (vm, vxlan_gpe_decap_ioam_node->index, node_index);
+ em->my_hbh_slot = ~0;
+ em->vlib_main = vm;
+ em->vnet_main = vnet_get_main ();
vec_free (name);
return error;
diff --git a/plugins/ioam-plugin/ioam/export/ioam_export.c b/plugins/ioam-plugin/ioam/export/ioam_export.c
index 96de8bff0a6..b122e445b28 100644
--- a/plugins/ioam-plugin/ioam/export/ioam_export.c
+++ b/plugins/ioam-plugin/ioam/export/ioam_export.c
@@ -97,7 +97,6 @@ vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
em->vlib_main = vm;
em->vnet_main = h->vnet_main;
- em->ethernet_main = h->ethernet_main;
return error;
}