FD.io VPP  v17.01.1-3-gc6833f8
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...
 

Typedefs

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

Functions

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 fib_forward_chain_type_t mpls_tunnel_get_fwd_chain_type (const mpls_tunnel_t *mt)
 Return true if the label stack is imp-null only. 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 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, ip_adjacency_t *adj, vlib_buffer_t *b0)
 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)
 
static u8format_mpls_tunnel_tx_trace (u8 *s, va_list *args)
 
static uword mpls_tunnel_tx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 TX function. More...
 
 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)
 
void vnet_mpls_tunnel_add (fib_route_path_t *rpaths, mpls_label_t *label_stack, u8 l2_only, u32 *sw_if_index)
 Create a new MPLS tunnel. 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_free_hw_if_indices
 Pool of free tunnel SW indices - i.e. More...
 
static u32mpls_tunnel_db
 DB of SW index to tunnel index. 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...
 
static const fib_node_vft_t mpls_vft
 

Typedef Documentation

Packet trace structure.

Function Documentation

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

Definition at line 638 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 294 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 287 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 314 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 209 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* mpls_tunnel_admin_up_down ( vnet_main_t vnm,
u32  hw_if_index,
u32  flags 
)
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:

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 736 of file mpls_tunnel.c.

+ Here is the call graph for this function:

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.

We have choices here; 1 - have an Adjacency with a zero length string and stack it on MPLS label objects 2 - put the label header rewrites in the adjacency string.

We choose 2 since it results in fewer graph nodes in the egress path

Definition at line 93 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 748 of file mpls_tunnel.c.

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

Fixup the adj rewrite post encap.

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

Definition at line 265 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

static mpls_tunnel_t* mpls_tunnel_from_fib_node ( fib_node_t node)
static

Definition at line 723 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

const mpls_tunnel_t* mpls_tunnel_get ( u32  mti)

Definition at line 410 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

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 44 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

static fib_forward_chain_type_t mpls_tunnel_get_fwd_chain_type ( const mpls_tunnel_t mt)
static

Return true if the label stack is imp-null only.

Definition at line 58 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* mpls_tunnel_init ( vlib_main_t vm)
static

Definition at line 781 of file mpls_tunnel.c.

+ Here is the call graph for this function:

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 761 of file mpls_tunnel.c.

static void mpls_tunnel_restack ( mpls_tunnel_t mt)
static

Definition at line 218 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 152 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword mpls_tunnel_tx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

TX function.

Only called L2. L3 traffic uses the adj-midchains

Definition at line 329 of file mpls_tunnel.c.

+ Here is the call graph for this function:

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

Definition at line 272 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mpls_tunnel_walk ( mpls_tunnel_walk_cb_t  cb,
void *  ctx 
)

Walk all the MPLS tunnels.

Definition at line 419 of file mpls_tunnel.c.

+ Here is the caller graph for this function:

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 660 of file mpls_tunnel.c.

+ Here is the call graph for this function:

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 527 of file mpls_tunnel.c.

+ Here is the call graph for this function:

VNET_DEVICE_CLASS ( mpls_tunnel_class  )

+ Here is the caller graph for this function:

VNET_HW_INTERFACE_CLASS ( mpls_tunnel_hw_interface_class  )

+ Here is the caller graph for this function:

void vnet_mpls_tunnel_add ( fib_route_path_t rpaths,
mpls_label_t label_stack,
u8  l2_only,
u32 sw_if_index 
)

Create a new MPLS tunnel.

Definition at line 453 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vnet_mpls_tunnel_del ( u32  sw_if_index)

Definition at line 431 of file mpls_tunnel.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t create_mpls_tunnel_command
static
Initial value:
= {
.path = "mpls tunnel",
.short_help =
"mpls tunnel via [addr] [interface] [out-labels]",
}
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:527

(constructor) VLIB_CLI_COMMAND (create_mpls_tunnel_command)

Definition at line 630 of file mpls_tunnel.c.

u32* mpls_tunnel_db
static

DB of SW index to tunnel index.

Definition at line 38 of file mpls_tunnel.c.

u32* mpls_tunnel_free_hw_if_indices
static

Pool of free tunnel SW indices - i.e.

recycled indices

Definition at line 33 of file mpls_tunnel.c.

mpls_tunnel_t* mpls_tunnel_pool
static

pool of tunnel instances

Definition at line 28 of file mpls_tunnel.c.

const fib_node_vft_t mpls_vft
static
Initial value:
= {
.fnv_last_lock = mpls_tunnel_last_lock_gone,
.fnv_back_walk = 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:736
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:761
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:748

Definition at line 774 of file mpls_tunnel.c.

vlib_cli_command_t show_mpls_tunnel_command
static
Initial value:
= {
.path = "show mpls tunnel",
}
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:660

(constructor) VLIB_CLI_COMMAND (show_mpls_tunnel_command)

Definition at line 717 of file mpls_tunnel.c.