From 4c6b34f742d7478f8f8f862c05a33ba43b2c8699 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 23 Nov 2016 23:26:47 +0100 Subject: l2: remove unused l3 packet type discovery in l2 path This costs significant amount of cycles and it is not used by anybody. Change-Id: I42a0306aa7c254292621bdaa09b736421662d540 Signed-off-by: Damjan Marion --- vnet/vnet/l2/l2_input.c | 39 +-------------------------------------- vnet/vnet/l2/l2_input.h | 40 ---------------------------------------- 2 files changed, 1 insertion(+), 78 deletions(-) diff --git a/vnet/vnet/l2/l2_input.c b/vnet/vnet/l2/l2_input.c index 9515250d..dfb7bce2 100644 --- a/vnet/vnet/l2/l2_input.c +++ b/vnet/vnet/l2/l2_input.c @@ -159,45 +159,8 @@ classify_and_dispatch (vlib_main_t * vm, h0 = vlib_buffer_get_current (b0); l3h0 = (u8 *) h0 + vnet_buffer (b0)->l2.l2_len; - /* - * Determine L3 packet type. Only need to check the common types. - * Used to filter out features that don't apply to common packets. - */ ethertype = clib_net_to_host_u16 (get_u16 (l3h0 - 2)); - if (ethertype == ETHERNET_TYPE_IP4) - { - protocol = ((ip4_header_t *) l3h0)->protocol; - if ((protocol == IP_PROTOCOL_UDP) || (protocol == IP_PROTOCOL_TCP)) - { - feat_mask = IP_UDP_TCP_FEAT_MASK; - } - else - { - feat_mask = IP4_FEAT_MASK; - } - } - else if (ethertype == ETHERNET_TYPE_IP6) - { - protocol = ((ip6_header_t *) l3h0)->protocol; - /* Don't bother checking for extension headers for now */ - if ((protocol == IP_PROTOCOL_UDP) || (protocol == IP_PROTOCOL_TCP)) - { - feat_mask = IP_UDP_TCP_FEAT_MASK; - } - else - { - feat_mask = IP6_FEAT_MASK; - } - } - else if (ethertype == ETHERNET_TYPE_MPLS_UNICAST) - { - feat_mask = IP6_FEAT_MASK; - } - else - { - /* allow all features */ - feat_mask = ~0; - } + feat_mask = ~0; /* determine layer2 kind for stat and mask */ mcast_dmac = ethernet_address_cast (h0->dst_address); diff --git a/vnet/vnet/l2/l2_input.h b/vnet/vnet/l2/l2_input.h index b4e90af5..f3fada6a 100644 --- a/vnet/vnet/l2/l2_input.h +++ b/vnet/vnet/l2/l2_input.h @@ -95,7 +95,6 @@ l2input_bd_config_from_index (l2input_main_t * l2im, u32 bd_index) #define foreach_l2input_feat \ _(DROP, "feature-bitmap-drop") \ _(XCONNECT, "l2-output") \ - _(IPIW, "feature-bitmap-drop") \ _(FLOOD, "l2-flood") \ _(ARP_TERM, "arp-term-l2bd") \ _(UU_FLOOD, "l2-flood") \ @@ -104,17 +103,7 @@ l2input_bd_config_from_index (l2input_main_t * l2im, u32 bd_index) _(LEARN, "l2-learn") \ _(VTR, "l2-input-vtr") \ _(VPATH, "vpath-input-l2") \ - _(CTRL_PKT, "feature-bitmap-drop") \ - _(L2PT, "feature-bitmap-drop") \ - _(IGMP_SNOOP, "feature-bitmap-drop") \ - _(MLD_SNOOP, "feature-bitmap-drop") \ - _(DHCP_SNOOP, "feature-bitmap-drop") \ - _(DAI, "feature-bitmap-drop") \ - _(IPSG, "feature-bitmap-drop") \ _(ACL, "l2-input-acl") \ - _(QOS, "feature-bitmap-drop") \ - _(CFM, "feature-bitmap-drop") \ - _(SPAN, "feature-bitmap-drop") \ _(POLICER_CLAS, "l2-policer-classify") \ _(INPUT_CLASSIFY, "l2-input-classify") @@ -175,35 +164,6 @@ bd_feature_arp_term (l2_bridge_domain_t * bd_config) /** Masks for eliminating features that do not apply to a packet */ -#define IP4_FEAT_MASK ~(L2INPUT_FEAT_CTRL_PKT | \ - L2INPUT_FEAT_MLD_SNOOP | \ - L2INPUT_FEAT_L2PT | \ - L2INPUT_FEAT_CFM | \ - L2INPUT_FEAT_DAI) - -#define IP6_FEAT_MASK ~(L2INPUT_FEAT_CTRL_PKT | \ - L2INPUT_FEAT_IGMP_SNOOP | \ - L2INPUT_FEAT_L2PT | \ - L2INPUT_FEAT_CFM | \ - L2INPUT_FEAT_DAI) - -#define IP_UDP_TCP_FEAT_MASK ~(L2INPUT_FEAT_CTRL_PKT | \ - L2INPUT_FEAT_L2PT | \ - L2INPUT_FEAT_IGMP_SNOOP | \ - L2INPUT_FEAT_MLD_SNOOP | \ - L2INPUT_FEAT_DHCP_SNOOP | \ - L2INPUT_FEAT_CFM | \ - L2INPUT_FEAT_DAI) - -#define MPLS_FEAT_MASK ~(L2INPUT_FEAT_CTRL_PKT | \ - L2INPUT_FEAT_L2PT | \ - L2INPUT_FEAT_IGMP_SNOOP | \ - L2INPUT_FEAT_MLD_SNOOP | \ - L2INPUT_FEAT_DHCP_SNOOP | \ - L2INPUT_FEAT_CFM | \ - L2INPUT_FEAT_DAI) - - /** Get a pointer to the config for the given interface */ l2_input_config_t *l2input_intf_config (u32 sw_if_index); -- cgit 1.2.3-korg