FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
lookup.h File Reference

Definitions for all things IP (v4|v6) unicast and multicast lookup related. More...

+ Include dependency graph for lookup.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ip_adjacency_t_
 IP unicast adjacency. More...
 
struct  ip_multicast_rewrite_t
 
struct  ip_multicast_rewrite_string_t
 
struct  ip_multicast_lookup_main_t
 
struct  ip_interface_address_t
 
struct  ip_lookup_main_t
 

Macros

#define IP4_LOOKUP_NEXT_NODES
 
#define IP6_LOOKUP_NEXT_NODES
 
#define IP_FLOW_HASH_SRC_ADDR   (1<<0)
 Flow hash configuration. More...
 
#define IP_FLOW_HASH_DST_ADDR   (1<<1)
 
#define IP_FLOW_HASH_PROTO   (1<<2)
 
#define IP_FLOW_HASH_SRC_PORT   (1<<3)
 
#define IP_FLOW_HASH_DST_PORT   (1<<4)
 
#define IP_FLOW_HASH_REVERSE_SRC_DST   (1<<5)
 
#define IP_FLOW_HASH_DEFAULT   (0x1F)
 Default: 5-tuple without the "reverse" bit. More...
 
#define foreach_flow_hash_bit
 
#define ip_prefetch_adjacency(lm, adj_index, type)
 
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
 

Typedefs

typedef u32 flow_hash_config_t
 A flow hash configuration is a mask of the flow hash options. More...
 
typedef void(* adj_midchain_fixup_t) (vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0)
 A function type for post-rewrite fixups on midchain adjacency. More...
 
typedef enum ip_adjacency_flags_t_ ip_adjacency_flags_t
 Flags on an IP adjacency. More...
 
typedef struct ip_adjacency_t_ ip_adjacency_t
 IP unicast adjacency. More...
 
typedef struct ip_lookup_main_t ip_lookup_main_t
 

Enumerations

enum  ip_lookup_next_t {
  IP_LOOKUP_NEXT_DROP, IP_LOOKUP_NEXT_PUNT, IP_LOOKUP_NEXT_LOCAL, IP_LOOKUP_NEXT_ARP,
  IP_LOOKUP_NEXT_GLEAN, IP_LOOKUP_NEXT_REWRITE, IP_LOOKUP_NEXT_LOAD_BALANCE, IP_LOOKUP_NEXT_MIDCHAIN,
  IP_LOOKUP_NEXT_ICMP_ERROR, IP_LOOKUP_N_NEXT
}
 Common (IP4/IP6) next index stored in adjacency. More...
 
enum  ip4_lookup_next_t { IP4_LOOKUP_N_NEXT = IP_LOOKUP_N_NEXT }
 
enum  ip6_lookup_next_t { IP6_LOOKUP_NEXT_HOP_BY_HOP = IP_LOOKUP_N_NEXT, IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP, IP6_LOOKUP_NEXT_POP_HOP_BY_HOP, IP6_LOOKUP_N_NEXT }
 
enum  ip_adjacency_flags_t_ { IP_ADJ_SYNC_WALK_ACTIVE = (1 << 0) }
 Flags on an IP adjacency. More...
 
enum  ip_local_next_t {
  IP_LOCAL_NEXT_DROP, IP_LOCAL_NEXT_PUNT, IP_LOCAL_NEXT_UDP_LOOKUP, IP_LOCAL_NEXT_ICMP,
  IP_LOCAL_N_NEXT
}
 

Functions

 STATIC_ASSERT ((STRUCT_OFFSET_OF(ip_adjacency_t, cacheline0)==0),"IP adjacency cachline 0 is not offset")
 
 STATIC_ASSERT ((STRUCT_OFFSET_OF(ip_adjacency_t, cacheline1)==CLIB_CACHE_LINE_BYTES),"IP adjacency cachline 1 is more than one cachline size offset")
 
static ip_adjacency_tip_get_adjacency (ip_lookup_main_t *lm, u32 adj_index)
 
ip_adjacency_tip_add_adjacency (ip_lookup_main_t *lm, ip_adjacency_t *adj, u32 n_adj, u32 *adj_index_result)
 
clib_error_tip_interface_address_add_del (ip_lookup_main_t *lm, u32 sw_if_index, void *address, u32 address_length, u32 is_del, u32 *result_index)
 
u8format_ip_flow_hash_config (u8 *s, va_list *args)
 
static ip_interface_address_tip_get_interface_address (ip_lookup_main_t *lm, void *addr_fib)
 
u32 fib_table_id_find_fib_index (fib_protocol_t proto, u32 table_id)
 
static void * ip_interface_address_get_address (ip_lookup_main_t *lm, ip_interface_address_t *a)
 
void ip_lookup_init (ip_lookup_main_t *lm, u32 ip_lookup_node_index)
 

Variables

const ip46_address_t zero_addr
 

Detailed Description

Definitions for all things IP (v4|v6) unicast and multicast lookup related.

  • Adjacency definitions and registration.
  • Callbacks on route add.
  • Callbacks on interface address change.

Definition in file lookup.h.

Macro Definition Documentation

#define foreach_flow_hash_bit
Value:
_(proto, IP_FLOW_HASH_PROTO) \
#define IP_FLOW_HASH_SRC_PORT
Definition: lookup.h:142
#define IP_FLOW_HASH_REVERSE_SRC_DST
Definition: lookup.h:144
#define IP_FLOW_HASH_DST_PORT
Definition: lookup.h:143
#define IP_FLOW_HASH_DST_ADDR
Definition: lookup.h:140
#define IP_FLOW_HASH_SRC_ADDR
Flow hash configuration.
Definition: lookup.h:139
#define IP_FLOW_HASH_PROTO
Definition: lookup.h:141

Definition at line 149 of file lookup.h.

#define foreach_ip_interface_address (   lm,
  a,
  sw_if_index,
  loop,
  body 
)
Value:
do { \
u32 _sw_if_index = sw_if_index; \
vnet_sw_interface_t *_swif; \
_swif = vnet_get_sw_interface (_vnm, _sw_if_index); \
\
/* \
* Loop => honor unnumbered interface addressing. \
*/ \
if (loop && _swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \
_sw_if_index = _swif->unnumbered_sw_if_index; \
u32 _ia = \
(vec_len((lm)->if_address_pool_index_by_sw_if_index) \
> (_sw_if_index)) \
? vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \
(_sw_if_index)) : (u32)~0; \
ip_interface_address_t * _a; \
while (_ia != ~0) \
{ \
_a = pool_elt_at_index ((lm)->if_address_pool, _ia); \
_ia = _a->next_this_sw_interface; \
(a) = _a; \
body; \
} \
} while (0)
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED
Definition: interface.h:535
a
Definition: bitmap.h:516
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:369
unsigned int u32
Definition: types.h:88
#define vec_elt(v, i)
Get vector value at index i.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
struct vnet_main_t vnet_main_t

Definition at line 460 of file lookup.h.

#define IP4_LOOKUP_NEXT_NODES
Value:
{ \
[IP_LOOKUP_NEXT_DROP] = "ip4-drop", \
[IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \
[IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \
[IP_LOOKUP_NEXT_ARP] = "ip4-arp", \
[IP_LOOKUP_NEXT_GLEAN] = "ip4-glean", \
[IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite", \
[IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain", \
[IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip4-load-balance", \
[IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error", \
}
This packets follow a load-balance.
Definition: lookup.h:86
Adjacency to drop this packet.
Definition: lookup.h:63
This packets needs to go to ICMP error.
Definition: lookup.h:92
Adjacency to punt this packet.
Definition: lookup.h:65
This packet is for one of our own IP addresses.
Definition: lookup.h:68
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: lookup.h:78
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: lookup.h:73
This packets follow a mid-chain adjacency.
Definition: lookup.h:89
This packet is to be rewritten and forwarded to the next processing node.
Definition: lookup.h:83

Definition at line 111 of file lookup.h.

#define IP6_LOOKUP_NEXT_NODES
Value:
{ \
[IP_LOOKUP_NEXT_DROP] = "ip6-drop", \
[IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \
[IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \
[IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \
[IP_LOOKUP_NEXT_GLEAN] = "ip6-glean", \
[IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \
[IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain", \
[IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip6-load-balance", \
[IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error", \
[IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \
[IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \
[IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \
}
This packets follow a load-balance.
Definition: lookup.h:86
Adjacency to drop this packet.
Definition: lookup.h:63
This packets needs to go to ICMP error.
Definition: lookup.h:92
Adjacency to punt this packet.
Definition: lookup.h:65
This packet is for one of our own IP addresses.
Definition: lookup.h:68
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: lookup.h:78
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: lookup.h:73
This packets follow a mid-chain adjacency.
Definition: lookup.h:89
This packet is to be rewritten and forwarded to the next processing node.
Definition: lookup.h:83

Definition at line 123 of file lookup.h.

#define IP_FLOW_HASH_DEFAULT   (0x1F)

Default: 5-tuple without the "reverse" bit.

Definition at line 147 of file lookup.h.

#define IP_FLOW_HASH_DST_ADDR   (1<<1)

Definition at line 140 of file lookup.h.

#define IP_FLOW_HASH_DST_PORT   (1<<4)

Definition at line 143 of file lookup.h.

#define IP_FLOW_HASH_PROTO   (1<<2)

Definition at line 141 of file lookup.h.

#define IP_FLOW_HASH_REVERSE_SRC_DST   (1<<5)

Definition at line 144 of file lookup.h.

#define IP_FLOW_HASH_SRC_ADDR   (1<<0)

Flow hash configuration.

Definition at line 139 of file lookup.h.

#define IP_FLOW_HASH_SRC_PORT   (1<<3)

Definition at line 142 of file lookup.h.

#define ip_prefetch_adjacency (   lm,
  adj_index,
  type 
)
Value:
do { \
ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \
CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \
} while (0)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
struct ip_adjacency_t_ ip_adjacency_t
IP unicast adjacency.
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82

Definition at line 424 of file lookup.h.

Typedef Documentation

typedef void(* adj_midchain_fixup_t) (vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0)

A function type for post-rewrite fixups on midchain adjacency.

Definition at line 170 of file lookup.h.

A flow hash configuration is a mask of the flow hash options.

Definition at line 160 of file lookup.h.

Flags on an IP adjacency.

IP unicast adjacency.

Note
cache aligned.

Enumeration Type Documentation

Enumerator
IP4_LOOKUP_N_NEXT 

Definition at line 97 of file lookup.h.

Enumerator
IP6_LOOKUP_NEXT_HOP_BY_HOP 
IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP 
IP6_LOOKUP_NEXT_POP_HOP_BY_HOP 
IP6_LOOKUP_N_NEXT 

Definition at line 102 of file lookup.h.

Flags on an IP adjacency.

Enumerator
IP_ADJ_SYNC_WALK_ACTIVE 

Currently a sync walk is active.

Used to prevent re-entrant walking

Definition at line 177 of file lookup.h.

Enumerator
IP_LOCAL_NEXT_DROP 
IP_LOCAL_NEXT_PUNT 
IP_LOCAL_NEXT_UDP_LOOKUP 
IP_LOCAL_NEXT_ICMP 
IP_LOCAL_N_NEXT 

Definition at line 355 of file lookup.h.

Common (IP4/IP6) next index stored in adjacency.

Enumerator
IP_LOOKUP_NEXT_DROP 

Adjacency to drop this packet.

IP_LOOKUP_NEXT_PUNT 

Adjacency to punt this packet.

IP_LOOKUP_NEXT_LOCAL 

This packet is for one of our own IP addresses.

IP_LOOKUP_NEXT_ARP 

This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite string for this destination.

IP_LOOKUP_NEXT_GLEAN 

This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string for this destination.

IP_LOOKUP_NEXT_REWRITE 

This packet is to be rewritten and forwarded to the next processing node.

This is typically the output interface but might be another node for further output processing.

IP_LOOKUP_NEXT_LOAD_BALANCE 

This packets follow a load-balance.

IP_LOOKUP_NEXT_MIDCHAIN 

This packets follow a mid-chain adjacency.

IP_LOOKUP_NEXT_ICMP_ERROR 

This packets needs to go to ICMP error.

IP_LOOKUP_N_NEXT 

Definition at line 60 of file lookup.h.

Function Documentation

u32 fib_table_id_find_fib_index ( fib_protocol_t  proto,
u32  table_id 
)

Definition at line 357 of file lookup.c.

+ Here is the caller graph for this function:

u8* format_ip_flow_hash_config ( u8 s,
va_list *  args 
)

Definition at line 238 of file lookup.c.

ip_adjacency_t* ip_add_adjacency ( ip_lookup_main_t lm,
ip_adjacency_t adj,
u32  n_adj,
u32 adj_index_result 
)

Definition at line 438 of file adj.c.

+ Here is the call graph for this function:

static ip_adjacency_t* ip_get_adjacency ( ip_lookup_main_t lm,
u32  adj_index 
)
inlinestatic

Definition at line 415 of file lookup.h.

+ Here is the caller graph for this function:

static ip_interface_address_t* ip_get_interface_address ( ip_lookup_main_t lm,
void *  addr_fib 
)
inlinestatic

Definition at line 444 of file lookup.h.

+ Here is the call graph for this function:

clib_error_t* ip_interface_address_add_del ( ip_lookup_main_t lm,
u32  sw_if_index,
void *  address,
u32  address_length,
u32  is_del,
u32 result_index 
)

Definition at line 59 of file lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* ip_interface_address_get_address ( ip_lookup_main_t lm,
ip_interface_address_t a 
)
inlinestatic

Definition at line 453 of file lookup.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip_lookup_init ( ip_lookup_main_t lm,
u32  ip_lookup_node_index 
)

Definition at line 187 of file lookup.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

STATIC_ASSERT ( (STRUCT_OFFSET_OF(ip_adjacency_t, cacheline0)==0)  ,
"IP adjacency cachline 0 is not offset  
)
STATIC_ASSERT ( (STRUCT_OFFSET_OF(ip_adjacency_t, cacheline1)==CLIB_CACHE_LINE_BYTES ,
"IP adjacency cachline 1 is more than one cachline size offset  
)

Variable Documentation

const ip46_address_t zero_addr

Definition at line 351 of file lookup.c.