summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-03-04 09:21:59 -0800
committerDamjan Marion <dmarion@me.com>2019-03-05 08:01:59 +0000
commit0fce11f23d64eae2f374435b31a77b872d552298 (patch)
tree8ba12d4b746baf5eb83e147dd376f4176b50f5d4 /src/vnet
parentd2bb61417fdb37d192cf25583d7d8fb50be19291 (diff)
gre: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: I0f6b9f306f2323216ba64b694e8fdfa116e6cc9c Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/CMakeLists.txt5
-rw-r--r--src/vnet/gre/gre.c18
-rw-r--r--src/vnet/gre/node.c21
3 files changed, 25 insertions, 19 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 6af466fddf9..01918cad887 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -613,6 +613,11 @@ list(APPEND VNET_SOURCES
gre/gre_api.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ gre/node.c
+ gre/gre.c
+)
+
list(APPEND VNET_HEADERS
gre/gre.h
gre/packet.h
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index e30319f5f99..364733b4260 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -19,6 +19,7 @@
#include <vnet/gre/gre.h>
#include <vnet/adj/adj_midchain.h>
+#ifndef CLIB_MARCH_VARIANT
gre_main_t gre_main;
typedef struct
@@ -38,6 +39,7 @@ typedef struct
u64 as_u64[3];
};
} ip6_and_gre_union_t;
+#endif /* CLIB_MARCH_VARIANT */
/* Packet trace structure */
@@ -54,7 +56,7 @@ typedef struct
ip46_address_t dst;
} gre_tx_trace_t;
-u8 *
+static u8 *
format_gre_tx_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -68,6 +70,7 @@ format_gre_tx_trace (u8 * s, va_list * args)
return s;
}
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_gre_protocol (u8 * s, va_list * args)
{
@@ -319,6 +322,7 @@ gre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
gre_tunnel_stack (ai);
}
+#endif /* CLIB_MARCH_VARIANT */
typedef enum
@@ -331,9 +335,9 @@ typedef enum
* @brief TX function. Only called for L2 payload including TEB or ERSPAN.
* L3 traffic uses the adj-midchains.
*/
-static uword
-gre_interface_tx (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (gre_encap_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
gre_main_t *gm = &gre_main;
vnet_main_t *vnm = gm->vnet_main;
@@ -513,7 +517,6 @@ static char *gre_error_strings[] = {
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (gre_encap_node) =
{
- .function = gre_interface_tx,
.name = "gre-encap",
.vector_size = sizeof (u32),
.format_trace = format_gre_tx_trace,
@@ -525,8 +528,6 @@ VLIB_REGISTER_NODE (gre_encap_node) =
[GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain",
},
};
-
-VLIB_NODE_FUNCTION_MULTIARCH (gre_encap_node, gre_interface_tx)
/* *INDENT-ON* */
static u8 *
@@ -565,6 +566,7 @@ VNET_DEVICE_CLASS (gre_device_class) = {
#endif
};
+#ifndef CLIB_MARCH_VARIANT
VNET_HW_INTERFACE_CLASS (gre_hw_interface_class) = {
.name = "GRE",
.format_header = format_gre_header_with_length,
@@ -635,6 +637,8 @@ gre_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (gre_init);
+#endif /* CLIB_MARCH_VARIANT */
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vnet/gre/node.c b/src/vnet/gre/node.c
index 89109bbc053..ad3c8c6e10d 100644
--- a/src/vnet/gre/node.c
+++ b/src/vnet/gre/node.c
@@ -46,7 +46,7 @@ typedef struct
u8 is_ipv6;
} gre_rx_trace_t;
-u8 *
+static u8 *
format_gre_rx_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -551,16 +551,16 @@ gre_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-gre4_input (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (gre4_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return gre_input (vm, node, from_frame, /* is_ip6 */ 0);
}
-static uword
-gre6_input (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (gre6_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return gre_input (vm, node, from_frame, /* is_ip6 */ 1);
}
@@ -573,7 +573,6 @@ static char *gre_error_strings[] = {
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (gre4_input_node) = {
- .function = gre4_input,
.name = "gre4-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -594,7 +593,6 @@ VLIB_REGISTER_NODE (gre4_input_node) = {
};
VLIB_REGISTER_NODE (gre6_input_node) = {
- .function = gre6_input,
.name = "gre6-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -615,11 +613,9 @@ VLIB_REGISTER_NODE (gre6_input_node) = {
.format_trace = format_gre_rx_trace,
.unformat_buffer = unformat_gre_header,
};
-
-VLIB_NODE_FUNCTION_MULTIARCH (gre4_input_node, gre4_input)
-VLIB_NODE_FUNCTION_MULTIARCH (gre6_input_node, gre6_input)
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
void
gre_register_input_protocol (vlib_main_t * vm,
gre_protocol_t protocol, u32 node_index,
@@ -711,6 +707,7 @@ gre_input_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (gre_input_init);
+#endif /* CLIB_MARCH_VARIANT */
/*
* fd.io coding-style-patch-verification: ON
*