aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lisp/lisp-gpe/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lisp/lisp-gpe/interface.c')
-rw-r--r--src/plugins/lisp/lisp-gpe/interface.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/plugins/lisp/lisp-gpe/interface.c b/src/plugins/lisp/lisp-gpe/interface.c
index d73471d6b3d..ed2b08f9aaf 100644
--- a/src/plugins/lisp/lisp-gpe/interface.c
+++ b/src/plugins/lisp/lisp-gpe/interface.c
@@ -88,12 +88,10 @@ format_lisp_gpe_tx_trace (u8 * s, va_list * args)
*
* @return number of vectors in frame.
*/
-static uword
-lisp_gpe_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+VLIB_NODE_FN (lisp_tunnel_output)
+(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
{
u32 n_left_from, next_index, *from, *to_next;
- lisp_gpe_main_t *lgm = &lisp_gpe_main;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
@@ -112,7 +110,6 @@ lisp_gpe_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
const ip_adjacency_t *adj0;
const dpo_id_t *dpo0;
vlib_buffer_t *b0;
- u8 is_v4_0;
bi0 = from[0];
to_next[0] = bi0;
@@ -122,11 +119,7 @@ lisp_gpe_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
n_left_to_next -= 1;
b0 = vlib_get_buffer (vm, bi0);
-
- /* Fixup the checksum and len fields in the LISP tunnel encap
- * that was applied at the midchain node */
- is_v4_0 = is_v4_packet (vlib_buffer_get_current (b0));
- ip_udp_fixup_one (lgm->vlib_main, b0, is_v4_0);
+ b0->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
/* Follow the DPO on which the midchain is stacked */
adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
@@ -151,6 +144,13 @@ lisp_gpe_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
return from_frame->n_vectors;
}
+VLIB_REGISTER_NODE (lisp_tunnel_output) = {
+ .name = "lisp-tunnel-output",
+ .vector_size = sizeof (u32),
+ .format_trace = format_lisp_gpe_tx_trace,
+ .sibling_of = "tunnel-output",
+};
+
static u8 *
format_lisp_gpe_name (u8 * s, va_list * args)
{
@@ -158,14 +158,10 @@ format_lisp_gpe_name (u8 * s, va_list * args)
return format (s, "lisp_gpe%d", dev_instance);
}
-/* *INDENT-OFF* */
VNET_DEVICE_CLASS (lisp_gpe_device_class) = {
.name = "LISP_GPE",
.format_device_name = format_lisp_gpe_name,
- .format_tx_trace = format_lisp_gpe_tx_trace,
- .tx_function = lisp_gpe_interface_tx,
};
-/* *INDENT-ON* */
u8 *
format_lisp_gpe_header_with_length (u8 * s, va_list * args)
@@ -190,14 +186,12 @@ format_lisp_gpe_header_with_length (u8 * s, va_list * args)
return s;
}
-/* *INDENT-OFF* */
VNET_HW_INTERFACE_CLASS (lisp_gpe_hw_class) = {
.name = "LISP_GPE",
.format_header = format_lisp_gpe_header_with_length,
.build_rewrite = lisp_gpe_build_rewrite,
.update_adjacency = lisp_gpe_update_adjacency,
};
-/* *INDENT-ON* */
typedef struct
@@ -302,14 +296,12 @@ format_l2_lisp_gpe_name (u8 * s, va_list * args)
return format (s, "l2_lisp_gpe%d", dev_instance);
}
-/* *INDENT-OFF* */
VNET_DEVICE_CLASS (l2_lisp_gpe_device_class,static) = {
.name = "L2_LISP_GPE",
.format_device_name = format_l2_lisp_gpe_name,
.format_tx_trace = format_l2_lisp_gpe_tx_trace,
.tx_function = l2_lisp_gpe_interface_tx,
};
-/* *INDENT-ON* */
typedef struct
{
@@ -406,14 +398,12 @@ format_nsh_lisp_gpe_name (u8 * s, va_list * args)
return format (s, "nsh_lisp_gpe%d", dev_instance);
}
-/* *INDENT-OFF* */
VNET_DEVICE_CLASS (nsh_lisp_gpe_device_class,static) = {
.name = "NSH_LISP_GPE",
.format_device_name = format_nsh_lisp_gpe_name,
.format_tx_trace = format_nsh_lisp_gpe_tx_trace,
.tx_function = nsh_lisp_gpe_interface_tx,
};
-/* *INDENT-ON* */
static vnet_hw_interface_t *
lisp_gpe_create_iface (lisp_gpe_main_t * lgm, u32 vni, u32 dp_table,
@@ -431,7 +421,7 @@ lisp_gpe_create_iface (lisp_gpe_main_t * lgm, u32 vni, u32 dp_table,
if (flen > 0)
{
hw_if_index = lgm->free_tunnel_hw_if_indices[flen - 1];
- _vec_len (lgm->free_tunnel_hw_if_indices) -= 1;
+ vec_dec_len (lgm->free_tunnel_hw_if_indices, 1);
hi = vnet_get_hw_interface (vnm, hw_if_index);
@@ -926,13 +916,11 @@ done:
return error;
}
-/* *INDENT-OFF* */
VLIB_CLI_COMMAND (add_del_lisp_gpe_iface_command, static) = {
.path = "gpe iface",
.short_help = "gpe iface add/del vni <vni> vrf <vrf>",
.function = lisp_gpe_add_del_iface_command_fn,
};
-/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON