vxlan: Fix L3 mode
[vpp.git] / src / vnet / vxlan / vxlan.h
index e8fc15b..be819ab 100644 (file)
@@ -21,6 +21,7 @@
 #include <vppinfra/bihash_24_8.h>
 #include <vnet/vnet.h>
 #include <vnet/ip/ip.h>
+#include <vnet/ip/vtep.h>
 #include <vnet/l2/l2_input.h>
 #include <vnet/l2/l2_output.h>
 #include <vnet/l2/l2_bd.h>
@@ -28,7 +29,7 @@
 #include <vnet/vxlan/vxlan_packet.h>
 #include <vnet/ip/ip4_packet.h>
 #include <vnet/ip/ip6_packet.h>
-#include <vnet/udp/udp.h>
+#include <vnet/udp/udp_packet.h>
 #include <vnet/dpo/dpo.h>
 #include <vnet/adj/adj_types.h>
 
@@ -92,6 +93,10 @@ typedef struct
   ip46_address_t src;
   ip46_address_t dst;
 
+  /* udp-ports */
+  u16 src_port;
+  u16 dst_port;
+
   /* mcast packet output intfc index (used only if dst is mcast) */
   u32 mcast_sw_if_index;
 
@@ -158,13 +163,14 @@ typedef struct
   vxlan_tunnel_t *tunnels;
 
   /* lookup tunnel by key */
-  clib_bihash_16_8_t vxlan4_tunnel_by_key;     /* keyed on ipv4.dst + fib + vni */
-  clib_bihash_24_8_t vxlan6_tunnel_by_key;     /* keyed on ipv6.dst + fib + vni */
+  clib_bihash_16_8_t
+    vxlan4_tunnel_by_key; /* keyed on ipv4.dst + src_port + fib + vni */
+  clib_bihash_24_8_t
+    vxlan6_tunnel_by_key; /* keyed on ipv6.dst + src_port + fib + vni */
 
   /* local VTEP IPs ref count used by vxlan-bypass node to check if
      received VXLAN packet DIP matches any local VTEP address */
-  uword *vtep4;                        /* local ip4 VTEPs keyed on their ip4 addr */
-  uword *vtep6;                        /* local ip6 VTEPs keyed on their ip6 addr */
+  vtep_table_t vtep_table;
 
   /* mcast shared info */
   uword *mcast_shared;         /* keyed on mcast ip46 addr */
@@ -183,6 +189,12 @@ typedef struct
   /* Record used instances */
   uword *instance_used;
   u32 flow_id_start;
+
+  /* cache for last 8 vxlan tunnel */
+#ifdef CLIB_HAVE_VEC512
+  vtep4_cache_t vtep4_u512;
+#endif
+
 } vxlan_main_t;
 
 extern vxlan_main_t vxlan_main;
@@ -202,12 +214,15 @@ typedef struct
   /* we normally use is_ip4, but since this adds to the
    * structure, this seems less of a breaking change */
   u8 is_ip6;
+  u8 is_l3;
   u32 instance;
   ip46_address_t src, dst;
   u32 mcast_sw_if_index;
   u32 encap_fib_index;
   u32 decap_next_index;
   u32 vni;
+  u16 src_port;
+  u16 dst_port;
 } vnet_vxlan_add_del_tunnel_args_t;
 
 int vnet_vxlan_add_del_tunnel