FD.io VPP  v19.08.3-2-gbabecb413
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)
 
vnet_link_t dpo_proto_to_link (dpo_proto_t dp)
 format a DPO protocol More...
 
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...
 
static u32dpo_default_get_next_node (const dpo_id_t *dpo)
 
static void dpo_default_mk_interpose (const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
 A default variant of the make interpose function that just returns the original. 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_mk_interpose (const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
 Make an interpose DPO from an original. 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...
 
u32 dpo_get_urpf (const dpo_id_t *dpo)
 Get a uRPF interface for 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)
 
u32 dpo_get_next_node_by_type_and_proto (dpo_type_t child_type, dpo_proto_t child_proto, dpo_type_t parent_type, dpo_proto_t parent_proto)
 return already stacked up next node index for a given child_type/child_proto and parent_type/patent_proto. More...
 
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 assigned 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

◆ dpo_cmp()

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 249 of file dpo.c.

+ Here is the caller graph for this function:

◆ dpo_copy()

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 262 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_default_get_next_node()

static u32* dpo_default_get_next_node ( const dpo_id_t dpo)
static

Definition at line 287 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_default_mk_interpose()

static void dpo_default_mk_interpose ( const dpo_id_t original,
const dpo_id_t parent,
dpo_id_t clone 
)
static

A default variant of the make interpose function that just returns the original.

Definition at line 314 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_get_next_node()

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 394 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_get_next_node_by_type_and_proto()

u32 dpo_get_next_node_by_type_and_proto ( dpo_type_t  child_type,
dpo_proto_t  child_proto,
dpo_type_t  parent_type,
dpo_proto_t  parent_proto 
)

return already stacked up next node index for a given child_type/child_proto and parent_type/patent_proto.

Return already stacked up next node index for a given child_type/child_proto and parent_type/patent_proto.

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

Definition at line 472 of file dpo.c.

◆ dpo_get_urpf()

u32 dpo_get_urpf ( const dpo_id_t dpo)

Get a uRPF interface for the DPO.

Parameters
dpoThe DPO from which to get the uRPF interface
Returns
valid SW interface index or ~0

Definition at line 382 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_is_adj()

int dpo_is_adj ( const dpo_id_t dpo)

Return TRUE is the DPO is any type of adjacency.

Definition at line 278 of file dpo.c.

+ Here is the caller graph for this function:

◆ dpo_lock()

void dpo_lock ( dpo_id_t dpo)

Take a reference counting lock on the DPO.

Definition at line 364 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_memory_show()

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

Definition at line 605 of file dpo.c.

+ Here is the call graph for this function:

◆ dpo_mk_interpose()

void dpo_mk_interpose ( const dpo_id_t original,
const dpo_id_t parent,
dpo_id_t clone 
)

Make an interpose DPO from an original.

Definition at line 353 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_module_init()

static clib_error_t* dpo_module_init ( vlib_main_t vm)
static

Definition at line 575 of file dpo.c.

+ Here is the call graph for this function:

◆ dpo_proto_to_link()

vnet_link_t dpo_proto_to_link ( dpo_proto_t  dp)

format a DPO protocol

Definition at line 118 of file dpo.c.

+ Here is the caller graph for this function:

◆ dpo_register()

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 322 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_register_new_type()

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 342 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_reset()

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 232 of file dpo.c.

+ Here is the call graph for this function:

◆ dpo_set()

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 186 of file dpo.c.

+ Here is the call graph for this function:

◆ dpo_stack()

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 516 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_stack_from_node()

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 531 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_stack_i()

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 486 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dpo_unlock()

void dpo_unlock ( dpo_id_t dpo)

Release a reference counting lock on the DPO.

Definition at line 373 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_dpo_id()

u8* format_dpo_id ( u8 s,
va_list *  args 
)

Format a DPO_id_t oject

Definition at line 148 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_dpo_proto()

u8* format_dpo_proto ( u8 s,
va_list *  args 
)

format a DPO protocol

Definition at line 178 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_dpo_type()

u8* format_dpo_type ( u8 s,
va_list *  args 
)

format a DPO type

Definition at line 138 of file dpo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_link_to_dpo_proto()

dpo_proto_t vnet_link_to_dpo_proto ( vnet_link_t  linkt)

Definition at line 96 of file dpo.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ dpo_dynamic

dpo_type_t dpo_dynamic = DPO_LAST
static

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

Definition at line 93 of file dpo.c.

◆ dpo_edges

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 graph is traversed, most notably when an MPLS label is popped.

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

Definition at line 87 of file dpo.c.

◆ dpo_nodes

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 71 of file dpo.c.

◆ dpo_proto_names

const char* dpo_proto_names[] = DPO_PROTOS
static

Definition at line 52 of file dpo.c.

◆ dpo_type_names

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 concrete 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 51 of file dpo.c.

◆ dpo_vfts

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 59 of file dpo.c.

◆ show_fib_memory

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:605

(constructor) VLIB_CLI_COMMAND (show_fib_memory)

Definition at line 641 of file dpo.c.