vppinfra: make _vec_len() read-only
[vpp.git] / src / vnet / vxlan-gpe / vxlan_gpe.h
index b93487b..2cbbb6c 100644 (file)
@@ -24,6 +24,7 @@
 #include <vppinfra/hash.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>
@@ -31,7 +32,7 @@
 #include <vnet/vxlan-gpe/vxlan_gpe_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>
 
@@ -63,7 +64,7 @@ typedef CLIB_PACKED (struct {
 
 /**
  * @brief Key struct for IPv4 VXLAN GPE tunnel.
- * Key fields: local remote, vni
+ * Key fields: local remote, vni, udp-port
  * all fields in NET byte order
  * VNI shifted 8 bits
  */
@@ -75,7 +76,7 @@ typedef CLIB_PACKED(struct {
       u32 remote;
 
       u32 vni;
-      u32 pad;
+      u32 port;
     };
     u64 as_u64[2];
   };
@@ -84,7 +85,7 @@ typedef CLIB_PACKED(struct {
 
 /**
  * @brief Key struct for IPv6 VXLAN GPE tunnel.
- * Key fields: local remote, vni
+ * Key fields: local remote, vni, udp-port
  * all fields in NET byte order
  * VNI shifted 8 bits
  */
@@ -93,9 +94,21 @@ typedef CLIB_PACKED(struct {
   ip6_address_t local;
   ip6_address_t remote;
   u32 vni;
+  u32 port;
 }) vxlan6_gpe_tunnel_key_t;
 /* *INDENT-ON* */
 
+typedef union
+{
+  struct
+  {
+    u32 tunnel_index;
+    u16 next_index;
+    u8 error;
+  };
+  u64 as_u64;
+} vxlan_gpe_decap_info_t;
+
 /**
  * @brief Struct for VXLAN GPE tunnel
  */
@@ -116,6 +129,10 @@ typedef struct
   ip46_address_t local;
   /** tunnel remote address */
   ip46_address_t remote;
+  /** local udp-port **/
+  u16 local_port;
+  /** remote udp-port **/
+  u16 remote_port;
 
   /* mcast packet output intfc index (used only if dst is mcast) */
   u32 mcast_sw_if_index;
@@ -205,8 +222,7 @@ typedef struct
 
   /* 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 */
   /** Free vlib hw_if_indices */
@@ -220,6 +236,9 @@ typedef struct
   /** State convenience vnet_main_t */
   vnet_main_t *vnet_main;
 
+  /* cache for last 8 vxlan_gpe tunnel */
+  vtep4_cache_t vtep4_u512;
+
   /** List of next nodes for the decap indexed on protocol */
   uword decap_next_node_list[VXLAN_GPE_PROTOCOL_MAX];
 } vxlan_gpe_main_t;
@@ -243,6 +262,8 @@ typedef struct
   u32 encap_fib_index;
   u32 decap_fib_index;
   u32 vni;
+  u16 local_port;
+  u16 remote_port;
 } vnet_vxlan_gpe_add_del_tunnel_args_t;