vxlan: multiarch optimization of vxlan
[vpp.git] / src / vnet / vxlan-gbp / vxlan_gbp.h
index 6580f38..fe93587 100644 (file)
@@ -28,7 +28,8 @@
 #include <vnet/vxlan-gbp/vxlan_gbp_packet.h>
 #include <vnet/ip/ip4_packet.h>
 #include <vnet/ip/ip6_packet.h>
-#include <vnet/udp/udp.h>
+#include <vnet/udp/udp_local.h>
+#include <vnet/udp/udp_packet.h>
 #include <vnet/dpo/dpo.h>
 #include <vnet/adj/adj_types.h>
 
@@ -127,7 +128,8 @@ typedef struct
   u32 dev_instance;            /* Real device instance in tunnel vector */
   u32 user_instance;           /* Instance name being shown to user */
 
-    vnet_declare_rewrite (VLIB_BUFFER_PRE_DATA_SIZE);
+
+    VNET_DECLARE_REWRITE;
 } vxlan_gbp_tunnel_t;
 
 #define foreach_vxlan_gbp_input_next         \
@@ -226,6 +228,17 @@ int vnet_vxlan_gbp_tunnel_del (u32 sw_if_indexp);
 void vnet_int_vxlan_gbp_bypass_mode (u32 sw_if_index, u8 is_ip6,
                                     u8 is_enable);
 
+always_inline u32
+vxlan_gbp_tunnel_by_sw_if_index (u32 sw_if_index)
+{
+  vxlan_gbp_main_t *vxm = &vxlan_gbp_main;
+
+  if (sw_if_index >= vec_len (vxm->tunnel_index_by_sw_if_index))
+    return ~0;
+
+  return (vxm->tunnel_index_by_sw_if_index[sw_if_index]);
+}
+
 #endif /* included_vnet_vxlan_gbp_h */
 
 /*