summaryrefslogtreecommitdiffstats
path: root/src/plugins/gtpu
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-02-26 04:53:38 -0800
committerDamjan Marion <dmarion@me.com>2019-03-01 20:27:11 +0000
commit0333121d83287957062cdd03c6ec40e8f21e2b53 (patch)
tree0f4bf1edc14f5e89282f7e72f14ab8b9c13a06c7 /src/plugins/gtpu
parent84caa17a9d77e2986bb996a46d7c4a8a05fc868d (diff)
gtpu: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: Id6e82910f8d991e355d3f26222eea4ac3ab091b1 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/gtpu')
-rw-r--r--src/plugins/gtpu/CMakeLists.txt4
-rw-r--r--src/plugins/gtpu/gtpu.c12
-rw-r--r--src/plugins/gtpu/gtpu.h6
-rw-r--r--src/plugins/gtpu/gtpu_decap.c33
-rw-r--r--src/plugins/gtpu/gtpu_encap.c29
5 files changed, 34 insertions, 50 deletions
diff --git a/src/plugins/gtpu/CMakeLists.txt b/src/plugins/gtpu/CMakeLists.txt
index 0a599bb049f..805b65f7895 100644
--- a/src/plugins/gtpu/CMakeLists.txt
+++ b/src/plugins/gtpu/CMakeLists.txt
@@ -18,6 +18,10 @@ add_vpp_plugin(gtpu
gtpu_decap.c
gtpu_encap.c
+ MULTIARCH_SOURCES
+ gtpu_decap.c
+ gtpu_encap.c
+
API_FILES
gtpu.api
diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c
index dcdbc518b30..fb83fc8e636 100644
--- a/src/plugins/gtpu/gtpu.c
+++ b/src/plugins/gtpu/gtpu.c
@@ -48,6 +48,18 @@ VNET_FEATURE_INIT (ip6_gtpu_bypass, static) = {
};
/* *INDENT-on* */
+u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
+{
+ CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
+ CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
+ gtpu_encap_trace_t * t
+ = va_arg (*args, gtpu_encap_trace_t *);
+
+ s = format (s, "GTPU encap to gtpu_tunnel%d teid %d",
+ t->tunnel_index, t->teid);
+ return s;
+}
+
static u8 *
format_decap_next (u8 * s, va_list * args)
{
diff --git a/src/plugins/gtpu/gtpu.h b/src/plugins/gtpu/gtpu.h
index 05208755d8c..7296ece5b7c 100644
--- a/src/plugins/gtpu/gtpu.h
+++ b/src/plugins/gtpu/gtpu.h
@@ -256,6 +256,12 @@ typedef struct
int vnet_gtpu_add_del_tunnel
(vnet_gtpu_add_del_tunnel_args_t * a, u32 * sw_if_indexp);
+typedef struct
+{
+ u32 tunnel_index;
+ u32 teid;
+} gtpu_encap_trace_t;
+
void vnet_int_gtpu_bypass_mode (u32 sw_if_index, u8 is_ip6, u8 is_enable);
#endif /* included_vnet_gtpu_h */
diff --git a/src/plugins/gtpu/gtpu_decap.c b/src/plugins/gtpu/gtpu_decap.c
index b2ac553da9c..222899233ed 100644
--- a/src/plugins/gtpu/gtpu_decap.c
+++ b/src/plugins/gtpu/gtpu_decap.c
@@ -19,8 +19,8 @@
#include <vnet/pg/pg.h>
#include <gtpu/gtpu.h>
-vlib_node_registration_t gtpu4_input_node;
-vlib_node_registration_t gtpu6_input_node;
+extern vlib_node_registration_t gtpu4_input_node;
+extern vlib_node_registration_t gtpu6_input_node;
typedef struct {
u32 next_index;
@@ -784,16 +784,14 @@ gtpu_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-gtpu4_input (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu4_input_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
return gtpu_input(vm, node, from_frame, /* is_ip4 */ 1);
}
-static uword
-gtpu6_input (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu6_input_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -808,7 +806,6 @@ static char * gtpu_error_strings[] = {
};
VLIB_REGISTER_NODE (gtpu4_input_node) = {
- .function = gtpu4_input,
.name = "gtpu4-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -828,10 +825,7 @@ VLIB_REGISTER_NODE (gtpu4_input_node) = {
// $$$$ .unformat_buffer = unformat_gtpu_header,
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu4_input_node, gtpu4_input)
-
VLIB_REGISTER_NODE (gtpu6_input_node) = {
- .function = gtpu6_input,
.name = "gtpu6-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -851,9 +845,6 @@ VLIB_REGISTER_NODE (gtpu6_input_node) = {
// $$$$ .unformat_buffer = unformat_gtpu_header,
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu6_input_node, gtpu6_input)
-
-
typedef enum {
IP_GTPU_BYPASS_NEXT_DROP,
IP_GTPU_BYPASS_NEXT_GTPU,
@@ -1242,8 +1233,7 @@ ip_gtpu_bypass_inline (vlib_main_t * vm,
return frame->n_vectors;
}
-static uword
-ip4_gtpu_bypass (vlib_main_t * vm,
+VLIB_NODE_FN (ip4_gtpu_bypass_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -1251,7 +1241,6 @@ ip4_gtpu_bypass (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (ip4_gtpu_bypass_node) = {
- .function = ip4_gtpu_bypass,
.name = "ip4-gtpu-bypass",
.vector_size = sizeof (u32),
@@ -1265,16 +1254,15 @@ VLIB_REGISTER_NODE (ip4_gtpu_bypass_node) = {
.format_trace = format_ip4_forward_next_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_gtpu_bypass_node,ip4_gtpu_bypass)
-
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t * ip4_gtpu_bypass_init (vlib_main_t * vm)
{ return 0; }
VLIB_INIT_FUNCTION (ip4_gtpu_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
-static uword
-ip6_gtpu_bypass (vlib_main_t * vm,
+VLIB_NODE_FN (ip6_gtpu_bypass_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
@@ -1282,7 +1270,6 @@ ip6_gtpu_bypass (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (ip6_gtpu_bypass_node) = {
- .function = ip6_gtpu_bypass,
.name = "ip6-gtpu-bypass",
.vector_size = sizeof (u32),
@@ -1296,10 +1283,10 @@ VLIB_REGISTER_NODE (ip6_gtpu_bypass_node) = {
.format_trace = format_ip6_forward_next_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_gtpu_bypass_node,ip6_gtpu_bypass)
-
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t * ip6_gtpu_bypass_init (vlib_main_t * vm)
{ return 0; }
VLIB_INIT_FUNCTION (ip6_gtpu_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
diff --git a/src/plugins/gtpu/gtpu_encap.c b/src/plugins/gtpu/gtpu_encap.c
index 5f52d5a1543..d102a35eef9 100644
--- a/src/plugins/gtpu/gtpu_encap.c
+++ b/src/plugins/gtpu/gtpu_encap.c
@@ -48,23 +48,6 @@ typedef enum {
GTPU_ENCAP_N_NEXT,
} gtpu_encap_next_t;
-typedef struct {
- u32 tunnel_index;
- u32 teid;
-} gtpu_encap_trace_t;
-
-u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
-{
- CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
- gtpu_encap_trace_t * t
- = va_arg (*args, gtpu_encap_trace_t *);
-
- s = format (s, "GTPU encap to gtpu_tunnel%d teid %d",
- t->tunnel_index, t->teid);
- return s;
-}
-
#define foreach_fixed_header4_offset \
_(0) _(1) _(2) _(3)
@@ -662,16 +645,14 @@ gtpu_encap_inline (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-gtpu4_encap (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu4_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 1);
}
-static uword
-gtpu6_encap (vlib_main_t * vm,
+VLIB_NODE_FN (gtpu6_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -679,7 +660,6 @@ gtpu6_encap (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (gtpu4_encap_node) = {
- .function = gtpu4_encap,
.name = "gtpu4-encap",
.vector_size = sizeof (u32),
.format_trace = format_gtpu_encap_trace,
@@ -694,10 +674,7 @@ VLIB_REGISTER_NODE (gtpu4_encap_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu4_encap_node, gtpu4_encap)
-
VLIB_REGISTER_NODE (gtpu6_encap_node) = {
- .function = gtpu6_encap,
.name = "gtpu6-encap",
.vector_size = sizeof (u32),
.format_trace = format_gtpu_encap_trace,
@@ -712,5 +689,3 @@ VLIB_REGISTER_NODE (gtpu6_encap_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (gtpu6_encap_node, gtpu6_encap)
-