Remove unused argument from eth_identify_subint(...)
[vpp.git] / src / vnet / ethernet / ethernet.h
index 0bfd487..ceaadd2 100644 (file)
 #include <vnet/pg/pg.h>
 #include <vnet/feature/feature.h>
 
+/* ethernet-input frame flags and scalar data */
+
+/* all packets in frame share same sw_if_index */
+#define ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX (1 << 0)
+
+/* all ip4 packets in frame have correct ip4 checksum */
+#define ETH_INPUT_FRAME_F_IP4_CKSUM_OK (1 << 1)
+
+typedef struct
+{
+  u32 sw_if_index;
+  u32 hw_if_index;
+} ethernet_input_frame_t;
+
 always_inline u64
-ethernet_mac_address_u64 (u8 * a)
+ethernet_mac_address_u64 (const u8 * a)
 {
   return (((u64) a[0] << (u64) (5 * 8))
          | ((u64) a[1] << (u64) (4 * 8))
@@ -55,6 +69,18 @@ ethernet_mac_address_u64 (u8 * a)
          | ((u64) a[4] << (u64) (1 * 8)) | ((u64) a[5] << (u64) (0 * 8)));
 }
 
+always_inline void
+ethernet_mac_address_from_u64 (u64 u, u8 * a)
+{
+  i8 ii;
+
+  for (ii = 5; ii >= 0; ii--)
+    {
+      a[ii] = u & 0xFF;
+      u = u >> 8;
+    }
+}
+
 static inline int
 ethernet_mac_address_is_multicast_u64 (u64 a)
 {
@@ -62,7 +88,7 @@ ethernet_mac_address_is_multicast_u64 (u64 a)
 }
 
 static inline int
-ethernet_mac_address_is_zero (u8 * mac)
+ethernet_mac_address_is_zero (const u8 * mac)
 {
   return ((*((u32 *) mac) == 0) && (*((u16 *) (mac + 4)) == 0));
 }
@@ -142,6 +168,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)
@@ -490,7 +517,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,
@@ -517,13 +543,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;
 
@@ -541,7 +567,7 @@ matched:
 
 // Compare two ethernet macs. Return 1 if they are the same, 0 if different
 always_inline u32
-eth_mac_equal (u8 * mac1, u8 * mac2)
+eth_mac_equal (const u8 * mac1, const u8 * mac2)
 {
   return (*((u32 *) (mac1 + 0)) == *((u32 *) (mac2 + 0)) &&
          *((u32 *) (mac1 + 2)) == *((u32 *) (mac2 + 2)));