diff options
Diffstat (limited to 'vnet/vnet/vxlan-gpe/encap.c')
-rw-r--r-- | vnet/vnet/vxlan-gpe/encap.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/vnet/vnet/vxlan-gpe/encap.c b/vnet/vnet/vxlan-gpe/encap.c index 9cd2c722..3a486e56 100644 --- a/vnet/vnet/vxlan-gpe/encap.c +++ b/vnet/vnet/vxlan-gpe/encap.c @@ -48,16 +48,6 @@ typedef enum { } vxlan_gpe_encap_error_t; /** - * @brief Struct for defining VXLAN GPE next nodes - */ -typedef enum { - VXLAN_GPE_ENCAP_NEXT_IP4_LOOKUP, - VXLAN_GPE_ENCAP_NEXT_IP6_LOOKUP, - VXLAN_GPE_ENCAP_NEXT_DROP, - VXLAN_GPE_ENCAP_N_NEXT -} vxlan_gpe_encap_next_t; - -/** * @brief Struct for tracing VXLAN GPE encapsulated packets */ typedef struct { @@ -96,22 +86,14 @@ u8 * format_vxlan_gpe_encap_trace (u8 * s, va_list * args) */ always_inline void vxlan_gpe_encap_one_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0, - vxlan_gpe_tunnel_t * t0, u32 * next0, u8 is_v4) + vxlan_gpe_tunnel_t * t0, u32 * next0, + u8 is_v4) { ASSERT(sizeof(ip4_vxlan_gpe_header_t) == 36); ASSERT(sizeof(ip6_vxlan_gpe_header_t) == 56); - if (is_v4) - { - ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, 36, 1); - next0[0] = VXLAN_GPE_ENCAP_NEXT_IP4_LOOKUP; - - } - else - { - ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, 56, 0); - next0[0] = VXLAN_GPE_ENCAP_NEXT_IP6_LOOKUP; - } + ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, t0->rewrite_size, is_v4); + next0[0] = t0->encap_next_node; } /** @@ -128,25 +110,17 @@ vxlan_gpe_encap_one_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0, * */ always_inline void -vxlan_gpe_encap_two_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0, vlib_buffer_t * b1, - vxlan_gpe_tunnel_t * t0, vxlan_gpe_tunnel_t * t1, u32 * next0, +vxlan_gpe_encap_two_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0, + vlib_buffer_t * b1, vxlan_gpe_tunnel_t * t0, + vxlan_gpe_tunnel_t * t1, u32 * next0, u32 * next1, u8 is_v4) { ASSERT(sizeof(ip4_vxlan_gpe_header_t) == 36); ASSERT(sizeof(ip6_vxlan_gpe_header_t) == 56); - if (is_v4) - { - ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, 36, 1); - ip_udp_encap_one (ngm->vlib_main, b1, t1->rewrite, 36, 1); - next0[0] = next1[0] = VXLAN_GPE_ENCAP_NEXT_IP4_LOOKUP; - } - else - { - ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, 56, 0); - ip_udp_encap_one (ngm->vlib_main, b1, t1->rewrite, 56, 0); - next0[0] = next1[0] = VXLAN_GPE_ENCAP_NEXT_IP6_LOOKUP; - } + ip_udp_encap_one (ngm->vlib_main, b0, t0->rewrite, t0->rewrite_size, is_v4); + ip_udp_encap_one (ngm->vlib_main, b1, t1->rewrite, t1->rewrite_size, is_v4); + next0[0] = next1[0] = t0->encap_next_node; } /** |