Add support for multiple microarchitectures in single binary
[vpp.git] / vnet / vnet / ipsec / ipsec_output.c
index 77b39fa..9355468 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <vnet/ipsec/ipsec.h>
 
+#if IPSEC > 0
 
 #define foreach_ipsec_output_next                \
 _(DROP, "error-drop")                            \
@@ -57,7 +58,7 @@ static char * ipsec_output_error_strings[] = {
 #undef _
 };
 
-vlib_node_registration_t ipsec_output_node;
+static vlib_node_registration_t ipsec_output_node;
 
 typedef struct {
   u32 spd_id;
@@ -81,7 +82,7 @@ static u8 * format_ipsec_output_trace (u8 * s, va_list * args)
   return s;
 }
 
-always_inline intf_output_feat_t
+always_inline intf_output_feat_t __attribute__((unused))
 get_next_intf_output_feature_and_reset_bit(vlib_buffer_t *b)
 {
   u32 next_feature;
@@ -385,7 +386,7 @@ dispatch0:
   return from_frame->n_vectors;
 }
 
-VLIB_REGISTER_NODE (ipsec_output_node) = {
+VLIB_REGISTER_NODE (ipsec_output_node,static) = {
   .function = ipsec_output_node_fn,
   .name = "ipsec-output",
   .vector_size = sizeof (u32),
@@ -403,3 +404,25 @@ VLIB_REGISTER_NODE (ipsec_output_node) = {
 #undef _
   },
 };
+
+VLIB_NODE_FUNCTION_MULTIARCH (ipsec_output_node, ipsec_output_node_fn)
+
+#else /* IPSEC > 1 */
+
+/* Dummy ipsec output node, in case when IPSec is disabled */
+
+static uword
+ipsec_output_node_fn (vlib_main_t * vm,
+                 vlib_node_runtime_t * node,
+                 vlib_frame_t * frame)
+{
+  clib_warning ("IPSec disabled");
+  return 0;
+}
+
+VLIB_REGISTER_NODE (ipsec_output_node) = {
+  .vector_size = sizeof (u32),
+  .function = ipsec_output_node_fn,
+  .name = "ipsec-output",
+};
+#endif