aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-03-05 03:01:43 -0800
committerDamjan Marion <dmarion@me.com>2019-03-06 11:40:53 +0000
commite1714d3ba2fa91db5fcede631e2acafca899604c (patch)
tree43a634884f0d64083036a9a2b020ee847861d9f3
parentf6266b56ecd6bca3074886b37d48cf5c20f37fa3 (diff)
vxlan*: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: Ide23bb3d82024118214902850821a8184fe65dfc Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--src/vnet/CMakeLists.txt13
-rw-r--r--src/vnet/vxlan-gbp/decap.c41
-rw-r--r--src/vnet/vxlan-gbp/encap.c20
-rw-r--r--src/vnet/vxlan-gpe/decap.c77
-rw-r--r--src/vnet/vxlan/encap.c14
5 files changed, 85 insertions, 80 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 54e8c8ddcb4..f1ac547aa81 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -268,6 +268,10 @@ list(APPEND VNET_SOURCES
vxlan/vxlan_api.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ vxlan/encap.c
+)
+
list(APPEND VNET_HEADERS
vxlan/vxlan.h
vxlan/vxlan_packet.h
@@ -719,6 +723,11 @@ list(APPEND VNET_SOURCES
vxlan-gbp/vxlan_gbp_packet.c
)
+list (APPEND VNET_MULTIARCH_SOURCES
+ vxlan-gbp/decap.c
+ vxlan-gbp/encap.c
+)
+
list(APPEND VNET_HEADERS
vxlan-gbp/vxlan_gbp.h
vxlan-gbp/vxlan_gbp_packet.h
@@ -738,6 +747,10 @@ list(APPEND VNET_SOURCES
vxlan-gpe/vxlan_gpe_api.c
)
+list (APPEND VNET_MULTIARCH_SOURCES
+ vxlan-gpe/decap.c
+)
+
list(APPEND VNET_HEADERS
vxlan-gpe/vxlan_gpe.h
vxlan-gpe/vxlan_gpe_packet.h
diff --git a/src/vnet/vxlan-gbp/decap.c b/src/vnet/vxlan-gbp/decap.c
index 1a8ece702a6..39dac4169b4 100644
--- a/src/vnet/vxlan-gbp/decap.c
+++ b/src/vnet/vxlan-gbp/decap.c
@@ -19,9 +19,6 @@
#include <vnet/pg/pg.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
-vlib_node_registration_t vxlan4_gbp_input_node;
-vlib_node_registration_t vxlan6_gbp_input_node;
-
typedef struct
{
u32 next_index;
@@ -494,16 +491,16 @@ vxlan_gbp_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-vxlan4_gbp_input (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan4_gbp_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return vxlan_gbp_input (vm, node, from_frame, /* is_ip4 */ 1);
}
-static uword
-vxlan6_gbp_input (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan6_gbp_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return vxlan_gbp_input (vm, node, from_frame, /* is_ip4 */ 0);
}
@@ -518,7 +515,6 @@ static char *vxlan_gbp_error_strings[] = {
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (vxlan4_gbp_input_node) =
{
- .function = vxlan4_gbp_input,
.name = "vxlan4-gbp-input",
.vector_size = sizeof (u32),
.n_errors = VXLAN_GBP_N_ERROR,
@@ -531,11 +527,9 @@ VLIB_REGISTER_NODE (vxlan4_gbp_input_node) =
#undef _
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_gbp_input_node, vxlan4_gbp_input)
VLIB_REGISTER_NODE (vxlan6_gbp_input_node) =
{
- .function = vxlan6_gbp_input,
.name = "vxlan6-gbp-input",
.vector_size = sizeof (u32),
.n_errors = VXLAN_GBP_N_ERROR,
@@ -548,7 +542,6 @@ VLIB_REGISTER_NODE (vxlan6_gbp_input_node) =
},
.format_trace = format_vxlan_gbp_rx_trace,
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_gbp_input_node, vxlan6_gbp_input)
/* *INDENT-ON* */
typedef enum
@@ -957,9 +950,9 @@ ip_vxlan_gbp_bypass_inline (vlib_main_t * vm,
return frame->n_vectors;
}
-static uword
-ip4_vxlan_gbp_bypass (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_vxlan_gbp_bypass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_vxlan_gbp_bypass_inline (vm, node, frame, /* is_ip4 */ 1);
}
@@ -967,7 +960,6 @@ ip4_vxlan_gbp_bypass (vlib_main_t * vm,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_vxlan_gbp_bypass_node) =
{
- .function = ip4_vxlan_gbp_bypass,
.name = "ip4-vxlan-gbp-bypass",
.vector_size = sizeof (u32),
.n_next_nodes = IP_VXLAN_GBP_BYPASS_N_NEXT,
@@ -978,10 +970,9 @@ VLIB_REGISTER_NODE (ip4_vxlan_gbp_bypass_node) =
.format_buffer = format_ip4_header,
.format_trace = format_ip4_forward_next_trace,
};
-
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_vxlan_gbp_bypass_node, ip4_vxlan_gbp_bypass)
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t *
ip4_vxlan_gbp_bypass_init (vlib_main_t * vm)
@@ -990,10 +981,11 @@ ip4_vxlan_gbp_bypass_init (vlib_main_t * vm)
}
VLIB_INIT_FUNCTION (ip4_vxlan_gbp_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
-static uword
-ip6_vxlan_gbp_bypass (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_vxlan_gbp_bypass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_vxlan_gbp_bypass_inline (vm, node, frame, /* is_ip4 */ 0);
}
@@ -1001,7 +993,6 @@ ip6_vxlan_gbp_bypass (vlib_main_t * vm,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_vxlan_gbp_bypass_node) =
{
- .function = ip6_vxlan_gbp_bypass,
.name = "ip6-vxlan-gbp-bypass",
.vector_size = sizeof (u32),
.n_next_nodes = IP_VXLAN_GBP_BYPASS_N_NEXT,
@@ -1012,10 +1003,9 @@ VLIB_REGISTER_NODE (ip6_vxlan_gbp_bypass_node) =
.format_buffer = format_ip6_header,
.format_trace = format_ip6_forward_next_trace,
};
-
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_vxlan_gbp_bypass_node, ip6_vxlan_gbp_bypass)
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t *
ip6_vxlan_gbp_bypass_init (vlib_main_t * vm)
@@ -1024,6 +1014,7 @@ ip6_vxlan_gbp_bypass_init (vlib_main_t * vm)
}
VLIB_INIT_FUNCTION (ip6_vxlan_gbp_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/vxlan-gbp/encap.c b/src/vnet/vxlan-gbp/encap.c
index f8fc9b4b998..2fe3fa8d437 100644
--- a/src/vnet/vxlan-gbp/encap.c
+++ b/src/vnet/vxlan-gbp/encap.c
@@ -53,6 +53,7 @@ typedef struct
u8 flags;
} vxlan_gbp_encap_trace_t;
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_vxlan_gbp_encap_trace (u8 * s, va_list * args)
{
@@ -66,6 +67,7 @@ format_vxlan_gbp_encap_trace (u8 * s, va_list * args)
t->tunnel_index, t->vni, t->sclass, t->flags);
return s;
}
+#endif /* CLIB_MARCH_VARIANT */
always_inline uword
vxlan_gbp_encap_inline (vlib_main_t * vm,
@@ -488,9 +490,9 @@ vxlan_gbp_encap_inline (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-vxlan4_gbp_encap (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan4_gbp_encap_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
/* Disable chksum offload as setup overhead in tx node is not worthwhile
for ip4 header checksum only, unless udp checksum is also required */
@@ -498,9 +500,9 @@ vxlan4_gbp_encap (vlib_main_t * vm,
/* csum_offload */ 0);
}
-static uword
-vxlan6_gbp_encap (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan6_gbp_encap_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
/* Enable checksum offload for ip6 as udp checksum is mandatory, */
return vxlan_gbp_encap_inline (vm, node, from_frame, /* is_ip4 */ 0,
@@ -510,7 +512,6 @@ vxlan6_gbp_encap (vlib_main_t * vm,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (vxlan4_gbp_encap_node) =
{
- .function = vxlan4_gbp_encap,
.name = "vxlan4-gbp-encap",
.vector_size = sizeof (u32),
.format_trace = format_vxlan_gbp_encap_trace,
@@ -523,11 +524,8 @@ VLIB_REGISTER_NODE (vxlan4_gbp_encap_node) =
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_gbp_encap_node, vxlan4_gbp_encap)
-
VLIB_REGISTER_NODE (vxlan6_gbp_encap_node) =
{
- .function = vxlan6_gbp_encap,
.name = "vxlan6-gbp-encap",
.vector_size = sizeof (u32),
.format_trace = format_vxlan_gbp_encap_trace,
@@ -539,8 +537,6 @@ VLIB_REGISTER_NODE (vxlan6_gbp_encap_node) =
[VXLAN_GBP_ENCAP_NEXT_DROP] = "error-drop",
},
};
-
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_gbp_encap_node, vxlan6_gbp_encap)
/* *INDENT-ON* */
/*
diff --git a/src/vnet/vxlan-gpe/decap.c b/src/vnet/vxlan-gpe/decap.c
index 9c429294d67..b852704f6b4 100644
--- a/src/vnet/vxlan-gpe/decap.c
+++ b/src/vnet/vxlan-gpe/decap.c
@@ -24,8 +24,6 @@
#include <vnet/pg/pg.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
-vlib_node_registration_t vxlan_gpe_input_node;
-
/**
* @brief Struct for VXLAN GPE decap packet tracing
*
@@ -116,7 +114,8 @@ vxlan_gpe_input (vlib_main_t * vm,
u32 last_tunnel_index = ~0;
vxlan4_gpe_tunnel_key_t last_key4;
vxlan6_gpe_tunnel_key_t last_key6;
- u32 pkts_decapsulated = 0;
+ u32 ip4_pkts_decapsulated = 0;
+ u32 ip6_pkts_decapsulated = 0;
u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
@@ -346,7 +345,11 @@ vxlan_gpe_input (vlib_main_t * vm,
*/
vnet_buffer (b0)->sw_if_index[VLIB_TX] = t0->decap_fib_index;
- pkts_decapsulated++;
+ if (is_ip4)
+ ip4_pkts_decapsulated++;
+ else
+ ip6_pkts_decapsulated++;
+
stats_n_packets += 1;
stats_n_bytes += len0;
@@ -437,7 +440,11 @@ vxlan_gpe_input (vlib_main_t * vm,
*/
vnet_buffer (b1)->sw_if_index[VLIB_TX] = t1->decap_fib_index;
- pkts_decapsulated++;
+ if (is_ip4)
+ ip4_pkts_decapsulated++;
+ else
+ ip6_pkts_decapsulated++;
+
stats_n_packets += 1;
stats_n_bytes += len1;
@@ -609,7 +616,11 @@ vxlan_gpe_input (vlib_main_t * vm,
*/
vnet_buffer (b0)->sw_if_index[VLIB_TX] = t0->decap_fib_index;
- pkts_decapsulated++;
+ if (is_ip4)
+ ip4_pkts_decapsulated++;
+ else
+ ip6_pkts_decapsulated++;
+
stats_n_packets += 1;
stats_n_bytes += len0;
@@ -647,9 +658,12 @@ vxlan_gpe_input (vlib_main_t * vm,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, vxlan_gpe_input_node.index,
+ vlib_node_increment_counter (vm, vxlan4_gpe_input_node.index,
+ VXLAN_GPE_ERROR_DECAPSULATED,
+ ip4_pkts_decapsulated);
+ vlib_node_increment_counter (vm, vxlan6_gpe_input_node.index,
VXLAN_GPE_ERROR_DECAPSULATED,
- pkts_decapsulated);
+ ip6_pkts_decapsulated);
/* Increment any remaining batch stats */
if (stats_n_packets)
{
@@ -673,14 +687,14 @@ vxlan_gpe_input (vlib_main_t * vm,
* @return from_frame->n_vectors
*
*/
-static uword
-vxlan4_gpe_input (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan4_gpe_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return vxlan_gpe_input (vm, node, from_frame, /* is_ip4 */ 1);
}
-
+#ifndef CLIB_MARCH_VARIANT
void
vxlan_gpe_register_decap_protocol (u8 protocol_id, uword next_node_index)
{
@@ -696,7 +710,7 @@ vxlan_gpe_unregister_decap_protocol (u8 protocol_id, uword next_node_index)
hm->decap_next_node_list[protocol_id] = VXLAN_GPE_INPUT_NEXT_DROP;
return;
}
-
+#endif /* CLIB_MARCH_VARIANT */
/**
* @brief Graph processing dispatch function for IPv6 VXLAN GPE
@@ -709,9 +723,9 @@ vxlan_gpe_unregister_decap_protocol (u8 protocol_id, uword next_node_index)
* @return from_frame->n_vectors - uword
*
*/
-static uword
-vxlan6_gpe_input (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+VLIB_NODE_FN (vxlan6_gpe_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return vxlan_gpe_input (vm, node, from_frame, /* is_ip4 */ 0);
}
@@ -728,7 +742,6 @@ static char *vxlan_gpe_error_strings[] = {
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (vxlan4_gpe_input_node) = {
- .function = vxlan4_gpe_input,
.name = "vxlan4-gpe-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -749,11 +762,8 @@ VLIB_REGISTER_NODE (vxlan4_gpe_input_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_gpe_input_node, vxlan4_gpe_input);
-
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (vxlan6_gpe_input_node) = {
- .function = vxlan6_gpe_input,
.name = "vxlan6-gpe-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
@@ -774,7 +784,6 @@ VLIB_REGISTER_NODE (vxlan6_gpe_input_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_gpe_input_node, vxlan6_gpe_input);
typedef enum
{
IP_VXLAN_BYPASS_NEXT_DROP,
@@ -1174,16 +1183,15 @@ ip_vxlan_gpe_bypass_inline (vlib_main_t * vm,
return frame->n_vectors;
}
-static uword
-ip4_vxlan_gpe_bypass (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip4_vxlan_gpe_bypass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_vxlan_gpe_bypass_inline (vm, node, frame, /* is_ip4 */ 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_vxlan_gpe_bypass_node) = {
- .function = ip4_vxlan_gpe_bypass,
.name = "ip4-vxlan-gpe-bypass",
.vector_size = sizeof (u32),
@@ -1198,25 +1206,26 @@ VLIB_REGISTER_NODE (ip4_vxlan_gpe_bypass_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip4_vxlan_gpe_bypass_node, ip4_vxlan_gpe_bypass)
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
- clib_error_t *ip4_vxlan_gpe_bypass_init (vlib_main_t * vm)
+clib_error_t *
+ip4_vxlan_gpe_bypass_init (vlib_main_t * vm)
{
return 0;
}
VLIB_INIT_FUNCTION (ip4_vxlan_gpe_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
-static uword
-ip6_vxlan_gpe_bypass (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_vxlan_gpe_bypass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return ip_vxlan_gpe_bypass_inline (vm, node, frame, /* is_ip4 */ 0);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_vxlan_gpe_bypass_node) = {
- .function = ip6_vxlan_gpe_bypass,
.name = "ip6-vxlan-gpe-bypass",
.vector_size = sizeof (u32),
@@ -1231,14 +1240,16 @@ VLIB_REGISTER_NODE (ip6_vxlan_gpe_bypass_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_vxlan_gpe_bypass_node, ip6_vxlan_gpe_bypass)
+#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
- clib_error_t *ip6_vxlan_gpe_bypass_init (vlib_main_t * vm)
+clib_error_t *
+ip6_vxlan_gpe_bypass_init (vlib_main_t * vm)
{
return 0;
}
VLIB_INIT_FUNCTION (ip6_vxlan_gpe_bypass_init);
+#endif /* CLIB_MARCH_VARIANT */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/vxlan/encap.c b/src/vnet/vxlan/encap.c
index 33b6526f2fa..fe2374c6c0d 100644
--- a/src/vnet/vxlan/encap.c
+++ b/src/vnet/vxlan/encap.c
@@ -49,6 +49,7 @@ typedef struct {
u32 vni;
} vxlan_encap_trace_t;
+#ifndef CLIB_MARCH_VARIANT
u8 * format_vxlan_encap_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -60,6 +61,7 @@ u8 * format_vxlan_encap_trace (u8 * s, va_list * args)
t->tunnel_index, t->vni);
return s;
}
+#endif
always_inline uword
vxlan_encap_inline (vlib_main_t * vm,
@@ -460,8 +462,7 @@ vxlan_encap_inline (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static uword
-vxlan4_encap (vlib_main_t * vm,
+VLIB_NODE_FN (vxlan4_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -471,8 +472,7 @@ vxlan4_encap (vlib_main_t * vm,
/* csum_offload */ 0);
}
-static uword
-vxlan6_encap (vlib_main_t * vm,
+VLIB_NODE_FN (vxlan6_encap_node) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
@@ -482,7 +482,6 @@ vxlan6_encap (vlib_main_t * vm,
}
VLIB_REGISTER_NODE (vxlan4_encap_node) = {
- .function = vxlan4_encap,
.name = "vxlan4-encap",
.vector_size = sizeof (u32),
.format_trace = format_vxlan_encap_trace,
@@ -495,10 +494,7 @@ VLIB_REGISTER_NODE (vxlan4_encap_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_encap_node, vxlan4_encap)
-
VLIB_REGISTER_NODE (vxlan6_encap_node) = {
- .function = vxlan6_encap,
.name = "vxlan6-encap",
.vector_size = sizeof (u32),
.format_trace = format_vxlan_encap_trace,
@@ -511,5 +507,3 @@ VLIB_REGISTER_NODE (vxlan6_encap_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_encap_node, vxlan6_encap)
-