geneve gtpu vxlan vxlan-gpe: VRF-aware bypass node
[vpp.git] / src / plugins / gtpu / gtpu.h
index 744d21d..6a758ee 100644 (file)
@@ -23,6 +23,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>
@@ -55,13 +56,15 @@ typedef struct
 {
   u8 ver_flags;
   u8 type;
-  u16 length;                  /* length in octets of the payload */
+  u16 length;                  /* length in octets of the data following the fixed part of the header */
   u32 teid;
   u16 sequence;
   u8 pdu_number;
   u8 next_ext_type;
 } gtpu_header_t;
 
+#define GTPU_V1_HDR_LEN   8
+
 #define GTPU_VER_MASK (7<<5)
 #define GTPU_PT_BIT   (1<<4)
 #define GTPU_E_BIT    (1<<2)
@@ -79,7 +82,7 @@ typedef CLIB_PACKED(struct
 {
   ip4_header_t ip4;            /* 20 bytes */
   udp_header_t udp;            /* 8 bytes */
-  gtpu_header_t gtpu;         /* 8 bytes */
+  gtpu_header_t gtpu;         /* 12 bytes */
 }) ip4_gtpu_header_t;
 /* *INDENT-ON* */
 
@@ -123,6 +126,9 @@ typedef CLIB_PACKED
 
 typedef struct
 {
+  /* Required for pool_get_aligned  */
+  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+
   /* Rewrite string */
   u8 *rewrite;
 
@@ -168,6 +174,8 @@ typedef struct
    * The tunnels sibling index on the FIB entry's dependency list.
    */
   u32 sibling_index;
+
+  u32 flow_index;              /* infra flow index */
 } gtpu_tunnel_t;
 
 #define foreach_gtpu_input_next        \
@@ -203,8 +211,7 @@ typedef struct
 
   /* local VTEP IPs ref count used by gtpu-bypass node to check if
      received gtpu 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 */
@@ -226,21 +233,22 @@ typedef struct
   /* convenience */
   vlib_main_t *vlib_main;
   vnet_main_t *vnet_main;
+  u32 flow_id_start;
 } gtpu_main_t;
 
-gtpu_main_t gtpu_main;
+extern gtpu_main_t gtpu_main;
 
 extern vlib_node_registration_t gtpu4_input_node;
 extern vlib_node_registration_t gtpu6_input_node;
 extern vlib_node_registration_t gtpu4_encap_node;
 extern vlib_node_registration_t gtpu6_encap_node;
+extern vlib_node_registration_t gtpu4_flow_input_node;
 
 u8 *format_gtpu_encap_trace (u8 * s, va_list * args);
 
 typedef struct
 {
   u8 is_add;
-  u8 is_ip6;
   ip46_address_t src, dst;
   u32 mcast_sw_if_index;
   u32 encap_fib_index;
@@ -251,7 +259,16 @@ typedef struct
 int vnet_gtpu_add_del_tunnel
   (vnet_gtpu_add_del_tunnel_args_t * a, u32 * sw_if_indexp);
 
+typedef struct
+{
+  u32 tunnel_index;
+  u32 teid;
+} gtpu_encap_trace_t;
+
 void vnet_int_gtpu_bypass_mode (u32 sw_if_index, u8 is_ip6, u8 is_enable);
+u32 vnet_gtpu_get_tunnel_index (u32 sw_if_index);
+int vnet_gtpu_add_del_rx_flow (u32 hw_if_index, u32 t_imdex, int is_add);
+
 #endif /* included_vnet_gtpu_h */