FD.io VPP  v18.07-rc0-415-g6c78436
Vector Packet Processing
map.h File Reference
+ Include dependency graph for map.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  map_domain_t
 
union  map_ip4_reass_key_t
 
struct  map_ip4_reass_t
 
union  map_ip6_reass_key_t
 
struct  map_ip6_fragment_t
 
struct  map_ip6_reass_t
 
struct  map_main_pre_resolved_t_
 A pre-resolved next-hop. More...
 
struct  map_main_t
 
struct  map_trace_t
 

Macros

#define MAP_SKIP_IP6_LOOKUP   1
 
#define MAP_IP4_REASS_LIFETIME_DEFAULT   (100) /* ms */
 IP4 reassembly logic: One virtually reassembled flow requires a map_ip4_reass_t structure in order to keep the first-fragment port number and, optionally, cache out of sequence packets. More...
 
#define MAP_IP4_REASS_HT_RATIO_DEFAULT   (1.0)
 
#define MAP_IP4_REASS_POOL_SIZE_DEFAULT   1024
 
#define MAP_IP4_REASS_BUFFERS_DEFAULT   2048
 
#define MAP_IP4_REASS_MAX_FRAGMENTS_PER_REASSEMBLY   5
 
#define MAP_IP6_REASS_LIFETIME_DEFAULT   (100) /* ms */
 
#define MAP_IP6_REASS_HT_RATIO_DEFAULT   (1.0)
 
#define MAP_IP6_REASS_POOL_SIZE_DEFAULT   1024
 
#define MAP_IP6_REASS_BUFFERS_DEFAULT   2048
 
#define MAP_IP6_REASS_MAX_FRAGMENTS_PER_REASSEMBLY   5
 
#define MAP_IP6_REASS_COUNT_BYTES
 
#define MAP_IP4_REASS_COUNT_BYTES
 
#define MAP_REASS_INDEX_NONE   ((u16)0xffff)
 
#define foreach_map_error
 
#define map_ip4_reass_lock()   while (__sync_lock_test_and_set(map_main.ip4_reass_lock, 1)) {}
 
#define map_ip4_reass_unlock()   do {CLIB_MEMORY_BARRIER(); *map_main.ip4_reass_lock = 0;} while(0)
 
#define map_ip6_reass_lock()   while (__sync_lock_test_and_set(map_main.ip6_reass_lock, 1)) {}
 
#define map_ip6_reass_unlock()   do {CLIB_MEMORY_BARRIER(); *map_main.ip6_reass_lock = 0;} while(0)
 
#define MAP_IP4_REASS_CONF_HT_RATIO_MAX   100
 
#define MAP_IP4_REASS_CONF_POOL_SIZE_MAX   (0xfeff)
 
#define MAP_IP4_REASS_CONF_LIFETIME_MAX   0xffff
 
#define MAP_IP4_REASS_CONF_BUFFERS_MAX   (0xffffffff)
 
#define MAP_IP6_REASS_CONF_HT_RATIO_MAX   100
 
#define MAP_IP6_REASS_CONF_POOL_SIZE_MAX   (0xfeff)
 
#define MAP_IP6_REASS_CONF_LIFETIME_MAX   0xffff
 
#define MAP_IP6_REASS_CONF_BUFFERS_MAX   (0xffffffff)
 

Typedefs

typedef struct map_main_pre_resolved_t_ map_main_pre_resolved_t
 A pre-resolved next-hop. More...
 

Enumerations

enum  map_domain_flags_e { MAP_DOMAIN_PREFIX = 1 << 0, MAP_DOMAIN_TRANSLATION = 1 << 1, MAP_DOMAIN_RFC6052 = 1 << 2 }
 
enum  map_domain_counter_t { MAP_DOMAIN_IPV4_FRAGMENT = 0, MAP_DOMAIN_COUNTER_RX = 0, MAP_DOMAIN_COUNTER_TX, MAP_N_DOMAIN_COUNTER }
 
enum  map_error_t { MAP_N_ERROR }
 

Functions

int map_create_domain (ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags)
 
int map_delete_domain (u32 map_domain_index)
 
int map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t *tep, u8 is_add)
 
u8format_map_trace (u8 *s, va_list *args)
 
 STATIC_ASSERT ((sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES),"MAP domain fits in one cacheline")
 
u64 map_error_counter_get (u32 node_index, map_error_t map_error)
 
static_always_inline u64 map_get_pfx (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u64 map_get_pfx_net (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u64 map_get_sfx (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u64 map_get_sfx_net (map_domain_t *d, u32 addr, u16 port)
 
static_always_inline u32 map_get_ip4 (ip6_address_t *addr, map_domain_flags_e flags)
 
static_always_inline map_domain_tip4_map_get_domain (u32 mdi)
 
static_always_inline map_domain_tip6_map_get_domain (u32 mdi, ip4_address_t *addr, u32 *map_domain_index, u8 *error)
 
map_ip4_reass_tmap_ip4_reass_get (u32 src, u32 dst, u16 fragment_id, u8 protocol, u32 **pi_to_drop)
 
void map_ip4_reass_free (map_ip4_reass_t *r, u32 **pi_to_drop)
 
static_always_inline void map_ip4_reass_get_fragments (map_ip4_reass_t *r, u32 **pi)
 
clib_error_tmap_plugin_api_hookup (vlib_main_t *vm)
 
int map_ip4_reass_add_fragment (map_ip4_reass_t *r, u32 pi)
 
map_ip6_reass_tmap_ip6_reass_get (ip6_address_t *src, ip6_address_t *dst, u32 fragment_id, u8 protocol, u32 **pi_to_drop)
 
void map_ip6_reass_free (map_ip6_reass_t *r, u32 **pi_to_drop)
 
int map_ip6_reass_add_fragment (map_ip6_reass_t *r, u32 pi, u16 data_offset, u16 next_data_offset, u8 *data_start, u16 data_len)
 
void map_ip4_drop_pi (u32 pi)
 
int map_ip4_reass_conf_ht_ratio (f32 ht_ratio, u32 *trashed_reass, u32 *dropped_packets)
 
int map_ip4_reass_conf_pool_size (u16 pool_size, u32 *trashed_reass, u32 *dropped_packets)
 
int map_ip4_reass_conf_lifetime (u16 lifetime_ms)
 
int map_ip4_reass_conf_buffers (u32 buffers)
 
void map_ip6_drop_pi (u32 pi)
 
int map_ip6_reass_conf_ht_ratio (f32 ht_ratio, u32 *trashed_reass, u32 *dropped_packets)
 
int map_ip6_reass_conf_pool_size (u16 pool_size, u32 *trashed_reass, u32 *dropped_packets)
 
int map_ip6_reass_conf_lifetime (u16 lifetime_ms)
 
int map_ip6_reass_conf_buffers (u32 buffers)
 
static_always_inline void ip4_map_t_embedded_address (map_domain_t *d, ip6_address_t *ip6, const ip4_address_t *ip4)
 
static_always_inline u32 ip6_map_t_embedded_address (map_domain_t *d, ip6_address_t *addr)
 
static void map_domain_counter_lock (map_main_t *mm)
 
static void map_domain_counter_unlock (map_main_t *mm)
 
static_always_inline void map_send_all_to_node (vlib_main_t *vm, u32 *pi_vector, vlib_node_runtime_t *node, vlib_error_t *error, u32 next)
 

Variables

map_main_pre_resolved_t pre_resolved [FIB_PROTOCOL_MAX]
 Pre-resolved next hops for v4 and v6. More...
 
map_main_t map_main
 
vlib_node_registration_t ip4_map_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_node) More...
 
vlib_node_registration_t ip6_map_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_node) More...
 
vlib_node_registration_t ip4_map_t_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_node) More...
 
vlib_node_registration_t ip4_map_t_fragmented_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node) More...
 
vlib_node_registration_t ip4_map_t_tcp_udp_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node) More...
 
vlib_node_registration_t ip4_map_t_icmp_node
 (constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node) More...
 
vlib_node_registration_t ip6_map_t_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_node) More...
 
vlib_node_registration_t ip6_map_t_fragmented_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node) More...
 
vlib_node_registration_t ip6_map_t_tcp_udp_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node) More...
 
vlib_node_registration_t ip6_map_t_icmp_node
 (constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node) More...
 

Macro Definition Documentation

#define foreach_map_error
Value:
/* Must be first. */ \
_(NONE, "valid MAP packets") \
_(BAD_PROTOCOL, "bad protocol") \
_(SEC_CHECK, "security check failed") \
_(ENCAP_SEC_CHECK, "encap security check failed") \
_(DECAP_SEC_CHECK, "decap security check failed") \
_(ICMP, "unable to translate ICMP") \
_(ICMP_RELAY, "unable to relay ICMP") \
_(UNKNOWN, "unknown") \
_(NO_BINDING, "no binding") \
_(NO_DOMAIN, "no domain") \
_(FRAGMENTED, "packet is a fragment") \
_(FRAGMENT_MEMORY, "could not cache fragment") \
_(FRAGMENT_MALFORMED, "fragment has unexpected format")\
_(FRAGMENT_DROPPED, "dropped cached fragment") \
_(MALFORMED, "malformed packet") \
_(DF_SET, "can't fragment, DF set")

Definition at line 308 of file map.h.

#define MAP_IP4_REASS_BUFFERS_DEFAULT   2048

Definition at line 61 of file map.h.

#define MAP_IP4_REASS_CONF_BUFFERS_MAX   (0xffffffff)

Definition at line 519 of file map.h.

#define MAP_IP4_REASS_CONF_HT_RATIO_MAX   100

Definition at line 513 of file map.h.

#define MAP_IP4_REASS_CONF_LIFETIME_MAX   0xffff

Definition at line 517 of file map.h.

#define MAP_IP4_REASS_CONF_POOL_SIZE_MAX   (0xfeff)

Definition at line 515 of file map.h.

#define MAP_IP4_REASS_COUNT_BYTES

Definition at line 73 of file map.h.

#define MAP_IP4_REASS_HT_RATIO_DEFAULT   (1.0)

Definition at line 59 of file map.h.

#define MAP_IP4_REASS_LIFETIME_DEFAULT   (100) /* ms */

IP4 reassembly logic: One virtually reassembled flow requires a map_ip4_reass_t structure in order to keep the first-fragment port number and, optionally, cache out of sequence packets.

There are up to MAP_IP4_REASS_MAX_REASSEMBLY such structures. When in use, those structures are stored in a hash table of MAP_IP4_REASS_BUCKETS buckets. When a new structure needs to be used, it is allocated from available ones. If there is no structure available, the oldest in use is selected and used if and only if it was first allocated more than MAP_IP4_REASS_LIFETIME seconds ago. In case no structure can be allocated, the fragment is dropped.

Definition at line 58 of file map.h.

#define map_ip4_reass_lock ( )    while (__sync_lock_test_and_set(map_main.ip4_reass_lock, 1)) {}

Definition at line 477 of file map.h.

#define MAP_IP4_REASS_MAX_FRAGMENTS_PER_REASSEMBLY   5

Definition at line 63 of file map.h.

#define MAP_IP4_REASS_POOL_SIZE_DEFAULT   1024

Definition at line 60 of file map.h.

#define map_ip4_reass_unlock ( )    do {CLIB_MEMORY_BARRIER(); *map_main.ip4_reass_lock = 0;} while(0)

Definition at line 478 of file map.h.

#define MAP_IP6_REASS_BUFFERS_DEFAULT   2048

Definition at line 68 of file map.h.

#define MAP_IP6_REASS_CONF_BUFFERS_MAX   (0xffffffff)

Definition at line 531 of file map.h.

#define MAP_IP6_REASS_CONF_HT_RATIO_MAX   100

Definition at line 525 of file map.h.

#define MAP_IP6_REASS_CONF_LIFETIME_MAX   0xffff

Definition at line 529 of file map.h.

#define MAP_IP6_REASS_CONF_POOL_SIZE_MAX   (0xfeff)

Definition at line 527 of file map.h.

#define MAP_IP6_REASS_COUNT_BYTES

Definition at line 72 of file map.h.

#define MAP_IP6_REASS_HT_RATIO_DEFAULT   (1.0)

Definition at line 66 of file map.h.

#define MAP_IP6_REASS_LIFETIME_DEFAULT   (100) /* ms */

Definition at line 65 of file map.h.

#define map_ip6_reass_lock ( )    while (__sync_lock_test_and_set(map_main.ip6_reass_lock, 1)) {}

Definition at line 502 of file map.h.

#define MAP_IP6_REASS_MAX_FRAGMENTS_PER_REASSEMBLY   5

Definition at line 70 of file map.h.

#define MAP_IP6_REASS_POOL_SIZE_DEFAULT   1024

Definition at line 67 of file map.h.

#define map_ip6_reass_unlock ( )    do {CLIB_MEMORY_BARRIER(); *map_main.ip6_reass_lock = 0;} while(0)

Definition at line 503 of file map.h.

#define MAP_REASS_INDEX_NONE   ((u16)0xffff)

Definition at line 111 of file map.h.

#define MAP_SKIP_IP6_LOOKUP   1

Definition at line 26 of file map.h.

Typedef Documentation

A pre-resolved next-hop.

Enumeration Type Documentation

Enumerator
MAP_DOMAIN_IPV4_FRAGMENT 
MAP_DOMAIN_COUNTER_RX 
MAP_DOMAIN_COUNTER_TX 
MAP_N_DOMAIN_COUNTER 

Definition at line 148 of file map.h.

Enumerator
MAP_DOMAIN_PREFIX 
MAP_DOMAIN_TRANSLATION 
MAP_DOMAIN_RFC6052 

Definition at line 38 of file map.h.

Enumerator
MAP_N_ERROR 

Definition at line 327 of file map.h.

Function Documentation

u8* format_map_trace ( u8 s,
va_list *  args 
)

Definition at line 1436 of file map.c.

+ Here is the call graph for this function:

static_always_inline map_domain_t* ip4_map_get_domain ( u32  mdi)

Definition at line 425 of file map.h.

+ Here is the caller graph for this function:

static_always_inline void ip4_map_t_embedded_address ( map_domain_t d,
ip6_address_t ip6,
const ip4_address_t ip4 
)

Definition at line 534 of file map.h.

+ Here is the caller graph for this function:

static_always_inline map_domain_t* ip6_map_get_domain ( u32  mdi,
ip4_address_t addr,
u32 map_domain_index,
u8 error 
)

Definition at line 438 of file map.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline u32 ip6_map_t_embedded_address ( map_domain_t d,
ip6_address_t addr 
)

Definition at line 544 of file map.h.

+ Here is the caller graph for this function:

int map_add_del_psid ( u32  map_domain_index,
u16  psid,
ip6_address_t tep,
u8  is_add 
)

Definition at line 302 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_create_domain ( ip4_address_t ip4_prefix,
u8  ip4_prefix_len,
ip6_address_t ip6_prefix,
u8  ip6_prefix_len,
ip6_address_t ip6_src,
u8  ip6_src_len,
u8  ea_bits_len,
u8  psid_offset,
u8  psid_length,
u32 map_domain_index,
u16  mtu,
u8  flags 
)

Definition at line 65 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_delete_domain ( u32  map_domain_index)

Definition at line 258 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void map_domain_counter_lock ( map_main_t mm)
inlinestatic

Definition at line 551 of file map.h.

+ Here is the caller graph for this function:

static void map_domain_counter_unlock ( map_main_t mm)
inlinestatic

Definition at line 558 of file map.h.

+ Here is the caller graph for this function:

u64 map_error_counter_get ( u32  node_index,
map_error_t  map_error 
)

Definition at line 1138 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline u32 map_get_ip4 ( ip6_address_t addr,
map_domain_flags_e  flags 
)

Definition at line 413 of file map.h.

+ Here is the caller graph for this function:

static_always_inline u64 map_get_pfx ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 360 of file map.h.

+ Here is the caller graph for this function:

static_always_inline u64 map_get_pfx_net ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 374 of file map.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline u64 map_get_sfx ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 384 of file map.h.

+ Here is the caller graph for this function:

static_always_inline u64 map_get_sfx_net ( map_domain_t d,
u32  addr,
u16  port 
)

Definition at line 406 of file map.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void map_ip4_drop_pi ( u32  pi)

Definition at line 664 of file ip6_map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_ip4_reass_add_fragment ( map_ip4_reass_t r,
u32  pi 
)

Definition at line 1597 of file map.c.

+ Here is the caller graph for this function:

int map_ip4_reass_conf_buffers ( u32  buffers)

Definition at line 1927 of file map.c.

+ Here is the caller graph for this function:

int map_ip4_reass_conf_ht_ratio ( f32  ht_ratio,
u32 trashed_reass,
u32 dropped_packets 
)

Definition at line 1888 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_ip4_reass_conf_lifetime ( u16  lifetime_ms)

Definition at line 1920 of file map.c.

+ Here is the caller graph for this function:

int map_ip4_reass_conf_pool_size ( u16  pool_size,
u32 trashed_reass,
u32 dropped_packets 
)

Definition at line 1905 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void map_ip4_reass_free ( map_ip4_reass_t r,
u32 **  pi_to_drop 
)

Definition at line 1473 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

map_ip4_reass_t* map_ip4_reass_get ( u32  src,
u32  dst,
u16  fragment_id,
u8  protocol,
u32 **  pi_to_drop 
)

Definition at line 1516 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void map_ip4_reass_get_fragments ( map_ip4_reass_t r,
u32 **  pi 
)

Definition at line 481 of file map.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void map_ip6_drop_pi ( u32  pi)

Definition at line 655 of file ip6_map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_ip6_reass_add_fragment ( map_ip6_reass_t r,
u32  pi,
u16  data_offset,
u16  next_data_offset,
u8 data_start,
u16  data_len 
)

Definition at line 1776 of file map.c.

+ Here is the caller graph for this function:

int map_ip6_reass_conf_buffers ( u32  buffers)

Definition at line 2010 of file map.c.

+ Here is the caller graph for this function:

int map_ip6_reass_conf_ht_ratio ( f32  ht_ratio,
u32 trashed_reass,
u32 dropped_packets 
)

Definition at line 1971 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int map_ip6_reass_conf_lifetime ( u16  lifetime_ms)

Definition at line 2003 of file map.c.

+ Here is the caller graph for this function:

int map_ip6_reass_conf_pool_size ( u16  pool_size,
u32 trashed_reass,
u32 dropped_packets 
)

Definition at line 1988 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void map_ip6_reass_free ( map_ip6_reass_t r,
u32 **  pi_to_drop 
)

Definition at line 1636 of file map.c.

+ Here is the caller graph for this function:

map_ip6_reass_t* map_ip6_reass_get ( ip6_address_t src,
ip6_address_t dst,
u32  fragment_id,
u8  protocol,
u32 **  pi_to_drop 
)

Definition at line 1688 of file map.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* map_plugin_api_hookup ( vlib_main_t vm)

Definition at line 277 of file map_api.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void map_send_all_to_node ( vlib_main_t vm,
u32 pi_vector,
vlib_node_runtime_t node,
vlib_error_t error,
u32  next 
)

Definition at line 566 of file map.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

STATIC_ASSERT ( (sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES ,
"MAP domain fits in one cacheline"   
)

Variable Documentation

(constructor) VLIB_REGISTER_NODE (ip4_map_node)

Definition at line 703 of file ip4_map.c.

vlib_node_registration_t ip4_map_t_fragmented_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node)

Definition at line 812 of file ip4_map_t.c.

vlib_node_registration_t ip4_map_t_icmp_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node)

Definition at line 832 of file ip4_map_t.c.

vlib_node_registration_t ip4_map_t_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_node)

Definition at line 872 of file ip4_map_t.c.

vlib_node_registration_t ip4_map_t_tcp_udp_node

(constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node)

Definition at line 852 of file ip4_map_t.c.

(constructor) VLIB_REGISTER_NODE (ip6_map_node)

Definition at line 1180 of file ip6_map.c.

vlib_node_registration_t ip6_map_t_fragmented_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)

Definition at line 1100 of file ip6_map_t.c.

vlib_node_registration_t ip6_map_t_icmp_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)

Definition at line 1120 of file ip6_map_t.c.

vlib_node_registration_t ip6_map_t_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)

Definition at line 1160 of file ip6_map_t.c.

vlib_node_registration_t ip6_map_t_tcp_udp_node

(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)

Definition at line 1140 of file ip6_map_t.c.

map_main_t map_main

Definition at line 27 of file map.c.

Pre-resolved next hops for v4 and v6.

Why these are global and not per-domain is beyond me.

Pre-resolved next hops for v4 and v6.

Definition at line 350 of file map.c.