#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 */
#define PENDING_MREQ_QUEUE_LEN 5
-#define PENDING_MREG_EXPIRATION_TIME 3.0 /* seconds */
#define RLOC_PROBING_INTERVAL 60.0
/* when map-registration is enabled "quick registration" takes place first.
In this mode ETR sends map-register messages at an increased frequency
until specified message count is reached */
-#define QUICK_MAP_REGISTER_MSG_COUNT 3
+#define QUICK_MAP_REGISTER_MSG_COUNT 5
#define QUICK_MAP_REGISTER_INTERVAL 3.0
/* normal map-register period */
#define MAP_REGISTER_INTERVAL 60.0
-/* 15 minutes */
-#define MAP_REGISTER_DEFAULT_TTL 900
+/* how many tries until next map-server election */
+#define MAX_EXPIRED_MAP_REGISTERS_DEFAULT 3
+
+#define PENDING_MREG_EXPIRATION_TIME 3.0 /* seconds */
+
+/* 24 hours */
+#define MAP_REGISTER_DEFAULT_TTL 86400
typedef struct
{
u8 to_be_removed;
} pending_map_request_t;
+typedef struct
+{
+ f64 time_to_expire;
+} pending_map_register_t;
+
typedef struct
{
gid_address_t leid;
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;
/* hash map of forwarding entries by mapping index */
u32 *fwd_entry_by_mapping_index;
+ /* pool of vectors of rmts per lcl mapping in adjacencies */
+ u32 **lcl_to_rmt_adjacencies;
+
+ /* hash of pool positions of vectors of rmts by lcl mapping index */
+ u32 *lcl_to_rmt_adjs_by_lcl_idx;
+
/* forwarding entries pool */
fwd_entry_t *fwd_entry_pool;
/* pool of pending map requests */
pending_map_request_t *pending_map_requests_pool;
+ /* pool of pending map registers */
+ pending_map_register_t *pending_map_registers_pool;
+
/* hash map of sent map register messages */
uword *map_register_messages_by_nonce;
* since the vector may be modified during request resend/retry procedure
* and break things :-) */
ip_address_t active_map_resolver;
+ ip_address_t active_map_server;
u8 do_map_resolver_election;
+ u8 do_map_server_election;
/* map-request locator set index */
u32 mreq_itr_rlocs;
/* 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;
+
+ /* control variables for map server election */
+ u32 max_expired_map_registers;
+ u32 expired_map_registers;
+
/* commodity */
ip4_main_t *im4;
ip6_main_t *im6;
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);
u32 * map_index_result);
int
-vnet_lisp_add_del_mapping (gid_address_t * deid, locator_t * dlocs, u8 action,
- u8 authoritative, u32 ttl, u8 is_add, u8 is_static,
- u32 * res_map_index);
+vnet_lisp_add_mapping (vnet_lisp_add_del_mapping_args_t * a,
+ locator_t * rlocs, u32 * res_map_index,
+ u8 * is_changed);
+
+int vnet_lisp_del_mapping (gid_address_t * eid, u32 * res_map_index);
typedef struct
{
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);
+int vnet_lisp_map_register_fallback_threshold_set (u32 value);
+u32 vnet_lisp_map_register_fallback_threshold_get (void);
map_records_arg_t *parse_map_reply (vlib_buffer_t * b);