summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/interface_rx_dpo.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-05-25 21:10:23 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-26 19:01:23 +0000
commitfc23f12c252a9843aeeb8dae7bf60264908f084d (patch)
tree1ef7c6e0a5d0bbf91a5c254ff520f83a5ae6db2a /src/vnet/dpo/interface_rx_dpo.c
parentf888e1c29d15df51a879034cf4f2a7598424364d (diff)
Fix interface-rx-dpo-l2 node to setup l2_len in vnet buffer
Change-Id: Ic1fab1f3aba92bbdbfd281459562d1f9697ab465 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/dpo/interface_rx_dpo.c')
-rw-r--r--src/vnet/dpo/interface_rx_dpo.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/vnet/dpo/interface_rx_dpo.c b/src/vnet/dpo/interface_rx_dpo.c
index 4a6832ade9e..4e5b1a5eeeb 100644
--- a/src/vnet/dpo/interface_rx_dpo.c
+++ b/src/vnet/dpo/interface_rx_dpo.c
@@ -15,6 +15,7 @@
#include <vnet/dpo/interface_rx_dpo.h>
#include <vnet/fib/fib_node.h>
+#include <vnet/l2/l2_input.h>
/*
* The 'DB' of interface DPOs.
@@ -234,7 +235,8 @@ typedef enum interface_rx_dpo_next_t_
always_inline uword
interface_rx_dpo_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+ vlib_frame_t * from_frame,
+ u8 is_l2)
{
u32 n_left_from, next_index, * from, * to_next;
u32 thread_index = vlib_get_thread_index ();
@@ -278,6 +280,12 @@ interface_rx_dpo_inline (vlib_main_t * vm,
vnet_buffer(b0)->sw_if_index[VLIB_RX] = ido0->ido_sw_if_index;
vnet_buffer(b1)->sw_if_index[VLIB_RX] = ido1->ido_sw_if_index;
+ if (is_l2)
+ {
+ vnet_update_l2_len (b0);
+ vnet_update_l2_len (b1);
+ }
+
vlib_increment_combined_counter (im->combined_sw_if_counters
+ VNET_INTERFACE_COUNTER_RX,
thread_index,
@@ -329,6 +337,10 @@ interface_rx_dpo_inline (vlib_main_t * vm,
* interface DPR represents */
vnet_buffer(b0)->sw_if_index[VLIB_RX] = ido0->ido_sw_if_index;
+ /* Update l2_len to make l2 tag rewrite work */
+ if (is_l2)
+ vnet_update_l2_len (b0);
+
/* Bump the interface's RX coutners */
vlib_increment_combined_counter (im->combined_sw_if_counters
+ VNET_INTERFACE_COUNTER_RX,
@@ -368,7 +380,7 @@ interface_rx_dpo_ip4 (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
- return (interface_rx_dpo_inline(vm, node, from_frame));
+ return (interface_rx_dpo_inline(vm, node, from_frame, 0));
}
static uword
@@ -376,7 +388,7 @@ interface_rx_dpo_ip6 (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
- return (interface_rx_dpo_inline(vm, node, from_frame));
+ return (interface_rx_dpo_inline(vm, node, from_frame, 0));
}
static uword
@@ -384,7 +396,7 @@ interface_rx_dpo_l2 (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
- return (interface_rx_dpo_inline(vm, node, from_frame));
+ return (interface_rx_dpo_inline(vm, node, from_frame, 1));
}
VLIB_REGISTER_NODE (interface_rx_dpo_ip4_node) = {