gtpu: migrate old MULTIARCH macros to VLIB_NODE_FN

Change-Id: Id6e82910f8d991e355d3f26222eea4ac3ab091b1
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
This commit is contained in:
Filip Tehlar
2019-02-26 04:53:38 -08:00
committed by Damjan Marion
parent 84caa17a9d
commit 0333121d83
5 changed files with 34 additions and 50 deletions
+4
View File
@@ -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
+12
View File
@@ -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)
{
+6
View File
@@ -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 */
+10 -23
View File
@@ -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 */
+2 -27
View File
@@ -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)