X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvnet%2Fethernet%2Fethernet.h;h=94322a715f9ae4438c9d3070821e877fff4f11e2;hb=192b13f96;hp=9a23448b3e60cfb60e89a553912f9be2d69c25d8;hpb=de5b08fb302e84142e4ba0cf0cbed4e740e4165c;p=vpp.git diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h index 9a23448b3e6..94322a715f9 100644 --- a/src/vnet/ethernet/ethernet.h +++ b/src/vnet/ethernet/ethernet.h @@ -42,42 +42,23 @@ #include #include +#include #include #include -always_inline u64 -ethernet_mac_address_u64 (const u8 * a) -{ - return (((u64) a[0] << (u64) (5 * 8)) - | ((u64) a[1] << (u64) (4 * 8)) - | ((u64) a[2] << (u64) (3 * 8)) - | ((u64) a[3] << (u64) (2 * 8)) - | ((u64) a[4] << (u64) (1 * 8)) | ((u64) a[5] << (u64) (0 * 8))); -} +/* ethernet-input frame flags and scalar data */ -always_inline void -ethernet_mac_address_from_u64 (u64 u, u8 * a) -{ - i8 ii; +/* all packets in frame share same sw_if_index */ +#define ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX (1 << 0) - for (ii = 5; ii >= 0; ii--) - { - a[ii] = u & 0xFF; - u = u >> 8; - } -} +/* all ip4 packets in frame have correct ip4 checksum */ +#define ETH_INPUT_FRAME_F_IP4_CKSUM_OK (1 << 1) -static inline int -ethernet_mac_address_is_multicast_u64 (u64 a) -{ - return (a & (1ULL << (5 * 8))) != 0; -} - -static inline int -ethernet_mac_address_is_zero (const u8 * mac) +typedef struct { - return ((*((u32 *) mac) == 0) && (*((u16 *) (mac + 4)) == 0)); -} + u32 sw_if_index; + u32 hw_if_index; +} ethernet_input_frame_t; #ifdef CLIB_HAVE_VEC128 static const u16x8 tagged_ethertypes = { @@ -154,6 +135,7 @@ typedef u32 (ethernet_flag_change_function_t) /* Ethernet interface instance. */ typedef struct ethernet_interface { + u32 flags; /* Accept all packets (promiscuous mode). */ #define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL (1 << 0) @@ -332,7 +314,7 @@ ethernet_interface_t *ethernet_get_interface (ethernet_main_t * em, clib_error_t *ethernet_register_interface (vnet_main_t * vnm, u32 dev_class_index, u32 dev_instance, - u8 * address, + const u8 * address, u32 * hw_if_index_return, ethernet_flag_change_function_t flag_change); @@ -502,7 +484,6 @@ eth_vlan_table_lookups (ethernet_main_t * em, // Returns 1 if a matching subinterface was found, otherwise returns 0. always_inline u32 eth_identify_subint (vnet_hw_interface_t * hi, - vlib_buffer_t * b0, u32 match_flags, main_intf_t * main_intf, vlan_intf_t * vlan_intf, @@ -529,13 +510,13 @@ eth_identify_subint (vnet_hw_interface_t * hi, if ((subint->flags & match_flags) == match_flags) goto matched; - // check for untagged interface - subint = &main_intf->untagged_subint; + // check for default interface + subint = &main_intf->default_subint; if ((subint->flags & match_flags) == match_flags) goto matched; - // check for default interface - subint = &main_intf->default_subint; + // check for untagged interface + subint = &main_intf->untagged_subint; if ((subint->flags & match_flags) == match_flags) goto matched; @@ -551,42 +532,12 @@ matched: return 1; } -// Compare two ethernet macs. Return 1 if they are the same, 0 if different -always_inline u32 -eth_mac_equal (u8 * mac1, u8 * mac2) -{ - return (*((u32 *) (mac1 + 0)) == *((u32 *) (mac2 + 0)) && - *((u32 *) (mac1 + 2)) == *((u32 *) (mac2 + 2))); -} - - always_inline ethernet_main_t * vnet_get_ethernet_main (void) { return ðernet_main; } -void vnet_register_ip4_arp_resolution_event (vnet_main_t * vnm, - void *address_arg, - uword node_index, - uword type_opaque, uword data); - - -int vnet_add_del_ip4_arp_change_event (vnet_main_t * vnm, - void *data_callback, - u32 pid, - void *address_arg, - uword node_index, - uword type_opaque, - uword data, int is_add); - -void wc_arp_set_publisher_node (uword inode_index, uword event_type); - -void ethernet_arp_change_mac (u32 sw_if_index); -void ethernet_ndp_change_mac (u32 sw_if_index); - -void arp_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai); - void ethernet_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai); u8 *ethernet_build_rewrite (vnet_main_t * vnm, u32 sw_if_index, @@ -596,13 +547,6 @@ const u8 *ethernet_ip6_mcast_dst_addr (void); extern vlib_node_registration_t ethernet_input_node; -typedef struct -{ - u32 sw_if_index; - u32 ip4; - u8 mac[6]; -} wc_arp_report_t; - #endif /* included_ethernet_h */ /*