LISP: make TTL for map register messages configurable
[vpp.git] / src / vnet / lisp-cp / control.h
index ad90b52..d030e58 100644 (file)
@@ -19,6 +19,7 @@
 #include <vnet/vnet.h>
 #include <vnet/lisp-cp/gid_dictionary.h>
 #include <vnet/lisp-cp/lisp_types.h>
+#include <vppinfra/timing_wheel.h>
 
 #define NUMBER_OF_RETRIES                   1
 #define PENDING_MREQ_EXPIRATION_TIME        3.0        /* seconds */
@@ -36,8 +37,8 @@
 /* normal map-register period */
 #define MAP_REGISTER_INTERVAL               60.0
 
-/* 15 minutes */
-#define MAP_REGISTER_DEFAULT_TTL            900
+/* 24 hours */
+#define MAP_REGISTER_DEFAULT_TTL            86400
 
 typedef struct
 {
@@ -124,6 +125,14 @@ typedef struct
   u32 bd;
 } lisp_l2_arp_key_t;
 
+typedef struct
+{
+  u64 nonce;
+  u8 is_rloc_probe;
+  mapping_t *mappings;
+  volatile u8 is_free;
+} map_records_arg_t;
+
 typedef struct
 {
   u32 flags;
@@ -226,6 +235,12 @@ typedef struct
   /* timing wheel for mappping timeouts */
   timing_wheel_t wheel;
 
+  /** Per thread pool of records shared with thread0 */
+  map_records_arg_t **map_records_args_pool;
+
+  /* TTL used for all mappings when registering */
+  u32 map_register_ttl;
+
   /* commodity */
   ip4_main_t *im4;
   ip6_main_t *im6;
@@ -288,13 +303,6 @@ typedef struct
   u8 key_id;
 } vnet_lisp_add_del_mapping_args_t;
 
-typedef struct
-{
-  u64 nonce;
-  u8 is_rloc_probe;
-  mapping_t *mappings;
-} map_records_arg_t;
-
 int
 vnet_lisp_map_cache_add_del (vnet_lisp_add_del_mapping_args_t * a,
                             u32 * map_index);
@@ -357,6 +365,8 @@ int vnet_lisp_add_del_l2_arp_entry (gid_address_t * key, u8 * mac, u8 is_add);
 u32 *vnet_lisp_l2_arp_bds_get (void);
 lisp_api_l2_arp_entry_t *vnet_lisp_l2_arp_entries_get_by_bd (u32 bd);
 int vnet_lisp_nsh_set_locator_set (u8 * locator_set_name, u8 is_add);
+int vnet_lisp_map_register_set_ttl (u32 ttl);
+u32 vnet_lisp_map_register_get_ttl (void);
 
 map_records_arg_t *parse_map_reply (vlib_buffer_t * b);