From d5c9d6f30aa37ea8d7fdf8a79d3ab4c2e67d3249 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 31 Oct 2016 23:21:46 +0100 Subject: l2: fix l2-patch node This node was not setting vnet_buffer (b0)->sw_if_index[VLIB_TX] properly. Change-Id: I3e9f095da5f79c4186e3988ef315a7045ac85708 Signed-off-by: Damjan Marion --- vnet/vnet/l2/l2_patch.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'vnet') diff --git a/vnet/vnet/l2/l2_patch.c b/vnet/vnet/l2/l2_patch.c index 5d097bb792e..ad05fa0d034 100644 --- a/vnet/vnet/l2/l2_patch.c +++ b/vnet/vnet/l2/l2_patch.c @@ -20,9 +20,6 @@ typedef struct { - u32 cached_next_index; - u32 cached_rx_sw_if_index; - /* vector of dispositions, indexed by rx_sw_if_index */ u32 *tx_next_by_rx_sw_if_index; u32 *tx_sw_if_index_by_rx_sw_if_index; @@ -139,19 +136,12 @@ l2_patch_node_fn (vlib_main_t * vm, ASSERT (l2pm->tx_next_by_rx_sw_if_index[sw_if_index1] != ~0); ASSERT (l2pm->tx_sw_if_index_by_rx_sw_if_index[sw_if_index1] != ~0); - if (PREDICT_TRUE (sw_if_index0 == l2pm->cached_rx_sw_if_index)) - next0 = l2pm->cached_next_index; - else - { - next0 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index0]; - l2pm->cached_rx_sw_if_index = sw_if_index0; - l2pm->cached_next_index = next0; - } - - if (PREDICT_TRUE (sw_if_index1 == l2pm->cached_rx_sw_if_index)) - next1 = l2pm->cached_next_index; - else - next1 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index1]; + next0 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index0]; + next1 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index1]; + vnet_buffer (b0)->sw_if_index[VLIB_TX] = + l2pm->tx_sw_if_index_by_rx_sw_if_index[sw_if_index0]; + vnet_buffer (b1)->sw_if_index[VLIB_TX] = + l2pm->tx_sw_if_index_by_rx_sw_if_index[sw_if_index1]; if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE))) { @@ -201,14 +191,9 @@ l2_patch_node_fn (vlib_main_t * vm, ASSERT (l2pm->tx_next_by_rx_sw_if_index[sw_if_index0] != ~0); ASSERT (l2pm->tx_sw_if_index_by_rx_sw_if_index[sw_if_index0] != ~0); - if (PREDICT_TRUE (sw_if_index0 == l2pm->cached_rx_sw_if_index)) - next0 = l2pm->cached_next_index; - else - { - next0 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index0]; - l2pm->cached_rx_sw_if_index = sw_if_index0; - l2pm->cached_next_index = next0; - } + next0 = l2pm->tx_next_by_rx_sw_if_index[sw_if_index0]; + vnet_buffer (b0)->sw_if_index[VLIB_TX] = + l2pm->tx_sw_if_index_by_rx_sw_if_index[sw_if_index0]; if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE))) { @@ -240,7 +225,7 @@ l2_patch_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (l2_patch_node, static) = { .function = l2_patch_node_fn, - .name = "l2_patch", + .name = "l2-patch", .vector_size = sizeof (u32), .format_trace = format_l2_patch_trace, .type = VLIB_NODE_TYPE_INTERNAL, -- cgit 1.2.3-korg