summaryrefslogtreecommitdiffstats
path: root/plugins/ioam-plugin
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
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')
-rw-r--r--plugins/ioam-plugin/Makefile.am37
-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
4 files changed, 36 insertions, 57 deletions
diff --git a/plugins/ioam-plugin/Makefile.am b/plugins/ioam-plugin/Makefile.am
index 990f6da7a2d..ea3fe56f11d 100644
--- a/plugins/ioam-plugin/Makefile.am
+++ b/plugins/ioam-plugin/Makefile.am
@@ -129,11 +129,17 @@ libioam_vxlan_gpe_plugin_la_SOURCES = \
ioam/lib-vxlan-gpe/ioam_pop.c \
ioam/lib-vxlan-gpe/vxlan_gpe_api.c \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c \
- ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
+ ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c \
+ ioam/export-vxlan-gpe/vxlan_gpe_node.c \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h\
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_thread.c
BUILT_SOURCES += \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
- ioam/lib-vxlan-gpe/vxlan_gpe.api.json
+ ioam/lib-vxlan-gpe/vxlan_gpe.api.json \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.json
noinst_HEADERS += \
ioam/export/ioam_export_all_api_h.h \
@@ -142,7 +148,10 @@ noinst_HEADERS += \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_util.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_packet.h \
- ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h
+ ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_all_api_h.h \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_msg_enum.h \
+ ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h
ioam_vxlan_gpe_test_plugin_la_SOURCES = \
ioam/lib-vxlan-gpe/vxlan_gpe_test.c \
@@ -153,33 +162,11 @@ libioam_vxlan_gpe_plugin_la_LIBADD = libioam_trace_plugin.la
vppapitestplugins_LTLIBRARIES += ioam_vxlan_gpe_test_plugin.la
vppplugins_LTLIBRARIES += libioam_vxlan_gpe_plugin.la
-########################################
-# iOAM export for VxLAN-GPE
-########################################
-
-libvxlan_gpe_ioam_export_plugin_la_SOURCES = \
-ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c \
-ioam/export-vxlan-gpe/vxlan_gpe_node.c \
-ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h \
-ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_thread.c
-
-BUILT_SOURCES += \
- ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h \
- ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.json
-
-noinst_HEADERS += \
- ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_all_api_h.h \
- ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_msg_enum.h \
- ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h
-
vxlan_gpe_ioam_export_test_plugin_la_SOURCES = \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_plugin.api.h
-libvxlan_gpe_ioam_export_plugin_la_LIBADD = libioam_vxlan_gpe_plugin.la
-
vppapitestplugins_LTLIBRARIES += vxlan_gpe_ioam_export_test_plugin.la
-vppplugins_LTLIBRARIES += libvxlan_gpe_ioam_export_plugin.la
########################################
# iOAM E2E plugin
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;
}