aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/node.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-02-19 12:14:06 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-02-19 20:14:30 +0000
commitc6969b55e40613479183141c01f057f9253f17a8 (patch)
tree0c2eea7ee2ede18e81255f42e00b62ad8540da43 /src/vnet/ethernet/node.c
parent829ee5399504478901be245914333fdf704131c2 (diff)
Use neutral vector code for ethernet_frame_is_tagged
Also it removes ethernet_frame_is_any_taged implemebntation which seems to be equally costly compared to two invocations of ethernet_frame_is_tagged. Change-Id: If1c95f8267cd34b807ec07e0d675cbd0db2fdf9f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/ethernet/node.c')
-rwxr-xr-xsrc/vnet/ethernet/node.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 3b85483732c..d13af57a1df 100755
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -285,30 +285,6 @@ determine_next_node (ethernet_main_t * em,
}
}
-static_always_inline int
-ethernet_frame_is_any_tagged (u16 type0, u16 type1)
-{
-#if __SSE4_2__
- const __m128i ethertype_mask = _mm_set_epi16 ((u16) ETHERNET_TYPE_VLAN,
- (u16) ETHERNET_TYPE_DOT1AD,
- (u16) ETHERNET_TYPE_VLAN_9100,
- (u16) ETHERNET_TYPE_VLAN_9200,
- /* duplicate for type1 */
- (u16) ETHERNET_TYPE_VLAN,
- (u16) ETHERNET_TYPE_DOT1AD,
- (u16) ETHERNET_TYPE_VLAN_9100,
- (u16)
- 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,
@@ -401,7 +377,8 @@ ethernet_input_inline (vlib_main_t * vm,
/* 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;