FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
mpls_tunnel.c File Reference
+ Include dependency graph for mpls_tunnel.c:

Go to the source code of this file.

Data Structures

struct  mpls_tunnel_trace_t_
 Packet trace structure. More...
 
struct  mpls_tunnel_collect_forwarding_ctx_t_
 

Typedefs

typedef struct mpls_tunnel_trace_t_ mpls_tunnel_trace_t
 Packet trace structure. More...
 
typedef struct mpls_tunnel_collect_forwarding_ctx_t_ mpls_tunnel_collect_forwarding_ctx_t
 

Enumerations

enum  mpls_tunnel_encap_next_t { MPLS_TUNNEL_ENCAP_NEXT_L2_MIDCHAIN, MPLS_TUNNEL_ENCAP_N_NEXT }
 

Functions

static u8format_mpls_tunnel_tx_trace (u8 *s, va_list *args)
 
VLIB_NODE_FN() mpls_tunnel_tx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 TX function. More...
 
static mpls_tunnel_tmpls_tunnel_get_from_sw_if_index (u32 sw_if_index)
 Get a tunnel object from a SW interface index. More...
 
static u8mpls_tunnel_build_rewrite_i (void)
 Build a rewrite string for the MPLS tunnel. More...
 
static u8mpls_tunnel_build_rewrite (vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
 Build a rewrite string for the MPLS tunnel. More...
 
static fib_path_list_walk_rc_t mpls_tunnel_collect_forwarding (fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
 
static void mpls_tunnel_mk_lb (mpls_tunnel_t *mt, vnet_link_t linkt, fib_forward_chain_type_t fct, dpo_id_t *dpo_lb)
 
static void mpls_tunnel_stack (adj_index_t ai)
 mpls_tunnel_stack More...
 
static adj_walk_rc_t mpls_adj_walk_cb (adj_index_t ai, void *ctx)
 Call back when restacking all adjacencies on a MPLS interface. More...
 
static void mpls_tunnel_restack (mpls_tunnel_t *mt)
 
static clib_error_tmpls_tunnel_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
 
static void mpls_tunnel_fixup (vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
 Fixup the adj rewrite post encap. More...
 
static void mpls_tunnel_update_adj (vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
 
static u8format_mpls_tunnel_name (u8 *s, va_list *args)
 
static u8format_mpls_tunnel_device (u8 *s, va_list *args)
 
 VNET_DEVICE_CLASS (mpls_tunnel_class)
 
 VNET_HW_INTERFACE_CLASS (mpls_tunnel_hw_interface_class)
 
const mpls_tunnel_tmpls_tunnel_get (u32 mti)
 
void mpls_tunnel_walk (mpls_tunnel_walk_cb_t cb, void *ctx)
 Walk all the MPLS tunnels. More...
 
void vnet_mpls_tunnel_del (u32 sw_if_index)
 Delete an MPLS tunnel. More...
 
u32 vnet_mpls_tunnel_create (u8 l2_only, u8 is_multicast, u8 *tag)
 Create a new MPLS tunnel. More...
 
void vnet_mpls_tunnel_path_add (u32 sw_if_index, fib_route_path_t *rpaths)
 Add a path to an MPLS tunnel. More...
 
int vnet_mpls_tunnel_path_remove (u32 sw_if_index, fib_route_path_t *rpaths)
 remove a path from a tunnel. More...
 
int vnet_mpls_tunnel_get_index (u32 sw_if_index)
 return the tunnel index from the sw_if_index More...
 
static clib_error_tvnet_create_mpls_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u8format_mpls_tunnel (u8 *s, va_list *args)
 
static clib_error_tshow_mpls_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static mpls_tunnel_tmpls_tunnel_from_fib_node (fib_node_t *node)
 
static fib_node_back_walk_rc_t mpls_tunnel_back_walk (fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
 Function definition to backwalk a FIB node. More...
 
static fib_node_tmpls_tunnel_fib_node_get (fib_node_index_t index)
 Function definition to get a FIB node from its index. More...
 
static void mpls_tunnel_last_lock_gone (fib_node_t *node)
 Function definition to inform the FIB node that its last lock has gone. More...
 
static clib_error_tmpls_tunnel_init (vlib_main_t *vm)
 

Variables

static mpls_tunnel_tmpls_tunnel_pool
 pool of tunnel instances More...
 
static u32mpls_tunnel_db
 DB of SW index to tunnel index. More...
 
static const char * mpls_tunnel_attribute_names [] = MPLS_TUNNEL_ATTRIBUTES
 MPLS tunnel flags strings. More...
 
vlib_node_registration_t mpls_tunnel_tx
 (constructor) VLIB_REGISTER_NODE (mpls_tunnel_tx) More...
 
static vlib_cli_command_t create_mpls_tunnel_command
 (constructor) VLIB_CLI_COMMAND (create_mpls_tunnel_command) More...
 
static vlib_cli_command_t show_mpls_tunnel_command
 (constructor) VLIB_CLI_COMMAND (show_mpls_tunnel_command) More...
 
const static fib_node_vft_t mpls_vft
 

Typedef Documentation

◆ mpls_tunnel_collect_forwarding_ctx_t

◆ mpls_tunnel_trace_t

Packet trace structure.

Enumeration Type Documentation

◆ mpls_tunnel_encap_next_t

Enumerator
MPLS_TUNNEL_ENCAP_NEXT_L2_MIDCHAIN 
MPLS_TUNNEL_ENCAP_N_NEXT 

Definition at line 66 of file mpls_tunnel.c.

Function Documentation

◆ format_mpls_tunnel()

static u8* format_mpls_tunnel ( u8 s,
va_list *  args 
)
static

Definition at line 938 of file mpls_tunnel.c.

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

◆ format_mpls_tunnel_device()

static u8* format_mpls_tunnel_device ( u8 s,
va_list *  args 
)
static

Definition at line 582 of file mpls_tunnel.c.

◆ format_mpls_tunnel_name()

static u8* format_mpls_tunnel_name ( u8 s,
va_list *  args 
)
static

Definition at line 575 of file mpls_tunnel.c.

◆ format_mpls_tunnel_tx_trace()

static u8* format_mpls_tunnel_tx_trace ( u8 s,
va_list *  args 
)
static

Definition at line 55 of file mpls_tunnel.c.

◆ mpls_adj_walk_cb()

static adj_walk_rc_t mpls_adj_walk_cb ( adj_index_t  ai,
void *  ctx 
)
static

Call back when restacking all adjacencies on a MPLS interface.

Definition at line 437 of file mpls_tunnel.c.

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

◆ mpls_tunnel_admin_up_down()

static clib_error_t* mpls_tunnel_admin_up_down ( vnet_main_t vnm,
u32  hw_if_index,
u32  flags 
)
static

Definition at line 483 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_back_walk()

static fib_node_back_walk_rc_t mpls_tunnel_back_walk ( fib_node_t node,
fib_node_back_walk_ctx_t ctx 
)
static

Function definition to backwalk a FIB node.

Definition at line 1046 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_build_rewrite()

static u8* mpls_tunnel_build_rewrite ( vnet_main_t vnm,
u32  sw_if_index,
vnet_link_t  link_type,
const void *  dst_address 
)
static

Build a rewrite string for the MPLS tunnel.

Definition at line 219 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_build_rewrite_i()

static u8* mpls_tunnel_build_rewrite_i ( void  )
static

Build a rewrite string for the MPLS tunnel.

Definition at line 199 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ mpls_tunnel_collect_forwarding()

static fib_path_list_walk_rc_t mpls_tunnel_collect_forwarding ( fib_node_index_t  pl_index,
fib_node_index_t  path_index,
void *  arg 
)
static

Definition at line 235 of file mpls_tunnel.c.

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

◆ mpls_tunnel_fib_node_get()

static fib_node_t* mpls_tunnel_fib_node_get ( fib_node_index_t  index)
static

Function definition to get a FIB node from its index.

Definition at line 1058 of file mpls_tunnel.c.

◆ mpls_tunnel_fixup()

static void mpls_tunnel_fixup ( vlib_main_t vm,
const ip_adjacency_t adj,
vlib_buffer_t b0,
const void *  data 
)
static

Fixup the adj rewrite post encap.

This is a no-op since the rewrite is a stack of labels.

Definition at line 513 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ mpls_tunnel_from_fib_node()

static mpls_tunnel_t* mpls_tunnel_from_fib_node ( fib_node_t node)
static

Definition at line 1035 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ mpls_tunnel_get()

const mpls_tunnel_t* mpls_tunnel_get ( u32  mti)

Definition at line 606 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ mpls_tunnel_get_from_sw_if_index()

static mpls_tunnel_t* mpls_tunnel_get_from_sw_if_index ( u32  sw_if_index)
static

Get a tunnel object from a SW interface index.

Definition at line 185 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ mpls_tunnel_init()

static clib_error_t* mpls_tunnel_init ( vlib_main_t vm)
static

Definition at line 1091 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_last_lock_gone()

static void mpls_tunnel_last_lock_gone ( fib_node_t node)
static

Function definition to inform the FIB node that its last lock has gone.

Definition at line 1071 of file mpls_tunnel.c.

◆ mpls_tunnel_mk_lb()

static void mpls_tunnel_mk_lb ( mpls_tunnel_t mt,
vnet_link_t  linkt,
fib_forward_chain_type_t  fct,
dpo_id_t dpo_lb 
)
static

Definition at line 277 of file mpls_tunnel.c.

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

◆ mpls_tunnel_restack()

static void mpls_tunnel_restack ( mpls_tunnel_t mt)
static

Definition at line 446 of file mpls_tunnel.c.

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

◆ mpls_tunnel_stack()

static void mpls_tunnel_stack ( adj_index_t  ai)
static

mpls_tunnel_stack

'stack' (resolve the recursion for) the tunnel's midchain adjacency

Definition at line 371 of file mpls_tunnel.c.

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

◆ mpls_tunnel_tx()

VLIB_NODE_FN() mpls_tunnel_tx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

TX function.

Only called L2. L3 traffic uses the adj-midchains

Definition at line 75 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_update_adj()

static void mpls_tunnel_update_adj ( vnet_main_t vnm,
u32  sw_if_index,
adj_index_t  ai 
)
static

Definition at line 527 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ mpls_tunnel_walk()

void mpls_tunnel_walk ( mpls_tunnel_walk_cb_t  cb,
void *  ctx 
)

Walk all the MPLS tunnels.

Definition at line 615 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

◆ show_mpls_tunnel_command_fn()

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

Definition at line 972 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ vnet_create_mpls_tunnel_command_fn()

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

Definition at line 842 of file mpls_tunnel.c.

+ Here is the call graph for this function:

◆ VNET_DEVICE_CLASS()

VNET_DEVICE_CLASS ( mpls_tunnel_class  )

◆ VNET_HW_INTERFACE_CLASS()

VNET_HW_INTERFACE_CLASS ( mpls_tunnel_hw_interface_class  )

◆ vnet_mpls_tunnel_create()

u32 vnet_mpls_tunnel_create ( u8  l2_only,
u8  is_multicast,
u8 description 
)

Create a new MPLS tunnel.

Returns
the SW Interface index of the newly created tuneel

Definition at line 648 of file mpls_tunnel.c.

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

◆ vnet_mpls_tunnel_del()

void vnet_mpls_tunnel_del ( u32  sw_if_index)

Delete an MPLS tunnel.

Definition at line 627 of file mpls_tunnel.c.

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

◆ vnet_mpls_tunnel_get_index()

int vnet_mpls_tunnel_get_index ( u32  sw_if_index)

return the tunnel index from the sw_if_index

Definition at line 829 of file mpls_tunnel.c.

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

◆ vnet_mpls_tunnel_path_add()

void vnet_mpls_tunnel_path_add ( u32  sw_if_index,
fib_route_path_t rpaths 
)

Add a path to an MPLS tunnel.

Definition at line 703 of file mpls_tunnel.c.

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

◆ vnet_mpls_tunnel_path_remove()

int vnet_mpls_tunnel_path_remove ( u32  sw_if_index,
fib_route_path_t rpath 
)

remove a path from a tunnel.

Returns
the number of remaining paths. 0 implies the tunnel can be deleted

Definition at line 759 of file mpls_tunnel.c.

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

Variable Documentation

◆ create_mpls_tunnel_command

vlib_cli_command_t create_mpls_tunnel_command
static
Initial value:
= {
.path = "mpls tunnel",
.short_help =
"mpls tunnel [multicast] [l2-only] via [next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight <value>] [preference <value>] [udp-encap-id <value>] [ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <interface>] [out-labels <value value value>]",
}

(constructor) VLIB_CLI_COMMAND (create_mpls_tunnel_command)

Definition at line 930 of file mpls_tunnel.c.

◆ mpls_tunnel_attribute_names

const char* mpls_tunnel_attribute_names[] = MPLS_TUNNEL_ATTRIBUTES
static

MPLS tunnel flags strings.

Definition at line 41 of file mpls_tunnel.c.

◆ mpls_tunnel_db

u32* mpls_tunnel_db
static

DB of SW index to tunnel index.

Definition at line 36 of file mpls_tunnel.c.

◆ mpls_tunnel_pool

mpls_tunnel_t* mpls_tunnel_pool
static

pool of tunnel instances

Definition at line 31 of file mpls_tunnel.c.

◆ mpls_tunnel_tx

vlib_node_registration_t mpls_tunnel_tx
Initial value:
=
{
.name = "mpls-tunnel-tx",
.vector_size = sizeof (u32),
.format_trace = format_mpls_tunnel_tx_trace,
.n_errors = 0,
.n_next_nodes = 0,
}

(constructor) VLIB_REGISTER_NODE (mpls_tunnel_tx)

Definition at line 167 of file mpls_tunnel.c.

◆ mpls_vft

const static fib_node_vft_t mpls_vft
static
Initial value:
= {
.fnv_last_lock = mpls_tunnel_last_lock_gone,
.fnv_back_walk = mpls_tunnel_back_walk,
}

Definition at line 1084 of file mpls_tunnel.c.

◆ show_mpls_tunnel_command

vlib_cli_command_t show_mpls_tunnel_command
static
Initial value:
= {
.path = "show mpls tunnel",
}

(constructor) VLIB_CLI_COMMAND (show_mpls_tunnel_command)

Definition at line 1029 of file mpls_tunnel.c.

vnet_create_mpls_tunnel_command_fn
static clib_error_t * vnet_create_mpls_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: mpls_tunnel.c:842
mpls_tunnel_fib_node_get
static fib_node_t * mpls_tunnel_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
Definition: mpls_tunnel.c:1058
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
format_mpls_tunnel_tx_trace
static u8 * format_mpls_tunnel_tx_trace(u8 *s, va_list *args)
Definition: mpls_tunnel.c:55
mpls_tunnel_last_lock_gone
static void mpls_tunnel_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
Definition: mpls_tunnel.c:1071
u32
unsigned int u32
Definition: types.h:88
show_mpls_tunnel_command_fn
static clib_error_t * show_mpls_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: mpls_tunnel.c:972
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
mpls_tunnel_back_walk
static fib_node_back_walk_rc_t mpls_tunnel_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node.
Definition: mpls_tunnel.c:1046