#include <vnet/pg/pg.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ethernet/p2p_ethernet.h>
+#include <vnet/devices/pipe/pipe.h>
#include <vppinfra/sparse_vec.h>
#include <vnet/l2/l2_bvi.h>
}
else if (is_l20)
{
- *next0 = em->l2_next;
// record the L2 len and reset the buffer so the L2 header is preserved
u32 eth_start = vnet_buffer (b0)->l2_hdr_offset;
vnet_buffer (b0)->l2.l2_len = b0->current_data - eth_start;
+ *next0 = em->l2_next;
ASSERT (vnet_buffer (b0)->l2.l2_len ==
ethernet_buffer_header_size (b0));
vlib_buffer_advance (b0, -ethernet_buffer_header_size (b0));
}
}
-static_always_inline int
-ethernet_frame_is_any_tagged (u16 type0, u16 type1)
-{
-#if __SSE4_2__
- const __m128i ethertype_mask = _mm_set_epi16 (ETHERNET_TYPE_VLAN,
- ETHERNET_TYPE_DOT1AD,
- ETHERNET_TYPE_VLAN_9100,
- ETHERNET_TYPE_VLAN_9200,
- /* duplicate for type1 */
- ETHERNET_TYPE_VLAN,
- ETHERNET_TYPE_DOT1AD,
- ETHERNET_TYPE_VLAN_9100,
- ETHERNET_TYPE_VLAN_9200);
-
- __m128i r =
- _mm_set_epi16 (type0, type0, type0, type0, type1, type1, type1, type1);
- r = _mm_cmpeq_epi16 (ethertype_mask, r);
- return !_mm_test_all_zeros (r, r);
-#else
- return ethernet_frame_is_tagged (type0) || ethernet_frame_is_tagged (type1);
-#endif
-}
-
static_always_inline uword
ethernet_input_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_node_runtime_t *error_node;
u32 n_left_from, next_index, *from, *to_next;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 cached_sw_if_index = ~0;
u32 cached_is_l2 = 0; /* shut up gcc */
vnet_hw_interface_t *hi = NULL; /* used for main interface only */
/* Speed-path for the untagged case */
if (PREDICT_TRUE (variant == ETHERNET_INPUT_VARIANT_ETHERNET
- && !ethernet_frame_is_any_tagged (type0, type1)))
+ && !ethernet_frame_is_any_tagged_x2 (type0,
+ type1)))
{
main_intf_t *intf0;
subint_config_t *subint0;
(hi->hw_address != 0) &&
!eth_mac_equal ((u8 *) e1, hi->hw_address))
error1 = ETHERNET_ERROR_L3_MAC_MISMATCH;
+ vlib_buffer_advance (b0, sizeof (ethernet_header_t));
determine_next_node (em, variant, 0, type0, b0,
&error0, &next0);
- vlib_buffer_advance (b0, sizeof (ethernet_header_t));
+ vlib_buffer_advance (b1, sizeof (ethernet_header_t));
determine_next_node (em, variant, 0, type1, b1,
&error1, &next1);
- vlib_buffer_advance (b1, sizeof (ethernet_header_t));
}
goto ship_it01;
}
return from_frame->n_vectors;
}
-static uword
-ethernet_input (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (ethernet_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return ethernet_input_inline (vm, node, from_frame,
ETHERNET_INPUT_VARIANT_ETHERNET);
}
-static uword
-ethernet_input_type (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (ethernet_input_type_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return ethernet_input_inline (vm, node, from_frame,
ETHERNET_INPUT_VARIANT_ETHERNET_TYPE);
}
-static uword
-ethernet_input_not_l2 (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * from_frame)
+VLIB_NODE_FN (ethernet_input_not_l2_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
{
return ethernet_input_inline (vm, node, from_frame,
ETHERNET_INPUT_VARIANT_NOT_L2);
subint = vec_elt_at_index (p2pm->p2p_subif_pool, si->p2p.pool_index);
*flags = SUBINT_CONFIG_P2P;
}
+ else if (si->type == VNET_SW_INTERFACE_TYPE_PIPE)
+ {
+ pipe_t *pipe;
+
+ pipe = pipe_get (sw_if_index);
+ subint = &pipe->subint;
+ *flags = SUBINT_CONFIG_P2P;
+ }
else if (si->sub.eth.flags.default_sub)
{
subint = &main_intf->default_subint;
return subint;
}
-clib_error_t *
+static clib_error_t *
ethernet_sw_interface_up_down (vnet_main_t * vnm, u32 sw_if_index, u32 flags)
{
subint_config_t *subint;
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION (ethernet_sw_interface_up_down);
+#ifndef CLIB_MARCH_VARIANT
// Set the L2/L3 mode for the subinterface
void
ethernet_sw_interface_set_l2_mode (vnet_main_t * vnm, u32 sw_if_index, u32 l2)
done:
return;
}
+#endif
static clib_error_t *
ethernet_sw_interface_add_del (vnet_main_t * vnm,
}
else
{
- // Note that config is L3 by defaulty
+ // Note that config is L3 by default
subint->flags = SUBINT_CONFIG_VALID | match_flags;
subint->sw_if_index = ~0; // because interfaces are initially down
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ethernet_input_node) = {
- .function = ethernet_input,
.name = "ethernet-input",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
.format_trace = format_ethernet_input_trace,
.unformat_buffer = unformat_ethernet_header,
};
-/* *INDENT-ON* */
-
-/* *INDENT-OFF* */
-VLIB_NODE_FUNCTION_MULTIARCH (ethernet_input_node, ethernet_input)
-/* *INDENT-ON* */
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ethernet_input_type_node, static) = {
- .function = ethernet_input_type,
+VLIB_REGISTER_NODE (ethernet_input_type_node) = {
.name = "ethernet-input-type",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
#undef _
},
};
-/* *INDENT-ON* */
-
-/* *INDENT-OFF* */
-VLIB_NODE_FUNCTION_MULTIARCH (ethernet_input_type_node, ethernet_input_type)
-/* *INDENT-ON* */
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ethernet_input_not_l2_node, static) = {
- .function = ethernet_input_not_l2,
+VLIB_REGISTER_NODE (ethernet_input_not_l2_node) = {
.name = "ethernet-input-not-l2",
/* Takes a vector of packets. */
.vector_size = sizeof (u32),
};
/* *INDENT-ON* */
-
-/* *INDENT-OFF* */
-VLIB_NODE_FUNCTION_MULTIARCH (ethernet_input_not_l2_node,
- ethernet_input_not_l2)
-/* *INDENT-ON* */
-
-
+#ifndef CLIB_MARCH_VARIANT
void
ethernet_set_rx_redirect (vnet_main_t * vnm,
vnet_hw_interface_t * hi, u32 enable)
ASSERT (i == em->redirect_l3_next);
}
+#endif
/*
* fd.io coding-style-patch-verification: ON