Merging all ioam plugin libraries to single library 22/4522/2
authorAkshayaNadahalli <anadahal@cisco.com>
Fri, 23 Dec 2016 12:16:08 +0000 (17:46 +0530)
committerDamjan Marion <dmarion.lists@gmail.com>
Wed, 4 Jan 2017 17:52:59 +0000 (17:52 +0000)
Double commit from 1702 branch to master.

Change-Id: I33a646ba45848c7400df4271e4933e28e62c9ad7
Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
(cherry picked from commit e4e9fbbb7c8fa4385ae31072d60ad8621fe798a4)
Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
src/plugins/ioam.am
src/plugins/ioam/encap/ip6_ioam_e2e.c
src/plugins/ioam/encap/ip6_ioam_trace.c
src/plugins/ioam/export-common/ioam_export.h
src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c
src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_node.c
src/plugins/ioam/export/ioam_export.c
src/plugins/ioam/lib-pot/pot_api.c
src/plugins/ioam/lib-trace/trace_api.c
src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c

index a4984b1..a2b298b 100644 (file)
 # iOAM Proof of Transit
 ########################################
 
-ioam_pot_plugin_la_SOURCES =                   \
+IOAM_POT_SRC =                                 \
        ioam/lib-pot/pot_util.c                 \
        ioam/encap/ip6_ioam_pot.c               \
        ioam/lib-pot/pot_util.h                 \
        ioam/lib-pot/math64.h                   \
        ioam/lib-pot/pot_api.c
 
-noinst_HEADERS +=                              \
+IOAM_POT_NOINST_HDR =                          \
   ioam/lib-pot/pot_all_api_h.h                 \
   ioam/lib-pot/pot_msg_enum.h                  \
   ioam/lib-pot/pot.api.h                       \
   ioam/lib-pot/pot_util.h                      \
   ioam/lib-pot/math64.h
 
-API_FILES += ioam/lib-pot/pot.api
+IOAM_POT_API = ioam/lib-pot/pot.api
 
 ioam_pot_test_plugin_la_SOURCES =              \
        ioam/lib-pot/pot_test.c                 \
        ioam/lib-pot/pot_plugin.api.h
 
 vppapitestplugins_LTLIBRARIES += ioam_pot_test_plugin.la
-vppplugins_LTLIBRARIES += ioam_pot_plugin.la
 
 ########################################
 # iOAM trace export for IPv6
 ########################################
 
-ioam_export_plugin_la_SOURCES =   \
+IOAM_EXPORT_SRC =                \
 ioam/export/ioam_export.c         \
 ioam/export/node.c                \
 ioam/export/ioam_export.api.h     \
 ioam/export/ioam_export_thread.c
 
-noinst_HEADERS +=                       \
+IOAM_EXPORT_NOINST_HDR =                \
   ioam/export/ioam_export_all_api_h.h   \
   ioam/export/ioam_export_msg_enum.h    \
   ioam/export/ioam_export.api.h
 
-API_FILES += ioam/export/ioam_export.api
+IOAM_EXPORT_API = ioam/export/ioam_export.api
 
 ioam_export_test_plugin_la_SOURCES =  \
   ioam/export/ioam_export_test.c      \
   ioam/export/ioam_export_plugin.api.h
 
 vppapitestplugins_LTLIBRARIES += ioam_export_test_plugin.la
-vppplugins_LTLIBRARIES += ioam_export_plugin.la
 
 ########################################
 # iOAM Trace
 ########################################
-libioam_trace_plugin_la_SOURCES =              \
+IOAM_TRACE_SRC =                               \
        ioam/lib-trace/trace_util.c             \
        ioam/encap/ip6_ioam_trace.c             \
        ioam/lib-trace/trace_util.h             \
        ioam/lib-trace/trace_api.c
 
-noinst_HEADERS +=                       \
+IOAM_TRACE_NOINST_HDR =                 \
   ioam/export/ioam_export_all_api_h.h   \
   ioam/lib-trace/trace_all_api_h.h     \
   ioam/lib-trace/trace_msg_enum.h      \
   ioam/lib-trace/trace.api.h           \
   ioam/lib-trace/trace_util.h
 
-API_FILES += ioam/lib-trace/trace.api
+IOAM_TRACE_API = ioam/lib-trace/trace.api
 
 ioam_trace_test_plugin_la_SOURCES =            \
        ioam/lib-trace/trace_test.c             \
        ioam/lib-trace/trace_plugin.api.h
 
 vppapitestplugins_LTLIBRARIES += ioam_trace_test_plugin.la
-vppplugins_LTLIBRARIES += libioam_trace_plugin.la
 
 ########################################
 # VxLAN-GPE
 ########################################
-libioam_vxlan_gpe_plugin_la_SOURCES =                  \
+IOAM_VXLAN_GPE_SRC =                                   \
        ioam/lib-vxlan-gpe/ioam_encap.c                 \
        ioam/lib-vxlan-gpe/ioam_decap.c                 \
        ioam/lib-vxlan-gpe/ioam_transit.c               \
@@ -104,27 +101,26 @@ libioam_vxlan_gpe_plugin_la_SOURCES =                     \
        ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h\
        ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_thread.c
 
-noinst_HEADERS +=                       \
-  ioam/export/ioam_export_all_api_h.h   \
+IOAM_VXLAN_GPE_NOINST_HDR =                                    \
+  ioam/export/ioam_export_all_api_h.h                          \
   ioam/lib-vxlan-gpe/vxlan_gpe_all_api_h.h                     \
   ioam/lib-vxlan-gpe/vxlan_gpe_msg_enum.h                      \
   ioam/lib-vxlan-gpe/ioam_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
 
-API_FILES += ioam/lib-vxlan-gpe/ioam_vxlan_gpe.api
-API_FILES += ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api
+IOAM_VXLAN_GPE_API  = ioam/lib-vxlan-gpe/ioam_vxlan_gpe.api
+IOAM_VXLAN_GPE_API += ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api
 
 ioam_vxlan_gpe_test_plugin_la_SOURCES =                \
        ioam/lib-vxlan-gpe/vxlan_gpe_test.c                     \
        ioam/lib-vxlan-gpe/vxlan_gpe_plugin.api.h
 
 vppapitestplugins_LTLIBRARIES += ioam_vxlan_gpe_test_plugin.la
-vppplugins_LTLIBRARIES += libioam_vxlan_gpe_plugin.la
 
 vxlan_gpe_ioam_export_test_plugin_la_SOURCES =          \
   ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c      \
@@ -136,15 +132,39 @@ vppapitestplugins_LTLIBRARIES += vxlan_gpe_ioam_export_test_plugin.la
 # iOAM E2E plugin
 ########################################
 
-ioam_e2e_plugin_la_SOURCES =                \
+IOAM_E2E_SRC =                                 \
        ioam/encap/ip6_ioam_e2e.c               \
        ioam/encap/ip6_ioam_seqno.c             \
        ioam/encap/ip6_ioam_seqno_analyse.c
 
-noinst_HEADERS +=                    \
+IOAM_E2E_NOINST_HDR =                   \
        ioam/encap/ip6_ioam_e2e.h        \
        ioam/encap/ip6_ioam_seqno.h
 
-vppplugins_LTLIBRARIES += ioam_e2e_plugin.la
+########################################
+# iOAM plugins
+########################################
+
+ioam_plugin_la_SOURCES =               \
+        $(IOAM_POT_SRC)                 \
+        $(IOAM_EXPORT_SRC)              \
+        $(IOAM_TRACE_SRC)               \
+        $(IOAM_VXLAN_GPE_SRC)          \
+        $(IOAM_E2E_SRC)
+
+API_FILES +=                           \
+        $(IOAM_POT_API)                 \
+        $(IOAM_EXPORT_API)              \
+        $(IOAM_TRACE_API)               \
+        $(IOAM_VXLAN_GPE_API)
+
+noinst_HEADERS +=                               \
+        $(IOAM_POT_NOINST_HDR)                  \
+        $(IOAM_EXPORT_NOINST_HDR)               \
+        $(IOAM_TRACE_NOINST_HDR)                \
+        $(IOAM_VXLAN_GPE_NOINST_HDR)            \
+        $(IOAM_E2E_NOINST_HDR)
+
+vppplugins_LTLIBRARIES += ioam_plugin.la
 
 # vi:syntax=automake
index 0839cdc..2831a35 100644 (file)
@@ -25,8 +25,6 @@
 #include <vppinfra/elog.h>
 
 #include <vnet/ip/ip6_hop_by_hop.h>
-#include <vnet/plugin/plugin.h>
-
 #include "ip6_ioam_e2e.h"
 
 ioam_e2e_main_t ioam_e2e_main;
@@ -166,23 +164,6 @@ VLIB_CLI_COMMAND (ioam_show_e2e_cmd, static) = {
     .function = ioam_show_e2e_cmd_fn,
 };
 
-/*
- * 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)
-{
-  clib_error_t * error = 0;
-
-  ioam_e2e_main.vlib_main = vm;
-  ioam_e2e_main.vnet_main = h->vnet_main;
-  return error;
-}
-
 /*
  * Init handler E2E headet handling.
  * Init hanlder registers encap, decap, trace and Rewrite handlers.
@@ -222,6 +203,9 @@ ioam_e2e_init (vlib_main_t * vm)
           "HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE Flow handler failed"));
     }
 
+  ioam_e2e_main.vlib_main = vm;
+  ioam_e2e_main.vnet_main = vnet_get_main();
+
   return (0);
 }
 
index e63db6e..3a6758c 100644 (file)
@@ -24,6 +24,7 @@
 #include <vppinfra/hash.h>
 #include <vppinfra/error.h>
 #include <vppinfra/elog.h>
+#include <vnet/plugin/plugin.h>
 
 #include <ioam/lib-trace/trace_util.h>
 
@@ -348,6 +349,18 @@ VLIB_CLI_COMMAND (ip6_show_ioam_trace_cmd, static) = {
 };
 /* *INDENT-ON* */
 
+/*
+ * 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)
+{
+  return 0;
+}
 
 static clib_error_t *
 ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm)
index fbd8618..e6ab034 100644 (file)
@@ -77,6 +77,7 @@ ioam_export_main_t ioam_export_main;
 ioam_export_main_t vxlan_gpe_ioam_export_main;
 
 extern vlib_node_registration_t export_node;
+extern vlib_node_registration_t vxlan_export_node;
 
 #define DEFAULT_EXPORT_SIZE (3 * CLIB_CACHE_LINE_BYTES)
 /*
index bab8d97..0924d68 100644 (file)
@@ -92,7 +92,7 @@ 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;
+  u32 node_index = vxlan_export_node.index;
   vlib_node_t *vxlan_gpe_decap_ioam_node = NULL;
 
   if (is_disable == 0)
index 722c2b0..f75b708 100644 (file)
@@ -40,7 +40,7 @@ format_export_trace (u8 * s, va_list * args)
   return s;
 }
 
-vlib_node_registration_t export_node;
+vlib_node_registration_t vxlan_export_node;
 
 #define foreach_export_error \
 _(RECORDED, "Packets recorded for export")
@@ -137,7 +137,7 @@ vxlan_gpe_export_node_fn (vlib_main_t * vm,
  * Node for VXLAN-GPE export
  */
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (export_node) =
+VLIB_REGISTER_NODE (vxlan_export_node) =
 {
   .function = vxlan_gpe_export_node_fn,
   .name = "vxlan-gpe-ioam-export",
index b122e44..06634ba 100644 (file)
@@ -81,26 +81,6 @@ do {                                                            \
 #define foreach_ioam_export_plugin_api_msg                        \
 _(IOAM_EXPORT_IP6_ENABLE_DISABLE, ioam_export_ip6_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 = &ioam_export_main;
-  clib_error_t *error = 0;
-
-  em->vlib_main = vm;
-  em->vnet_main = h->vnet_main;
-
-  return error;
-}
-
 /* Action function shared between message handler and debug CLI */
 
 int
@@ -250,6 +230,9 @@ ioam_export_init (vlib_main_t * vm)
   u32 node_index = export_node.index;
   vlib_node_t *ip6_hbyh_node = NULL;
 
+  em->vlib_main = vm;
+  em->vnet_main = vnet_get_main ();
+
   name = format (0, "ioam_export_%08x%c", api_version, 0);
 
   /* Ask for a correctly-sized block of API message decode slots */
index d3af7b4..04c2aaa 100644 (file)
@@ -213,26 +213,6 @@ static void vl_api_pot_profile_del_t_handler
     REPLY_MACRO(VL_API_POT_PROFILE_DEL_REPLY);
 }
 
-
-/* 
- * 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)
-{
-  pot_main_t * sm = &pot_main;
-  clib_error_t * error = 0;
-
-  sm->vlib_main = vm;
-  sm->vnet_main = h->vnet_main;
-  return error;
-}
-
 /* Set up the API message handling tables */
 static clib_error_t *
 pot_plugin_api_hookup (vlib_main_t *vm)
@@ -273,6 +253,10 @@ static clib_error_t * pot_init (vlib_main_t * vm)
 
   bzero(sm, sizeof(pot_main));
   (void)pot_util_init();
+
+  sm->vlib_main = vm;
+  sm->vnet_main = vnet_get_main();
+
   name = format (0, "ioam_pot_%08x%c", api_version, 0);
 
   /* Ask for a correctly-sized block of API message decode slots */
index 7e0d708..2ada5b7 100644 (file)
@@ -165,25 +165,6 @@ static void vl_api_trace_profile_show_config_t_handler
     }
 }
 
-/*
- * 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)
-{
-  trace_main_t *sm = &trace_main;
-  clib_error_t *error = 0;
-
-  sm->vlib_main = vm;
-  sm->vnet_main = h->vnet_main;
-  return error;
-}
-
 /* Set up the API message handling tables */
 static clib_error_t *
 trace_plugin_api_hookup (vlib_main_t * vm)
@@ -225,6 +206,10 @@ trace_init (vlib_main_t * vm)
 
   bzero (sm, sizeof (trace_main));
   (void) trace_util_init ();
+
+  sm->vlib_main = vm;
+  sm->vnet_main = vnet_get_main ();
+
   name = format (0, "ioam_trace_%08x%c", api_version, 0);
 
   /* Ask for a correctly-sized block of API message decode slots */
index 6875236..247bcf5 100644 (file)
@@ -284,28 +284,6 @@ static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler
   VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_DISABLE_REPLY);
 }
 
-
-/*
- * 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)
-{
-  vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
-  clib_error_t *error = 0;
-
-  sm->vlib_main = vm;
-  sm->vnet_main = h->vnet_main;
-  sm->unix_time_0 = (u32) time (0);    /* Store starting time */
-  sm->vlib_time_0 = vlib_time_now (vm);
-  return error;
-}
-
 /* Set up the API message handling tables */
 static clib_error_t *
 vxlan_gpe_plugin_api_hookup (vlib_main_t * vm)
@@ -337,6 +315,11 @@ vxlan_gpe_init (vlib_main_t * vm)
   vlib_node_t *vxlan_gpe_decap_node = NULL;
   uword next_node = 0;
 
+  sm->vlib_main = vm;
+  sm->vnet_main = vnet_get_main ();
+  sm->unix_time_0 = (u32) time (0);    /* Store starting time */
+  sm->vlib_time_0 = vlib_time_now (vm);
+
   name = format (0, "ioam_vxlan_gpe_%08x%c", api_version, 0);
 
   /* Ask for a correctly-sized block of API message decode slots */