aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/vxlan-gpe/decap.c78
-rw-r--r--vnet/vnet/vxlan-gpe/dir.dox32
-rw-r--r--vnet/vnet/vxlan-gpe/encap.c72
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe.c113
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe.h96
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe_packet.h33
6 files changed, 380 insertions, 44 deletions
diff --git a/vnet/vnet/vxlan-gpe/decap.c b/vnet/vnet/vxlan-gpe/decap.c
index 7f32cbd8a49..3720837a333 100644
--- a/vnet/vnet/vxlan-gpe/decap.c
+++ b/vnet/vnet/vxlan-gpe/decap.c
@@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/**
+ * @file
+ * @brief Functions for decapsulating VXLAN GPE tunnels
+ *
+*/
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
@@ -21,12 +26,25 @@
vlib_node_registration_t vxlan_gpe_input_node;
+/**
+ * @brief Struct for VXLAN GPE decap packet tracing
+ *
+ */
typedef struct {
u32 next_index;
u32 tunnel_index;
u32 error;
} vxlan_gpe_rx_trace_t;
+/**
+ * @brief Tracing function for VXLAN GPE packet decapsulation
+ *
+ * @param *s - u8 - format string
+ * @param *args - va_list - arguments to display
+ *
+ * @return *s u8 - formatted trace output
+ *
+ */
static u8 * format_vxlan_gpe_rx_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -46,7 +64,15 @@ static u8 * format_vxlan_gpe_rx_trace (u8 * s, va_list * args)
return s;
}
-
+/**
+ * @brief Tracing function for VXLAN GPE packet decapsulation including length
+ *
+ * @param *s - u8 - format string
+ * @param *args - va_list - arguments to display
+ *
+ * @return *s u8 - formatted trace output
+ *
+ */
static u8 * format_vxlan_gpe_with_length (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -56,6 +82,25 @@ static u8 * format_vxlan_gpe_with_length (u8 * s, va_list * args)
return s;
}
+/**
+ * @brief Common processing for IPv4 and IPv6 VXLAN GPE decap dispatch functions
+ *
+ * It is worth noting that other than trivial UDP forwarding (transit), VXLAN GPE
+ * tunnels are "terminate local". This means that there is no "TX" interface for this
+ * decap case, so that field in the buffer_metadata can be "used for something else".
+ * The something else in this case is, for the IPv4/IPv6 inner-packet type case, the
+ * FIB index used to look up the inner-packet's adjacency.
+ *
+ * vnet_buffer(b0)->sw_if_index[VLIB_TX] = t0->decap_fib_index;
+ *
+ * @param *vm - vlib_main_t
+ * @param *node - vlib_node_runtime_t
+ * @param *from_frame - vlib_frame_t
+ * @param ip_ip4 - u8
+ *
+ * @return from_frame->n_vectors - uword
+ *
+ */
always_inline uword
vxlan_gpe_input (vlib_main_t * vm,
vlib_node_runtime_t * node,
@@ -250,7 +295,7 @@ vxlan_gpe_input (vlib_main_t * vm,
/* Required to make the l2 tag push / pop code work on l2 subifs */
vnet_update_l2_len (b0);
- /*
+ /**
* ip[46] lookup in the configured FIB
*/
vnet_buffer(b0)->sw_if_index[VLIB_TX] = t0->decap_fib_index;
@@ -545,6 +590,17 @@ vxlan_gpe_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
+/**
+ * @brief Graph processing dispatch function for IPv4 VXLAN GPE
+ *
+ * @node vxlan4-gpe-input
+ * @param *vm - vlib_main_t
+ * @param *node - vlib_node_runtime_t
+ * @param *from_frame - vlib_frame_t
+ *
+ * @return from_frame->n_vectors - uword
+ *
+ */
static uword
vxlan4_gpe_input (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
@@ -552,6 +608,17 @@ vxlan4_gpe_input (vlib_main_t * vm, vlib_node_runtime_t * node,
return vxlan_gpe_input (vm, node, from_frame, /* is_ip4 */1);
}
+/**
+ * @brief Graph processing dispatch function for IPv6 VXLAN GPE
+ *
+ * @node vxlan6-gpe-input
+ * @param *vm - vlib_main_t
+ * @param *node - vlib_node_runtime_t
+ * @param *from_frame - vlib_frame_t
+ *
+ * @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)
@@ -559,6 +626,9 @@ vxlan6_gpe_input (vlib_main_t * vm, vlib_node_runtime_t * node,
return vxlan_gpe_input (vm, node, from_frame, /* is_ip4 */0);
}
+/**
+ * @brief VXLAN GPE error strings
+ */
static char * vxlan_gpe_error_strings[] = {
#define vxlan_gpe_error(n,s) s,
#include <vnet/vxlan-gpe/vxlan_gpe_error.def>
@@ -587,7 +657,7 @@ VLIB_REGISTER_NODE (vxlan4_gpe_input_node) = {
// $$$$ .unformat_buffer = unformat_vxlan_gpe_header,
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_gpe_input_node, vxlan4_gpe_input)
+VLIB_NODE_FUNCTION_MULTIARCH (vxlan4_gpe_input_node, vxlan4_gpe_input);
VLIB_REGISTER_NODE (vxlan6_gpe_input_node) = {
.function = vxlan6_gpe_input,
@@ -610,4 +680,4 @@ VLIB_REGISTER_NODE (vxlan6_gpe_input_node) = {
// $$$$ .unformat_buffer = unformat_vxlan_gpe_header,
};
-VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_gpe_input_node, vxlan6_gpe_input)
+VLIB_NODE_FUNCTION_MULTIARCH (vxlan6_gpe_input_node, vxlan6_gpe_input);
diff --git a/vnet/vnet/vxlan-gpe/dir.dox b/vnet/vnet/vxlan-gpe/dir.dox
new file mode 100644
index 00000000000..c154733b21f
--- /dev/null
+++ b/vnet/vnet/vxlan-gpe/dir.dox
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (c) 2013 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ @dir
+ @brief VXLAN GPE
+
+ Based on IETF: draft-quinn-vxlan-gpe-03.txt
+
+Abstract
+
+ This draft describes extending Virtual eXtensible Local Area Network
+ (VXLAN), via changes to the VXLAN header, with three new
+ capabilities: support for multi-protocol encapsulation, operations,
+ administration and management (OAM) signaling and explicit
+ versioning.
+
+ See file: vxlan-gpe-rfc.txt
+
+*/ \ No newline at end of file
diff --git a/vnet/vnet/vxlan-gpe/encap.c b/vnet/vnet/vxlan-gpe/encap.c
index ba0eca2a0a1..cf482414465 100644
--- a/vnet/vnet/vxlan-gpe/encap.c
+++ b/vnet/vnet/vxlan-gpe/encap.c
@@ -12,6 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/**
+ * @file
+ * @brief Functions for encapsulating VXLAN GPE tunnels
+ *
+*/
#include <vppinfra/error.h>
#include <vppinfra/hash.h>
#include <vnet/vnet.h>
@@ -19,16 +24,22 @@
#include <vnet/ethernet/ethernet.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
-/* Statistics (not really errors) */
+/** Statistics (not really errors) */
#define foreach_vxlan_gpe_encap_error \
_(ENCAPSULATED, "good packets encapsulated")
+/**
+ * @brief VXLAN GPE encap error strings
+ */
static char * vxlan_gpe_encap_error_strings[] = {
#define _(sym,string) string,
foreach_vxlan_gpe_encap_error
#undef _
};
+/**
+ * @brief Struct for VXLAN GPE errors/counters
+ */
typedef enum {
#define _(sym,str) VXLAN_GPE_ENCAP_ERROR_##sym,
foreach_vxlan_gpe_encap_error
@@ -36,6 +47,9 @@ typedef enum {
VXLAN_GPE_ENCAP_N_ERROR,
} 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,
@@ -43,22 +57,43 @@ typedef enum {
VXLAN_GPE_ENCAP_N_NEXT
} vxlan_gpe_encap_next_t;
+/**
+ * @brief Struct for tracing VXLAN GPE encapsulated packets
+ */
typedef struct {
u32 tunnel_index;
} vxlan_gpe_encap_trace_t;
-
+/**
+ * @brief Trace of packets encapsulated in VXLAN GPE
+ *
+ * @param *s - u8 - formatted string
+ * @param *args - va_list
+ *
+ * @return *s - u8 - formatted string
+ *
+ */
u8 * format_vxlan_gpe_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 *);
- vxlan_gpe_encap_trace_t * t
+ vxlan_gpe_encap_trace_t * t
= va_arg (*args, vxlan_gpe_encap_trace_t *);
s = format (s, "VXLAN-GPE-ENCAP: tunnel %d", t->tunnel_index);
return s;
}
+/**
+ * @brief Instantiates UDP + VXLAN-GPE header then set next node to IP4|6 lookup
+ *
+ * @param *ngm - vxlan_gpe_maint_t
+ * @param *b0 - vlib_buffer_t
+ * @param *t0 - vxlan_gpe_tunnel_t - contains rewrite header
+ * @param *next0 - u32 - relative index of next dispatch function (next node)
+ * @param is_v4 - u8 - Is this IPv4? (or IPv6)
+ *
+ */
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)
@@ -79,6 +114,19 @@ vxlan_gpe_encap_one_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0,
}
}
+/**
+ * @brief Instantiates UDP + VXLAN-GPE header then set next node to IP4|6 lookup for two packets
+ *
+ * @param *ngm - vxlan_gpe_maint_t
+ * @param *b0 - vlib_buffer_t - Packet0
+ * @param *b1 - vlib_buffer_t - Packet1
+ * @param *t0 - vxlan_gpe_tunnel_t - contains rewrite header for Packet0
+ * @param *t1 - vxlan_gpe_tunnel_t - contains rewrite header for Packet1
+ * @param *next0 - u32 - relative index of next dispatch function (next node) for Packet0
+ * @param *next1 - u32 - relative index of next dispatch function (next node) for Packet1
+ * @param is_v4 - u8 - Is this IPv4? (or IPv6)
+ *
+ */
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,
@@ -101,6 +149,24 @@ vxlan_gpe_encap_two_inline (vxlan_gpe_main_t * ngm, vlib_buffer_t * b0, vlib_buf
}
}
+/**
+ * @brief Common processing for IPv4 and IPv6 VXLAN GPE encap dispatch functions
+ *
+ * It is worth noting that other than trivial UDP forwarding (transit), VXLAN GPE
+ * tunnels are "establish local". This means that we don't have a TX interface as yet
+ * as we need to look up where the outer-header dest is. By setting the TX index in the
+ * buffer metadata to the encap FIB, we can do a lookup to get the adjacency and real TX.
+ *
+ * vnet_buffer(b0)->sw_if_index[VLIB_TX] = t0->encap_fib_index;
+ *
+ * @node vxlan-gpe-input
+ * @param *vm - vlib_main_t
+ * @param *node - vlib_node_runtime_t
+ * @param *from_frame - vlib_frame_t
+ *
+ * @return from_frame->n_vectors - uword
+ *
+ */
static uword
vxlan_gpe_encap (vlib_main_t * vm,
vlib_node_runtime_t * node,
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.c b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
index f54d46c78d4..55e317cb3ab 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe.c
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
@@ -12,11 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/**
+ * @file
+ * @brief Common utility functions for IPv4 and IPv6 VXLAN GPE tunnels
+ *
+*/
#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vnet/ip/format.h>
vxlan_gpe_main_t vxlan_gpe_main;
+/**
+ * @brief Tracing function for VXLAN GPE tunnel packets
+ *
+ * @param *s - u8 - formatting string
+ * @param *args - va_list
+ *
+ * @return *s - u8 - formmatted string
+ *
+ */
u8 * format_vxlan_gpe_tunnel (u8 * s, va_list * args)
{
vxlan_gpe_tunnel_t * t = va_arg (*args, vxlan_gpe_tunnel_t *);
@@ -54,13 +68,21 @@ u8 * format_vxlan_gpe_tunnel (u8 * s, va_list * args)
return s;
}
+/**
+ * @brief Naming for VXLAN GPE tunnel
+ *
+ * @param *s - u8 - formatting string
+ * @param *args - va_list
+ *
+ * @return *s - u8 - formatted string
+ *
+ */
static u8 * format_vxlan_gpe_name (u8 * s, va_list * args)
{
u32 dev_instance = va_arg (*args, u32);
return format (s, "vxlan_gpe_tunnel%d", dev_instance);
}
-
static uword dummy_interface_tx (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
@@ -68,6 +90,17 @@ static uword dummy_interface_tx (vlib_main_t * vm,
clib_warning ("you shouldn't be here, leaking buffers...");
return frame->n_vectors;
}
+
+/**
+ * @brief CLI function for VXLAN GPE admin up/down
+ *
+ * @param *vnm - vnet_main_t
+ * @param hw_if_index - u32
+ * @param flags - u32
+ *
+ * @return *rc - clib_error_t
+ *
+ */
static clib_error_t *
vxlan_gpe_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
@@ -98,6 +131,15 @@ static uword dummy_set_rewrite (vnet_main_t * vnm,
}
+/**
+ * @brief Formatting function for tracing VXLAN GPE with length
+ *
+ * @param *s - u8 - formatting string
+ * @param *args - va_list
+ *
+ * @return *s - formatted string
+ *
+ */
static u8 * format_vxlan_gpe_header_with_length (u8 * s, va_list * args)
{
u32 dev_instance = va_arg (*args, u32);
@@ -131,6 +173,14 @@ _(decap_fib_index)
}
+/**
+ * @brief Calculate IPv4 VXLAN GPE rewrite header
+ *
+ * @param *t - vxlan_gpe_tunnel_t
+ *
+ * @return rc - int
+ *
+ */
static int vxlan4_gpe_rewrite (vxlan_gpe_tunnel_t * t)
{
u8 *rw = 0;
@@ -169,6 +219,14 @@ static int vxlan4_gpe_rewrite (vxlan_gpe_tunnel_t * t)
return (0);
}
+/**
+ * @brief Calculate IPv6 VXLAN GPE rewrite header
+ *
+ * @param *t - vxlan_gpe_tunnel_t
+ *
+ * @return rc - int
+ *
+ */
static int vxlan6_gpe_rewrite (vxlan_gpe_tunnel_t * t)
{
u8 *rw = 0;
@@ -207,6 +265,15 @@ static int vxlan6_gpe_rewrite (vxlan_gpe_tunnel_t * t)
return (0);
}
+/**
+ * @brief Add or Del a VXLAN GPE tunnel
+ *
+ * @param *a - vnet_vxlan_gpe_add_del_tunnel_args_t
+ * @param *sw_if_index - u32
+ *
+ * @return rc - int
+ *
+ */
int vnet_vxlan_gpe_add_del_tunnel
(vnet_vxlan_gpe_add_del_tunnel_args_t *a, u32 * sw_if_indexp)
{
@@ -352,6 +419,14 @@ int vnet_vxlan_gpe_add_del_tunnel
return 0;
}
+/**
+ * @brief Find the IPv4 FIB index from the FIB ID
+ *
+ * @param fib_id - u32
+ *
+ * @return fib_index - u32
+ *
+ */
static u32 fib4_index_from_fib_id (u32 fib_id)
{
ip4_main_t * im = &ip4_main;
@@ -364,6 +439,14 @@ static u32 fib4_index_from_fib_id (u32 fib_id)
return p[0];
}
+/**
+ * @brief Find the IPv4 FIB index from the FIB ID
+ *
+ * @param fib_id - u32
+ *
+ * @return fib_index - u32
+ *
+ */
static u32 fib6_index_from_fib_id (u32 fib_id)
{
ip6_main_t * im = &ip6_main;
@@ -376,6 +459,16 @@ static u32 fib6_index_from_fib_id (u32 fib_id)
return p[0];
}
+/**
+ * @brief CLI function for Add/Del of IPv4/IPv6 VXLAN GPE tunnel
+ *
+ * @param *vm - vlib_main_t
+ * @param *input - unformat_input_t
+ * @param *cmd - vlib_cli_command_t
+ *
+ * @return error - clib_error_t
+ *
+ */
static clib_error_t *
vxlan_gpe_add_del_tunnel_command_fn (vlib_main_t * vm,
unformat_input_t * input,
@@ -528,6 +621,16 @@ VLIB_CLI_COMMAND (create_vxlan_gpe_tunnel_command, static) = {
.function = vxlan_gpe_add_del_tunnel_command_fn,
};
+/**
+ * @brief CLI function for showing VXLAN GPE tunnels
+ *
+ * @param *vm - vlib_main_t
+ * @param *input - unformat_input_t
+ * @param *cmd - vlib_cli_command_t
+ *
+ * @return error - clib_error_t
+ *
+ */
static clib_error_t *
show_vxlan_gpe_tunnel_command_fn (vlib_main_t * vm,
unformat_input_t * input,
@@ -552,6 +655,14 @@ VLIB_CLI_COMMAND (show_vxlan_gpe_tunnel_command, static) = {
.function = show_vxlan_gpe_tunnel_command_fn,
};
+/**
+ * @brief Feature init function for VXLAN GPE
+ *
+ * @param *vm - vlib_main_t
+ *
+ * @return error - clib_error_t
+ *
+ */
clib_error_t *vxlan_gpe_init (vlib_main_t *vm)
{
vxlan_gpe_main_t *gm = &vxlan_gpe_main;
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.h b/vnet/vnet/vxlan-gpe/vxlan_gpe.h
index f7cfba9956a..e33725f3ef3 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe.h
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.h
@@ -12,6 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/**
+ * @file
+ * @brief VXLAN GPE definitions
+ *
+*/
#ifndef included_vnet_vxlan_gpe_h
#define included_vnet_vxlan_gpe_h
@@ -26,80 +31,102 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/udp.h>
-
+/**
+ * @brief VXLAN GPE header struct
+ *
+ */
typedef CLIB_PACKED (struct {
- ip4_header_t ip4; /* 20 bytes */
- udp_header_t udp; /* 8 bytes */
- vxlan_gpe_header_t vxlan; /* 8 bytes */
+ /** 20 bytes */
+ ip4_header_t ip4;
+ /** 8 bytes */
+ udp_header_t udp;
+ /** 8 bytes */
+ vxlan_gpe_header_t vxlan;
}) ip4_vxlan_gpe_header_t;
typedef CLIB_PACKED (struct {
- ip6_header_t ip6; /* 40 bytes */
- udp_header_t udp; /* 8 bytes */
- vxlan_gpe_header_t vxlan; /* 8 bytes */
+ /** 40 bytes */
+ ip6_header_t ip6;
+ /** 8 bytes */
+ udp_header_t udp;
+ /** 8 bytes */
+ vxlan_gpe_header_t vxlan;
}) ip6_vxlan_gpe_header_t;
+/**
+ * @brief Key struct for IPv4 VXLAN GPE tunnel.
+ * Key fields: local remote, vni
+ * all fields in NET byte order
+ * VNI shifted 8 bits
+ */
typedef CLIB_PACKED(struct {
- /*
- * Key fields: local remote, vni
- * all fields in NET byte order
- */
union {
struct {
u32 local;
u32 remote;
- u32 vni; /* shifted 8 bits */
+
+ u32 vni;
u32 pad;
};
u64 as_u64[2];
};
}) vxlan4_gpe_tunnel_key_t;
+/**
+ * @brief Key struct for IPv6 VXLAN GPE tunnel.
+ * Key fields: local remote, vni
+ * all fields in NET byte order
+ * VNI shifted 8 bits
+ */
typedef CLIB_PACKED(struct {
- /*
- * Key fields: local remote, vni
- * all fields in NET byte order
- */
ip6_address_t local;
ip6_address_t remote;
- u32 vni; /* shifted 8 bits */
+ u32 vni;
}) vxlan6_gpe_tunnel_key_t;
+/**
+ * @brief Struct for VXLAN GPE tunnel
+ */
typedef struct {
- /* Rewrite string. $$$$ embed vnet_rewrite header */
+ /** Rewrite string. $$$$ embed vnet_rewrite header */
u8 * rewrite;
- /* encapsulated protocol */
+ /** encapsulated protocol */
u8 protocol;
- /* tunnel src and dst addresses */
+ /** tunnel local address */
ip46_address_t local;
+ /** tunnel remote address */
ip46_address_t remote;
- /* FIB indices */
- u32 encap_fib_index; /* tunnel partner lookup here */
- u32 decap_fib_index; /* inner IP lookup here */
+ /** FIB indices - tunnel partner lookup here */
+ u32 encap_fib_index;
+ /** FIB indices - inner IP packet lookup here */
+ u32 decap_fib_index;
- /* vxlan VNI in HOST byte order, shifted left 8 bits */
+ /** VXLAN GPE VNI in HOST byte order, shifted left 8 bits */
u32 vni;
- /* vnet intfc hw/sw_if_index */
+ /** vnet intfc hw_if_index */
u32 hw_if_index;
+ /** vnet intfc sw_if_index */
u32 sw_if_index;
- /* flags */
+ /** flags */
u32 flags;
} vxlan_gpe_tunnel_t;
-/* Flags for vxlan_gpe_tunnel_t.flags */
+/** Flags for vxlan_gpe_tunnel_t */
#define VXLAN_GPE_TUNNEL_IS_IPV4 1
+/** next nodes for VXLAN GPE input */
#define foreach_vxlan_gpe_input_next \
_(DROP, "error-drop") \
_(IP4_INPUT, "ip4-input") \
_(IP6_INPUT, "ip6-input") \
_(ETHERNET_INPUT, "ethernet-input")
+/** struct for next nodes for VXLAN GPE input */
typedef enum {
#define _(s,n) VXLAN_GPE_INPUT_NEXT_##s,
foreach_vxlan_gpe_input_next
@@ -107,6 +134,7 @@ typedef enum {
VXLAN_GPE_INPUT_N_NEXT,
} vxlan_gpe_input_next_t;
+/** struct for VXLAN GPE errors */
typedef enum {
#define vxlan_gpe_error(n,s) VXLAN_GPE_ERROR_##n,
#include <vnet/vxlan-gpe/vxlan_gpe_error.def>
@@ -114,22 +142,25 @@ typedef enum {
VXLAN_GPE_N_ERROR,
} vxlan_gpe_input_error_t;
+/** Struct for VXLAN GPE node state */
typedef struct {
- /* vector of encap tunnel instances */
+ /** vector of encap tunnel instances */
vxlan_gpe_tunnel_t *tunnels;
- /* lookup tunnel by key */
+ /** lookup IPv4 VXLAN GPE tunnel by key */
uword * vxlan4_gpe_tunnel_by_key;
+ /** lookup IPv6 VXLAN GPE tunnel by key */
uword * vxlan6_gpe_tunnel_by_key;
- /* Free vlib hw_if_indices */
+ /** Free vlib hw_if_indices */
u32 * free_vxlan_gpe_tunnel_hw_if_indices;
- /* Mapping from sw_if_index to tunnel index */
+ /** Mapping from sw_if_index to tunnel index */
u32 * tunnel_index_by_sw_if_index;
- /* convenience */
+ /** State convenience vlib_main_t */
vlib_main_t * vlib_main;
+ /** State convenience vnet_main_t */
vnet_main_t * vnet_main;
} vxlan_gpe_main_t;
@@ -141,6 +172,7 @@ extern vlib_node_registration_t vxlan6_gpe_input_node;
u8 * format_vxlan_gpe_encap_trace (u8 * s, va_list * args);
+/** Struct for VXLAN GPE add/del args */
typedef struct {
u8 is_add;
u8 is_ip6;
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe_packet.h b/vnet/vnet/vxlan-gpe/vxlan_gpe_packet.h
index 3403cc9ebad..e5501b95e3f 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe_packet.h
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe_packet.h
@@ -12,10 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/**
+ * @file
+ * @brief VXLAN GPE packet header structure
+ *
+*/
#ifndef included_vxlan_gpe_packet_h
#define included_vxlan_gpe_packet_h
-/*
+/**
* From draft-quinn-vxlan-gpe-03.txt
*
* 0 1 2 3
@@ -52,25 +57,45 @@
* 0x4 : Network Service Header [NSH]
*/
-#define foreach_vxlan_gpe_protocol \
+/**
+ * @brief VXLAN GPE support inner protocol definition.
+ * 1 - IP4
+ * 2 - IP6
+ * 3 - ETHERNET
+ * 4 - NSH
+ */
+#define foreach_vxlan_gpe_protocol \
_ (0x01, IP4) \
_ (0x02, IP6) \
_ (0x03, ETHERNET) \
-_ (0x04, NSH)
+_ (0x04, NSH)
+/**
+ * @brief Struct for VXLAN GPE support inner protocol definition.
+ * 1 - IP4
+ * 2 - IP6
+ * 3 - ETHERNET
+ * 4 - NSH
+ */
typedef enum {
#define _(n,f) VXLAN_GPE_PROTOCOL_##f = n,
foreach_vxlan_gpe_protocol
#undef _
} vxlan_gpe_protocol_t;
+/**
+ * @brief VXLAN GPE Header definition
+ */
typedef struct {
u8 flags;
+ /** Version and Reserved */
u8 ver_res;
+ /** Reserved */
u8 res;
- /* see vxlan_gpe_protocol_t */
+ /** see vxlan_gpe_protocol_t */
u8 protocol;
+ /** VNI and Reserved */
u32 vni_res;
} vxlan_gpe_header_t;