FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
sr_localsid.c File Reference

Processing of packets with a SRH. More...

+ Include dependency graph for sr_localsid.c:

Go to the source code of this file.

Data Structures

struct  sr_localsid_trace_t
 SR localsid node trace. More...
 

Macros

#define foreach_sr_localsid_error
 
#define foreach_sr_localsid_next
 

Enumerations

enum  sr_localsid_error_t { SR_LOCALSID_N_ERROR }
 
enum  sr_localsid_next_t { SR_LOCALSID_N_NEXT }
 

Functions

int sr_cli_localsid (char is_del, ip6_address_t *localsid_addr, char end_psp, u8 behavior, u32 sw_if_index, u32 vlan_index, u32 fib_table, ip46_address_t *nh_addr, void *ls_plugin_mem)
 SR localsid add/del. More...
 
static clib_error_tsr_cli_localsid_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 SR LocalSID CLI function. More...
 
static clib_error_tshow_sr_localsid_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to 'show' all SR LocalSIDs on console. More...
 
static clib_error_tclear_sr_localsid_counters_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Function to 'clear' ALL SR localsid counters. More...
 
u8format_sr_localsid_trace (u8 *s, va_list *args)
 SR LocalSID graph node trace function. More...
 
static_always_inline void end_srh_processing (vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0, u8 psp, ip6_ext_header_t *prev0)
 Function doing End processing. More...
 
static_always_inline void end_decaps_srh_processing (vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0)
 
static uword sr_localsid_d_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 SR LocalSID graph node. More...
 
static uword sr_localsid_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 SR LocalSID graph node. More...
 
static u8format_sr_dpo (u8 *s, va_list *args)
 
int sr_localsid_register_function (vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_plugin_callback_t *creation_fn, sr_plugin_callback_t *removal_fn)
 SR LocalSID plugin registry. More...
 
static clib_error_tshow_sr_localsid_behaviors_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to 'show' all available SR LocalSID behaviors. More...
 
clib_error_tsr_localsids_init (vlib_main_t *vm)
 SR LocalSID initialization. More...
 

Variables

static dpo_type_t sr_localsid_dpo_type
 Dynamically added SR localsid DPO type. More...
 
static dpo_type_t sr_localsid_d_dpo_type
 
static vlib_cli_command_t sr_localsid_command
 (constructor) VLIB_CLI_COMMAND (sr_localsid_command) More...
 
static vlib_cli_command_t show_sr_localsid_command
 (constructor) VLIB_CLI_COMMAND (show_sr_localsid_command) More...
 
static vlib_cli_command_t clear_sr_localsid_counters_command
 (constructor) VLIB_CLI_COMMAND (clear_sr_localsid_counters_command) More...
 
static char * sr_localsid_error_strings []
 
vlib_node_registration_t sr_localsid_d_node
 (constructor) VLIB_REGISTER_NODE (sr_localsid_d_node) More...
 
vlib_node_registration_t sr_localsid_node
 (constructor) VLIB_REGISTER_NODE (sr_localsid_node) More...
 
static const dpo_vft_t sr_loc_vft
 
static const char *const sr_loc_ip6_nodes []
 
static const char *const *const sr_loc_nodes [DPO_PROTO_NUM]
 
static const char *const sr_loc_d_ip6_nodes []
 
static const char *const *const sr_loc_d_nodes [DPO_PROTO_NUM]
 
static vlib_cli_command_t show_sr_localsid_behaviors_command
 (constructor) VLIB_CLI_COMMAND (show_sr_localsid_behaviors_command) More...
 

Detailed Description

Processing of packets with a SRH.

CLI to define new Segment Routing End processing functions. Graph node to support such functions.

Each function associates an SRv6 segment (IPv6 address) with an specific Segment Routing function.

Definition in file sr_localsid.c.

Macro Definition Documentation

#define foreach_sr_localsid_error
Value:
_(NO_INNER_HEADER, "(SR-Error) No inner IP header") \
_(NO_MORE_SEGMENTS, "(SR-Error) No more segments") \
_(NO_SRH, "(SR-Error) No SR header") \
_(NO_PSP, "(SR-Error) PSP Not available (segments left > 0)") \
_(NOT_LS, "(SR-Error) Decaps not available (segments left > 0)") \
_(L2, "(SR-Error) SRv6 decapsulated a L2 frame without dest")

Definition at line 597 of file sr_localsid.c.

#define foreach_sr_localsid_next
Value:
_(ERROR, "error-drop") \
_(IP6_LOOKUP, "ip6-lookup") \
_(IP4_LOOKUP, "ip4-lookup") \
_(IP6_REWRITE, "ip6-rewrite") \
_(IP4_REWRITE, "ip4-rewrite") \
_(INTERFACE_OUTPUT, "interface-output")

Definition at line 619 of file sr_localsid.c.

Enumeration Type Documentation

Enumerator
SR_LOCALSID_N_ERROR 

Definition at line 605 of file sr_localsid.c.

Enumerator
SR_LOCALSID_N_NEXT 

Definition at line 627 of file sr_localsid.c.

Function Documentation

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

Function to 'clear' ALL SR localsid counters.

Definition at line 564 of file sr_localsid.c.

+ Here is the call graph for this function:

static_always_inline void end_decaps_srh_processing ( vlib_node_runtime_t node,
vlib_buffer_t b0,
ip6_header_t ip0,
ip6_sr_header_t sr0,
ip6_sr_localsid_t ls0,
u32 next0 
)

Definition at line 799 of file sr_localsid.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void end_srh_processing ( vlib_node_runtime_t node,
vlib_buffer_t b0,
ip6_header_t ip0,
ip6_sr_header_t sr0,
ip6_sr_localsid_t ls0,
u32 next0,
u8  psp,
ip6_ext_header_t *  prev0 
)

Function doing End processing.

Definition at line 702 of file sr_localsid.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1488 of file sr_localsid.c.

+ Here is the call graph for this function:

u8* format_sr_localsid_trace ( u8 s,
va_list *  args 
)

SR LocalSID graph node trace function.

See also
sr_localsid

Definition at line 641 of file sr_localsid.c.

+ Here is the call graph for this function:

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

CLI function to 'show' all available SR LocalSID behaviors.

Definition at line 1574 of file sr_localsid.c.

+ Here is the call graph for this function:

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

CLI function to 'show' all SR LocalSIDs on console.

Definition at line 441 of file sr_localsid.c.

+ Here is the call graph for this function:

int sr_cli_localsid ( char  is_del,
ip6_address_t localsid_addr,
char  end_psp,
u8  behavior,
u32  sw_if_index,
u32  vlan_index,
u32  fib_table,
ip46_address_t *  nh_addr,
void *  ls_plugin_mem 
)

SR localsid add/del.

Function to add or delete SR LocalSIDs.

Parameters
is_delBoolean of whether its a delete instruction
localsid_addrIPv6 address of the localsid
is_decapBoolean of whether decapsulation is allowed in this function
behaviorType of behavior (function) for this localsid
sw_if_indexOnly for L2/L3 xconnect. OIF. In VRF variant the fib_table.
vlan_indexOnly for L2 xconnect. Outgoing VLAN tag.
fib_tableFIB table in which we should install the localsid entry
nh_addrNext Hop IPv4/IPv6 address. Only for L2/L3 xconnect.
Returns
0 on success, error otherwise.

Definition at line 66 of file sr_localsid.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

SR LocalSID CLI function.

See also
sr_cli_localsid

Definition at line 263 of file sr_localsid.c.

+ Here is the call graph for this function:

static uword sr_localsid_d_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

SR LocalSID graph node.

Supports all default SR Endpoint variants with decaps

Definition at line 883 of file sr_localsid.c.

+ Here is the call graph for this function:

static uword sr_localsid_fn ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

SR LocalSID graph node.

Supports all default SR Endpoint without decaps

Definition at line 1186 of file sr_localsid.c.

+ Here is the call graph for this function:

int sr_localsid_register_function ( vlib_main_t vm,
u8 fn_name,
u8 keyword_str,
u8 def_str,
u8 params_str,
dpo_type_t dpo,
format_function_t ls_format,
unformat_function_t ls_unformat,
sr_plugin_callback_t creation_fn,
sr_plugin_callback_t removal_fn 
)

SR LocalSID plugin registry.

Definition at line 1526 of file sr_localsid.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* sr_localsids_init ( vlib_main_t vm)

SR LocalSID initialization.

Definition at line 1631 of file sr_localsid.c.

+ Here is the call graph for this function:

Variable Documentation

vlib_cli_command_t clear_sr_localsid_counters_command
static
Initial value:
= {
.path = "clear sr localsid-counters",
.short_help = "clear sr localsid-counters",
}
static clib_error_t * clear_sr_localsid_counters_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Function to 'clear' ALL SR localsid counters.
Definition: sr_localsid.c:564

(constructor) VLIB_CLI_COMMAND (clear_sr_localsid_counters_command)

Definition at line 577 of file sr_localsid.c.

vlib_cli_command_t show_sr_localsid_behaviors_command
static
Initial value:
= {
.path = "show sr localsids behaviors",
.short_help = "show sr localsids behaviors",
}
static clib_error_t * show_sr_localsid_behaviors_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to 'show' all available SR LocalSID behaviors.
Definition: sr_localsid.c:1574

(constructor) VLIB_CLI_COMMAND (show_sr_localsid_behaviors_command)

Definition at line 1620 of file sr_localsid.c.

vlib_cli_command_t show_sr_localsid_command
static
Initial value:
= {
.path = "show sr localsids",
.short_help = "show sr localsids",
}
static clib_error_t * show_sr_localsid_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to 'show' all SR LocalSIDs on console.
Definition: sr_localsid.c:441

(constructor) VLIB_CLI_COMMAND (show_sr_localsid_command)

Definition at line 553 of file sr_localsid.c.

const char* const sr_loc_d_ip6_nodes[]
static
Initial value:
= {
"sr-localsid-d",
}
#define NULL
Definition: clib.h:55

Definition at line 1511 of file sr_localsid.c.

const char* const* const sr_loc_d_nodes[DPO_PROTO_NUM]
static
Initial value:
= {
}
static const char *const sr_loc_d_ip6_nodes[]
Definition: sr_localsid.c:1511

Definition at line 1516 of file sr_localsid.c.

const char* const sr_loc_ip6_nodes[]
static
Initial value:
= {
"sr-localsid",
}
#define NULL
Definition: clib.h:55

Definition at line 1502 of file sr_localsid.c.

const char* const* const sr_loc_nodes[DPO_PROTO_NUM]
static
Initial value:
= {
}
static const char *const sr_loc_ip6_nodes[]
Definition: sr_localsid.c:1502

Definition at line 1507 of file sr_localsid.c.

const dpo_vft_t sr_loc_vft
static
Initial value:
= {
.dv_lock = sr_dpo_lock,
.dv_unlock = sr_dpo_unlock,
.dv_format = format_sr_dpo,
}
void sr_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
Definition: sr.c:47
void sr_dpo_lock(dpo_id_t *dpo)
no-op lock function.
Definition: sr.c:38
static u8 * format_sr_dpo(u8 *s, va_list *args)
Definition: sr_localsid.c:1488

Definition at line 1496 of file sr_localsid.c.

vlib_cli_command_t sr_localsid_command
static
Initial value:
= {
.path = "sr localsid",
.short_help = "sr localsid (del) address XX:XX::YY:YY"
"(fib-table 8) behavior STRING",
.long_help =
"Create SR LocalSID and binds it to a particular behavior\n"
"Arguments:\n"
"\tlocalSID IPv6_addr(128b) LocalSID IPv6 address\n"
"\t(fib-table X) Optional. VRF where to install SRv6 localsid\n"
"\tbehavior STRING Specifies the behavior\n"
"\n\tBehaviors:\n"
"\tEnd\t-> Endpoint.\n"
"\tEnd.X\t-> Endpoint with decapsulation and Layer-3 cross-connect.\n"
"\t\tParameters: '<iface> <ip6_next_hop>'\n"
"\tEnd.DX2\t-> Endpoint with decapsulation and Layer-2 cross-connect.\n"
"\t\tParameters: '<iface>'\n"
"\tEnd.DX6\t-> Endpoint with decapsulation and IPv6 cross-connect.\n"
"\t\tParameters: '<iface> <ip6_next_hop>'\n"
"\tEnd.DX4\t-> Endpoint with decapsulation and IPv4 cross-connect.\n"
"\t\tParameters: '<iface> <ip4_next_hop>'\n"
"\tEnd.DT6\t-> Endpoint with decapsulation and specific IPv6 table lookup.\n"
"\t\tParameters: '<ip6_fib_table>'\n"
"\tEnd.DT4\t-> Endpoint with decapsulation and specific IPv4 table lookup.\n"
"\t\tParameters: '<ip4_fib_table>'\n",
}
static clib_error_t * sr_cli_localsid_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
SR LocalSID CLI function.
Definition: sr_localsid.c:263

(constructor) VLIB_CLI_COMMAND (sr_localsid_command)

Definition at line 409 of file sr_localsid.c.

dpo_type_t sr_localsid_d_dpo_type
static

Definition at line 47 of file sr_localsid.c.

vlib_node_registration_t sr_localsid_d_node
Initial value:
= {
.function = sr_localsid_d_fn,
.name = "sr-localsid-d",
.vector_size = sizeof (u32),
.format_trace = format_sr_localsid_trace,
.n_errors = SR_LOCALSID_N_ERROR,
.error_strings = sr_localsid_error_strings,
.n_next_nodes = SR_LOCALSID_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
static char * sr_localsid_error_strings[]
Definition: sr_localsid.c:613
u8 * format_sr_localsid_trace(u8 *s, va_list *args)
SR LocalSID graph node trace function.
Definition: sr_localsid.c:641
static uword sr_localsid_d_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
SR LocalSID graph node.
Definition: sr_localsid.c:883
unsigned int u32
Definition: types.h:88
#define foreach_sr_localsid_next
Definition: sr_localsid.c:619

(constructor) VLIB_REGISTER_NODE (sr_localsid_d_node)

Definition at line 1165 of file sr_localsid.c.

dpo_type_t sr_localsid_dpo_type
static

Dynamically added SR localsid DPO type.

Definition at line 46 of file sr_localsid.c.

char* sr_localsid_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_sr_localsid_error
Definition: sr_localsid.c:597

Definition at line 613 of file sr_localsid.c.

vlib_node_registration_t sr_localsid_node
Initial value:
= {
.function = sr_localsid_fn,
.name = "sr-localsid",
.vector_size = sizeof (u32),
.format_trace = format_sr_localsid_trace,
.n_errors = SR_LOCALSID_N_ERROR,
.error_strings = sr_localsid_error_strings,
.n_next_nodes = SR_LOCALSID_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
static char * sr_localsid_error_strings[]
Definition: sr_localsid.c:613
u8 * format_sr_localsid_trace(u8 *s, va_list *args)
SR LocalSID graph node trace function.
Definition: sr_localsid.c:641
unsigned int u32
Definition: types.h:88
static uword sr_localsid_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
SR LocalSID graph node.
Definition: sr_localsid.c:1186
#define foreach_sr_localsid_next
Definition: sr_localsid.c:619

(constructor) VLIB_REGISTER_NODE (sr_localsid_node)

Definition at line 1470 of file sr_localsid.c.