summaryrefslogtreecommitdiffstats
path: root/src/vnet/gre/gre_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/gre/gre_api.c')
-rw-r--r--src/vnet/gre/gre_api.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/vnet/gre/gre_api.c b/src/vnet/gre/gre_api.c
index be91f758777..619b5fc233c 100644
--- a/src/vnet/gre/gre_api.c
+++ b/src/vnet/gre/gre_api.c
@@ -25,6 +25,7 @@
#include <vnet/gre/gre.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/tunnel/tunnel_types_api.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/vnet_msg_enum.h>
@@ -83,40 +84,6 @@ gre_tunnel_type_encode (gre_tunnel_type_t in)
return (out);
}
-static int
-gre_tunnel_mode_decode (vl_api_gre_tunnel_mode_t in, gre_tunnel_mode_t * out)
-{
- switch (in)
- {
-#define _(n, v) \
- case GRE_API_TUNNEL_MODE_##n: \
- *out = GRE_TUNNEL_MODE_##n; \
- return (0);
- foreach_gre_tunnel_mode
-#undef _
- }
-
- return (VNET_API_ERROR_INVALID_VALUE_2);
-}
-
-static vl_api_gre_tunnel_mode_t
-gre_tunnel_mode_encode (gre_tunnel_mode_t in)
-{
- vl_api_gre_tunnel_mode_t out = GRE_API_TUNNEL_MODE_P2P;
-
- switch (in)
- {
-#define _(n, v) \
- case GRE_TUNNEL_MODE_##n: \
- out = GRE_API_TUNNEL_MODE_##n; \
- break;
- foreach_gre_tunnel_mode
-#undef _
- }
-
- return (out);
-}
-
static void vl_api_gre_tunnel_add_del_t_handler
(vl_api_gre_tunnel_add_del_t * mp)
{
@@ -146,7 +113,7 @@ static void vl_api_gre_tunnel_add_del_t_handler
if (rv)
goto out;
- rv = gre_tunnel_mode_decode (mp->tunnel.mode, &a->mode);
+ rv = tunnel_mode_decode (mp->tunnel.mode, &a->mode);
if (rv)
goto out;
@@ -185,7 +152,7 @@ static void send_gre_tunnel_details
(t->outer_fib_index, t->tunnel_dst.fp_proto));
rmp->tunnel.type = gre_tunnel_type_encode (t->type);
- rmp->tunnel.mode = gre_tunnel_mode_encode (t->mode);
+ rmp->tunnel.mode = tunnel_mode_encode (t->mode);
rmp->tunnel.instance = htonl (t->user_instance);
rmp->tunnel.sw_if_index = htonl (t->sw_if_index);
rmp->tunnel.session_id = htons (t->session_id);