FD.io VPP  v17.04-9-g99c0734
Vector Packet Processing
dpo.c File Reference
+ Include dependency graph for dpo.c:

Go to the source code of this file.

Functions

dpo_proto_t vnet_link_to_dpo_proto (vnet_link_t linkt)
 
u8format_dpo_type (u8 *s, va_list *args)
 format a DPO type More...
 
u8format_dpo_id (u8 *s, va_list *args)
 Format a DPO_id_t oject More...
 
u8format_dpo_proto (u8 *s, va_list *args)
 format a DPO protocol More...
 
void dpo_set (dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
 Set/create a DPO ID The DPO will be locked. More...
 
void dpo_reset (dpo_id_t *dpo)
 reset a DPO ID The DPO will be unlocked. More...
 
int dpo_cmp (const dpo_id_t *dpo1, const dpo_id_t *dpo2)
 Compare two Data-path objects. More...
 
void dpo_copy (dpo_id_t *dst, const dpo_id_t *src)
 atomic copy a data-plane object. More...
 
int dpo_is_adj (const dpo_id_t *dpo)
 Return TRUE is the DPO is any type of adjacency. More...
 
void dpo_register (dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
 For a given DPO type Register: More...
 
dpo_type_t dpo_register_new_type (const dpo_vft_t *vft, const char *const *const *nodes)
 Create and register a new DPO type. More...
 
void dpo_lock (dpo_id_t *dpo)
 Take a reference counting lock on the DPO. More...
 
void dpo_unlock (dpo_id_t *dpo)
 Release a reference counting lock on the DPO. More...
 
static u32 dpo_get_next_node (dpo_type_t child_type, dpo_proto_t child_proto, const dpo_id_t *parent_dpo)
 
static void dpo_stack_i (u32 edge, dpo_id_t *dpo, const dpo_id_t *parent)
 Stack one DPO object on another, and thus establish a child parent relationship. More...
 
void dpo_stack (dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
 Stack one DPO object on another, and thus establish a child-parent relationship. More...
 
void dpo_stack_from_node (u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
 Stack one DPO object on another, and thus establish a child parent relationship. More...
 
static clib_error_tdpo_module_init (vlib_main_t *vm)
 
static clib_error_tdpo_memory_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

static const char * dpo_type_names [] = DPO_TYPES
 A Data-Path Object is an object that represents actions that are applied to packets are they are switched through VPP. More...
 
static const char * dpo_proto_names [] = DPO_PROTOS
 
static dpo_vft_tdpo_vfts
 Vector of virtual function tables for the DPO types. More...
 
static const char *const *const ** dpo_nodes
 vector of graph node names associated with each DPO type and protocol. More...
 
static u32 **** dpo_edges
 Vector of edge indicies from parent DPO nodes to child. More...
 
static dpo_type_t dpo_dynamic = DPO_LAST
 The DPO type value that can be assigend to the next dynamic type registration. More...
 
static vlib_cli_command_t show_fib_memory
 (constructor) VLIB_CLI_COMMAND (show_fib_memory) More...
 

Function Documentation

int dpo_cmp ( const dpo_id_t dpo1,
const dpo_id_t dpo2 
)

Compare two Data-path objects.

compare two DPOs for equality

like memcmp, return 0 is matching, !0 otherwise.

Definition at line 211 of file dpo.c.

+ Here is the caller graph for this function:

void dpo_copy ( dpo_id_t dst,
const dpo_id_t src 
)

atomic copy a data-plane object.

This is safe to use when the dst DPO is currently switching packets

Definition at line 224 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 dpo_get_next_node ( dpo_type_t  child_type,
dpo_proto_t  child_proto,
const dpo_id_t parent_dpo 
)
static

Definition at line 291 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dpo_is_adj ( const dpo_id_t dpo)

Return TRUE is the DPO is any type of adjacency.

Definition at line 240 of file dpo.c.

+ Here is the caller graph for this function:

void dpo_lock ( dpo_id_t dpo)

Take a reference counting lock on the DPO.

Definition at line 272 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 463 of file dpo.c.

+ Here is the call graph for this function:

static clib_error_t* dpo_module_init ( vlib_main_t vm)
static

Definition at line 445 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpo_register ( dpo_type_t  type,
const dpo_vft_t vft,
const char *const *const *  nodes 
)

For a given DPO type Register:

  • a virtual function table
  • a NULL terminated array of graph nodes from which that object type will originate packets, i.e. the nodes in which the object type will be the parent DPO in the DP graph. The ndoes are per-data-path protocol (see above).
Parameters
typeThe type being registered.
vftThe virtual function table to register for the type.
nodesThe string description of the per-protocol VLIB graph nodes.

Definition at line 249 of file dpo.c.

+ Here is the caller graph for this function:

dpo_type_t dpo_register_new_type ( const dpo_vft_t vft,
const char *const *const *  nodes 
)

Create and register a new DPO type.

This can be used by plugins to create new DPO types that are not listed in dpo_type_t enum

Parameters
vftThe virtual function table to register for the type.
nodesThe string description of the per-protocol VLIB graph nodes.
Returns
The new dpo_type_t

Definition at line 261 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpo_reset ( dpo_id_t dpo)

reset a DPO ID The DPO will be unlocked.

Parameters
dpoThe DPO object to reset

Definition at line 194 of file dpo.c.

+ Here is the call graph for this function:

void dpo_set ( dpo_id_t dpo,
dpo_type_t  type,
dpo_proto_t  proto,
index_t  index 
)

Set/create a DPO ID The DPO will be locked.

Parameters
dpoThe DPO object to configure
typeThe dpo_type_t of the DPO
protoThe dpo_proto_t of the DPO
indexThe type specific index of the DPO

Definition at line 157 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpo_stack ( dpo_type_t  child_type,
dpo_proto_t  child_proto,
dpo_id_t dpo,
const dpo_id_t parent 
)

Stack one DPO object on another, and thus establish a child-parent relationship.

Set and stack a DPO.

The VLIB graph arc used is taken from the parent and child types passed.

Definition at line 401 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpo_stack_from_node ( u32  child_node_index,
dpo_id_t dpo,
const dpo_id_t parent 
)

Stack one DPO object on another, and thus establish a child parent relationship.

Set and stack a DPO.

A new VLIB graph arc is created from the child node passed to the nodes registered by the parent. The VLIB infra will ensure this arc is added only once.

Definition at line 416 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dpo_stack_i ( u32  edge,
dpo_id_t dpo,
const dpo_id_t parent 
)
static

Stack one DPO object on another, and thus establish a child parent relationship.

The VLIB graph arc used is taken from the parent and child types passed.

Definition at line 371 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpo_unlock ( dpo_id_t dpo)

Release a reference counting lock on the DPO.

Definition at line 281 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dpo_id ( u8 s,
va_list *  args 
)

Format a DPO_id_t oject

Definition at line 121 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dpo_proto ( u8 s,
va_list *  args 
)

format a DPO protocol

Definition at line 149 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_dpo_type ( u8 s,
va_list *  args 
)

format a DPO type

Definition at line 111 of file dpo.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

dpo_proto_t vnet_link_to_dpo_proto ( vnet_link_t  linkt)

Definition at line 89 of file dpo.c.

+ Here is the caller graph for this function:

Variable Documentation

dpo_type_t dpo_dynamic = DPO_LAST
static

The DPO type value that can be assigend to the next dynamic type registration.

Definition at line 86 of file dpo.c.

u32**** dpo_edges
static

Vector of edge indicies from parent DPO nodes to child.

dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge_index

This array is derived at init time from the dpo_nodes above. Note that the third dimension in dpo_nodes is lost, hence, the edge index from each node MUST be the same. Including both the child and parent protocol is required to support the case where it changes as the grapth is traversed, most notablly when an MPLS label is popped.

Note that this array is child type specific, not child instance specific.

Definition at line 80 of file dpo.c.

const char* const* const** dpo_nodes
static

vector of graph node names associated with each DPO type and protocol.

dpo_nodes[child_type][child_proto][node_X] = node_name; i.e. dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][0] = "ip4-lookup" dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][1] = "ip4-load-balance"

This is a vector so we can dynamically register new DPO types in plugins.

Definition at line 64 of file dpo.c.

const char* dpo_proto_names[] = DPO_PROTOS
static

Definition at line 45 of file dpo.c.

const char* dpo_type_names[] = DPO_TYPES
static

A Data-Path Object is an object that represents actions that are applied to packets are they are switched through VPP.

The DPO is a base class that is specialised by other objects to provide concreate actions

The VLIB graph nodes are graph of types, the DPO graph is a graph of instances. Array of char* names for the DPO types and protos

Definition at line 44 of file dpo.c.

dpo_vft_t* dpo_vfts
static

Vector of virtual function tables for the DPO types.

This is a vector so we can dynamically register new DPO types in plugins.

Definition at line 52 of file dpo.c.

vlib_cli_command_t show_fib_memory
static
Initial value:
= {
.path = "show dpo memory",
.function = dpo_memory_show,
.short_help = "show dpo memory",
}
static clib_error_t * dpo_memory_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dpo.c:463

(constructor) VLIB_CLI_COMMAND (show_fib_memory)

Definition at line 499 of file dpo.c.