summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/lisp-gpe/lisp_gpe.h
diff options
context:
space:
mode:
Diffstat (limited to 'vnet/vnet/lisp-gpe/lisp_gpe.h')
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.h122
1 files changed, 96 insertions, 26 deletions
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.h b/vnet/vnet/lisp-gpe/lisp_gpe.h
index 12c4ebce38c..7e86d57fc1a 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.h
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
+ * Copyright (c) 2016 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -12,18 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#ifndef included_vnet_lisp_gpe_h
#define included_vnet_lisp_gpe_h
#include <vppinfra/error.h>
-#include <vppinfra/hash.h>
+#include <vppinfra/mhash.h>
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/l2/l2_input.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/lisp-gpe/lisp_gpe_packet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/udp.h>
+#include <vnet/lisp-cp/lisp_types.h>
+#include <vnet/lisp-gpe/lisp_gpe_packet.h>
+
+#define IP_UDP_HDR_LEN (word) (sizeof(udp_header_t) + sizeof(ip4_header_t))
typedef CLIB_PACKED (struct {
ip4_header_t ip4; /* 20 bytes */
@@ -31,21 +35,22 @@ typedef CLIB_PACKED (struct {
lisp_gpe_header_t lisp; /* 8 bytes */
}) ip4_udp_lisp_gpe_header_t;
-typedef CLIB_PACKED(struct {
- /*
- * Key fields: ip src, LISP iid, ??? $$$$$$$$$ correct answer ???
- * all fields in NET byte order
- */
- union {
- struct {
- u32 src;
- u32 iid;
- };
- u64 as_u64[1];
+typedef struct
+{
+ union
+ {
+ struct
+ {
+ gid_address_t eid;
+ u32 dst_loc;
+ u32 iid;
+ };
+ u8 as_u8[6];
};
-}) lisp_gpe_tunnel_key_t;
+} lisp_gpe_tunnel_key_t;
-typedef struct {
+typedef struct
+{
/* Rewrite string. $$$$ embed vnet_rewrite header */
u8 * rewrite;
@@ -93,30 +98,53 @@ typedef enum {
LISP_GPE_N_ERROR,
} lisp_gpe_input_error_t;
-typedef struct {
+/* As a first step, reuse v4 fib. The goal of the typedef is to shield
+ * consumers from future updates that may result in the lisp ip4 fib diverging
+ * from ip4 fib */
+typedef ip4_fib_t lisp_ip4_fib_t;
+
+typedef struct lisp_gpe_main
+{
+ /* Pool of src fibs that are paired with dst fibs */
+ ip4_fib_t * src_fibs;
+
/* vector of encap tunnel instances */
- lisp_gpe_tunnel_t *tunnels;
+ lisp_gpe_tunnel_t * tunnels;
/* lookup tunnel by key */
- uword * lisp_gpe_tunnel_by_key;
+ mhash_t lisp_gpe_tunnel_by_key;
+
+ /* lookup tunnel by adjacency index */
+ uword * lisp_gpe_tunnel_by_adj_index;
/* Free vlib hw_if_indices */
u32 * free_lisp_gpe_tunnel_hw_if_indices;
+ u32 lisp_gpe_hw_if_index;
+
+ /* next node indexes that points ip4 lookup to lisp gpe lookup and lisp cp */
+ u32 ip4_lookup_next_lgpe_ip4_lookup;
+
/* convenience */
vlib_main_t * vlib_main;
vnet_main_t * vnet_main;
+ ip_lookup_main_t * lookup_main;
+ ip4_main_t * im4;
} lisp_gpe_main_t;
lisp_gpe_main_t lisp_gpe_main;
+extern vlib_node_registration_t lgpe_ip4_lookup_node;
extern vlib_node_registration_t lisp_gpe_input_node;
extern vlib_node_registration_t lisp_gpe_encap_node;
-u8 * format_lisp_gpe_encap_trace (u8 * s, va_list * args);
-u8 * format_lisp_gpe_header_with_length (u8 * s, va_list * args);
+u8 *
+format_lisp_gpe_encap_trace (u8 * s, va_list * args);
+u8 *
+format_lisp_gpe_header_with_length (u8 * s, va_list * args);
-typedef struct {
+typedef struct
+{
u8 is_add;
ip4_address_t src, dst;
u32 encap_fib_index;
@@ -126,12 +154,54 @@ typedef struct {
u8 ver_res;
u8 res;
u8 next_protocol;
- u32 iid; /* host byte order */
+ u32 iid; /* host byte order */
} vnet_lisp_gpe_add_del_tunnel_args_t;
-int vnet_lisp_gpe_add_del_tunnel
-(vnet_lisp_gpe_add_del_tunnel_args_t *a, u32 * sw_if_indexp);
+int
+vnet_lisp_gpe_add_del_tunnel (vnet_lisp_gpe_add_del_tunnel_args_t *a,
+ u32 * sw_if_indexp);
+
+typedef struct
+{
+ u8 is_add;
+} vnet_lisp_gpe_add_del_iface_args_t;
+
+void
+vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t *a,
+ u32 * hw_if_indexp);
+
+typedef enum
+{
+ NO_ACTION,
+ FORWARD_NATIVE,
+ SEND_MAP_REQUEST,
+ DROP
+} negative_fwd_actions_e;
+
+typedef struct
+{
+ u8 is_add;
+ u8 is_negative;
+ negative_fwd_actions_e action;
+ gid_address_t seid; /* TODO convert to ip4, ip6, mac ? */
+ gid_address_t deid;
+ ip_address_t slocator;
+ ip_address_t dlocator;
+ u32 encap_fib_index;
+ u32 decap_fib_index;
+ u32 decap_next_index;
+ u8 flags;
+ u8 ver_res;
+ u8 res;
+ u8 next_protocol;
+ u32 iid; /* host byte order */
+} vnet_lisp_gpe_add_del_fwd_entry_args_t;
+
+int
+vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t *a,
+ u32 * hw_if_indexp);
-u8 * format_lisp_gpe_header_with_length (u8 * s, va_list * args);
+u8 *
+format_lisp_gpe_header_with_length (u8 * s, va_list * args);
#endif /* included_vnet_lisp_gpe_h */