FD.io VPP  v17.01-9-ge7dcee4
Vector Packet Processing
adj.c File Reference
+ Include dependency graph for adj.c:

Go to the source code of this file.

Macros

#define ADJ_FROM_NODE(_node)   ((ip_adjacency_t*)((char*)_node - STRUCT_OFFSET_OF(ip_adjacency_t, ia_node)))
 

Functions

static void adj_poison (ip_adjacency_t *adj)
 
ip_adjacency_tadj_alloc (fib_protocol_t proto)
 
static int adj_index_is_special (adj_index_t adj_index)
 
u8format_ip_adjacency (u8 *s, va_list *args)
 Pretty print helper function for formatting specific adjacencies. More...
 
static void adj_last_lock_gone (ip_adjacency_t *adj)
 
void adj_lock (adj_index_t adj_index)
 An adjacency is a representation of an attached L3 peer. More...
 
void adj_unlock (adj_index_t adj_index)
 Release a reference counting lock on the adjacency. More...
 
u32 adj_child_add (adj_index_t adj_index, fib_node_type_t child_type, fib_node_index_t child_index)
 Add a child dependent to an adjacency. More...
 
void adj_child_remove (adj_index_t adj_index, u32 sibling_index)
 Remove a child dependent. More...
 
vnet_link_t adj_get_link_type (adj_index_t ai)
 Return the link type of the adjacency. More...
 
u32 adj_get_sw_if_index (adj_index_t ai)
 Return the sw interface index of the adjacency. More...
 
const u8adj_get_rewrite (adj_index_t ai)
 Return the link type of the adjacency. More...
 
static fib_node_tadj_get_node (fib_node_index_t index)
 
static void adj_node_last_lock_gone (fib_node_t *node)
 
static fib_node_back_walk_rc_t adj_back_walk_notify (fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
 
static clib_error_tadj_module_init (vlib_main_t *vm)
 
static clib_error_tadj_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
ip_adjacency_tip_add_adjacency (ip_lookup_main_t *lm, ip_adjacency_t *copy_adj, u32 n_adj, u32 *adj_index_return)
 

Variables

static ip_adjacency_tspecial_v4_miss_adj_with_index_zero
 
vlib_combined_counter_main_t adjacency_counters
 Adjacency packet counters. More...
 
ip_adjacency_tadj_pool
 The global adjacnecy pool. More...
 
static const fib_node_vft_t adj_vft
 
static vlib_cli_command_t adj_show_command
 (constructor) VLIB_CLI_COMMAND (adj_show_command) More...
 

Macro Definition Documentation

#define ADJ_FROM_NODE (   _node)    ((ip_adjacency_t*)((char*)_node - STRUCT_OFFSET_OF(ip_adjacency_t, ia_node)))

Definition at line 311 of file adj.c.

Function Documentation

ip_adjacency_t* adj_alloc ( fib_protocol_t  proto)

Definition at line 47 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static fib_node_back_walk_rc_t adj_back_walk_notify ( fib_node_t node,
fib_node_back_walk_ctx_t ctx 
)
static

Definition at line 321 of file adj.c.

u32 adj_child_add ( adj_index_t  adj_index,
fib_node_type_t  type,
fib_node_index_t  child_index 
)

Add a child dependent to an adjacency.

The child will thus be informed via its registerd back-walk function when the adjacency state changes.

Definition at line 228 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void adj_child_remove ( adj_index_t  adj_index,
u32  sibling_index 
)

Remove a child dependent.

Definition at line 245 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vnet_link_t adj_get_link_type ( adj_index_t  ai)

Return the link type of the adjacency.

Definition at line 262 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static fib_node_t* adj_get_node ( fib_node_index_t  index)
static

Definition at line 302 of file adj.c.

+ Here is the call graph for this function:

const u8* adj_get_rewrite ( adj_index_t  ai)

Return the link type of the adjacency.

Definition at line 288 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 adj_get_sw_if_index ( adj_index_t  ai)

Return the sw interface index of the adjacency.

Definition at line 275 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int adj_index_is_special ( adj_index_t  adj_index)
static

Definition at line 78 of file adj.c.

+ Here is the caller graph for this function:

static void adj_last_lock_gone ( ip_adjacency_t adj)
static

Definition at line 149 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void adj_lock ( adj_index_t  adj_index)

An adjacency is a representation of an attached L3 peer.

Adjacency Sub-types:

  • neighbour: a representation of an attached L3 peer. Key:{addr,interface,link/ether-type} SHARED
  • glean: used to drive ARP/ND for packets destined to a local sub-net. 'glean' mean use the packet's destination address as the target address in the ARP packet. UNSHARED. Only one per-interface.
  • midchain: a nighbour adj on a virtual/tunnel interface.
  • rewrite: an adj with no key, but with a rewrite string.

The API to create and update the adjacency is very sub-type specific. This is intentional as it encourages the user to carefully consider which adjacency sub-type they are really using, and hence assign it data in the appropriate sub-type space in the union of sub-types. This prevents the adj becoming a disorganised dumping group for 'my features needs a u16 somewhere' data. It is important to enforce this approach as space in the adjacency is a premium, as we need it to fit in 1 cache line.

the API is also based around an index to an ajdacency not a raw pointer. This is so the user doesn't suffer the same limp inducing firearm injuries that the author suffered as the adjacenices can realloc.

Take a reference counting lock on the adjacency

Definition at line 192 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* adj_module_init ( vlib_main_t vm)
static

Definition at line 342 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void adj_node_last_lock_gone ( fib_node_t node)
static

Definition at line 315 of file adj.c.

+ Here is the call graph for this function:

static void adj_poison ( ip_adjacency_t adj)
inlinestatic

Definition at line 38 of file adj.c.

+ Here is the caller graph for this function:

static clib_error_t* adj_show ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 361 of file adj.c.

+ Here is the call graph for this function:

void adj_unlock ( adj_index_t  adj_index)

Release a reference counting lock on the adjacency.

Definition at line 209 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_ip_adjacency ( u8 s,
va_list *  args 
)

Pretty print helper function for formatting specific adjacencies.

Parameters
s- input string to format
args- other args passed to format function such as:

Definition at line 95 of file adj.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ip_adjacency_t* ip_add_adjacency ( ip_lookup_main_t lm,
ip_adjacency_t copy_adj,
u32  n_adj,
u32 adj_index_return 
)

Definition at line 438 of file adj.c.

+ Here is the call graph for this function:

Variable Documentation

ip_adjacency_t* adj_pool

The global adjacnecy pool.

Exposed for fast/inline data-plane access

Definition at line 35 of file adj.c.

vlib_cli_command_t adj_show_command
static
Initial value:
= {
.path = "show adj",
.short_help = "show adj [<adj_index>] [interface]",
.function = adj_show,
}
static clib_error_t * adj_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: adj.c:361

(constructor) VLIB_CLI_COMMAND (adj_show_command)

Definition at line 428 of file adj.c.

const fib_node_vft_t adj_vft
static
Initial value:
= {
.fnv_get = adj_get_node,
.fnv_last_lock = adj_node_last_lock_gone,
.fnv_back_walk = adj_back_walk_notify,
}
static fib_node_back_walk_rc_t adj_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: adj.c:321
static fib_node_t * adj_get_node(fib_node_index_t index)
Definition: adj.c:302
static void adj_node_last_lock_gone(fib_node_t *node)
Definition: adj.c:315

Definition at line 335 of file adj.c.

vlib_combined_counter_main_t adjacency_counters

Adjacency packet counters.

Definition at line 30 of file adj.c.

ip_adjacency_t* special_v4_miss_adj_with_index_zero
static

Definition at line 27 of file adj.c.