X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vnet%2Fvnet%2Fethernet%2Fethernet.h;h=1855b9144db5ae4f8b4c832655c8ac59b4633511;hb=c631f2de6dd06b4cbb92bf8398839b882344fd25;hp=be5b99c74b6376d5aa26c0b7f8a5281266dd848b;hpb=e70dcc8676b6b2db74989e43f116bbb200239bf8;p=vpp.git diff --git a/vnet/vnet/ethernet/ethernet.h b/vnet/vnet/ethernet/ethernet.h index be5b99c74b6..1855b9144db 100644 --- a/vnet/vnet/ethernet/ethernet.h +++ b/vnet/vnet/ethernet/ethernet.h @@ -60,6 +60,33 @@ ethernet_mac_address_is_multicast_u64 (u64 a) return (a & (1ULL << (5 * 8))) != 0; } +static_always_inline int +ethernet_frame_is_tagged (u16 type) +{ +#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 last one to + fill register */ + ETHERNET_TYPE_VLAN_9200, + ETHERNET_TYPE_VLAN_9200, + ETHERNET_TYPE_VLAN_9200, + ETHERNET_TYPE_VLAN_9200); + + __m128i r = _mm_set1_epi16 (type); + r = _mm_cmpeq_epi16 (ethertype_mask, r); + return !_mm_test_all_zeros (r, r); +#else + if ((type == ETHERNET_TYPE_VLAN) || + (type == ETHERNET_TYPE_DOT1AD) || + (type == ETHERNET_TYPE_VLAN_9100) || (type == ETHERNET_TYPE_VLAN_9200)) + return 1; +#endif + return 0; +} + /* Max. sized ethernet/vlan header for parsing. */ typedef struct { @@ -371,13 +398,11 @@ void ethernet_set_rx_redirect (vnet_main_t * vnm, vnet_hw_interface_t * hi, int vnet_arp_set_ip4_over_ethernet (vnet_main_t * vnm, - u32 sw_if_index, - u32 fib_index, void *a_arg, int is_static); + u32 sw_if_index, void *a_arg, int is_static); int vnet_arp_unset_ip4_over_ethernet (vnet_main_t * vnm, - u32 sw_if_index, u32 fib_index, - void *a_arg); + u32 sw_if_index, void *a_arg); int vnet_proxy_arp_fib_reset (u32 fib_id); @@ -387,6 +412,7 @@ clib_error_t *next_by_ethertype_register (next_by_ethertype_t * l3_next, int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 * mac_address); int vnet_delete_loopback_interface (u32 sw_if_index); +int vnet_delete_sub_interface (u32 sw_if_index); // Perform ethernet subinterface classification table lookups given // the ports's sw_if_index and fields extracted from the ethernet header. @@ -444,7 +470,7 @@ eth_identify_subint (vnet_hw_interface_t * hi, // Each comparison is checking both the valid flag and the number of tags // (incorporating exact-match/non-exact-match). - // check for specific double tag + // check for specific double tag subint = &qinq_intf->subint; if ((subint->flags & match_flags) == match_flags) goto matched; @@ -454,7 +480,7 @@ eth_identify_subint (vnet_hw_interface_t * hi, if ((subint->flags & match_flags) == match_flags) goto matched; - // check for specific single tag + // check for specific single tag subint = &vlan_intf->single_tag_subint; if ((subint->flags & match_flags) == match_flags) goto matched; @@ -464,7 +490,7 @@ eth_identify_subint (vnet_hw_interface_t * hi, if ((subint->flags & match_flags) == match_flags) goto matched; - // check for default interface + // check for default interface subint = &main_intf->default_subint; if ((subint->flags & match_flags) == match_flags) goto matched; @@ -510,7 +536,7 @@ int vnet_add_del_ip4_arp_change_event (vnet_main_t * vnm, uword type_opaque, uword data, int is_add); -u32 vnet_arp_glean_add (u32 fib_index, void *next_hop_arg); +void ethernet_arp_change_mac (vnet_main_t * vnm, u32 sw_if_index); extern vlib_node_registration_t ethernet_input_node;