FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
sr.h File Reference

Segment Routing data structures definitions. More...

+ Include dependency graph for sr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ip6srv_combo_header_t
 
struct  ip6_sr_sl_t
 SR Segment List (SID list) More...
 
struct  ip6_sr_policy_t
 SR Policy. More...
 
struct  ip6_sr_localsid_t
 SR LocalSID. More...
 
struct  sr_localsid_fn_registration_t
 SR LocalSID behavior registration. More...
 
struct  sr_policy_fn_registration_t
 SR Policy behavior registration. More...
 
struct  sr_steering_key_t
 Steering db key. More...
 
struct  ip6_sr_steering_policy_t
 
struct  sr_localsid_key_t
 
struct  ip6_sr_main_t
 Segment Routing main datastructure. More...
 

Macros

#define IPv6_DEFAULT_HEADER_LENGTH   40
 
#define IPv6_DEFAULT_HOP_LIMIT   64
 
#define IPv6_DEFAULT_MAX_MASK_WIDTH   128
 
#define SR_BEHAVIOR_END   1
 
#define SR_BEHAVIOR_X   2
 
#define SR_BEHAVIOR_T   3
 
#define SR_BEHAVIOR_D_FIRST   4 /* Unused. Separator in between regular and D */
 
#define SR_BEHAVIOR_DX2   5
 
#define SR_BEHAVIOR_DX6   6
 
#define SR_BEHAVIOR_DX4   7
 
#define SR_BEHAVIOR_DT6   8
 
#define SR_BEHAVIOR_DT4   9
 
#define SR_BEHAVIOR_END_UN_PERF   10
 
#define SR_BEHAVIOR_END_UN   11
 
#define SR_BEHAVIOR_LAST   12 /* Must always be the last one */
 
#define SR_STEER_L2   2
 
#define SR_STEER_IPV4   4
 
#define SR_STEER_IPV6   6
 
#define SR_FUNCTION_SIZE   4
 
#define SR_ARGUMENT_SIZE   4
 
#define SR_SEGMENT_LIST_WEIGHT_DEFAULT   1
 
#define SR_POLICY_TYPE_DEFAULT   0
 
#define SR_POLICY_TYPE_SPRAY   1
 

Typedefs

typedef int() sr_p_plugin_callback_t(ip6_sr_policy_t *sr)
 
typedef int() sr_plugin_callback_t(ip6_sr_localsid_t *localsid)
 

Functions

void sr_dpo_lock (dpo_id_t *dpo)
 no-op lock function. More...
 
void sr_dpo_unlock (dpo_id_t *dpo)
 no-op unlock function. More...
 
int sr_localsid_register_function (vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, 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...
 
int sr_policy_register_function (vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_p_plugin_callback_t *creation_fn, sr_p_plugin_callback_t *removal_fn)
 SR Policy plugin registry. More...
 
int sr_policy_add (ip6_address_t *bsid, ip6_address_t *segments, u32 weight, u8 behavior, u32 fib_table, u8 is_encap, u16 plugin, void *plugin_mem)
 Create a new SR policy. More...
 
int sr_policy_mod (ip6_address_t *bsid, u32 index, u32 fib_table, u8 operation, ip6_address_t *segments, u32 sl_index, u32 weight)
 Modify an existing SR policy. More...
 
int sr_policy_del (ip6_address_t *bsid, u32 index)
 Delete a SR policy. More...
 
int sr_cli_localsid (char is_del, ip6_address_t *localsid_addr, u16 localsid_prefix_len, char end_psp, u8 behavior, u32 sw_if_index, u32 vlan_index, u32 fib_table, ip46_address_t *nh_addr, int usid_len, void *ls_plugin_mem)
 SR localsid add/del. More...
 
int sr_steering_policy (int is_del, ip6_address_t *bsid, u32 sr_policy_index, u32 table_id, ip46_address_t *prefix, u32 mask_width, u32 sw_if_index, u8 traffic_type)
 Steer traffic L2 and L3 traffic through a given SR policy. More...
 
void sr_set_source (ip6_address_t *address)
 
ip6_address_t * sr_get_encaps_source ()
 
void sr_set_hop_limit (u8 hop_limit)
 
u8 sr_get_hop_limit (void)
 
static u8ip6_sr_compute_rewrite_string_insert (ip6_address_t *sl)
 SR rewrite string computation for SRH insertion (inline) More...
 

Variables

ip6_sr_main_t sr_main
 
vlib_node_registration_t sr_policy_rewrite_encaps_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node) More...
 
vlib_node_registration_t sr_policy_rewrite_insert_node
 (constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node) More...
 
vlib_node_registration_t sr_localsid_node
 (constructor) VLIB_REGISTER_NODE (sr_localsid_node) More...
 
vlib_node_registration_t sr_localsid_d_node
 (constructor) VLIB_REGISTER_NODE (sr_localsid_d_node) More...
 

Detailed Description

Segment Routing data structures definitions.

Definition in file sr.h.

Macro Definition Documentation

◆ IPv6_DEFAULT_HEADER_LENGTH

#define IPv6_DEFAULT_HEADER_LENGTH   40

Definition at line 33 of file sr.h.

◆ IPv6_DEFAULT_HOP_LIMIT

#define IPv6_DEFAULT_HOP_LIMIT   64

Definition at line 34 of file sr.h.

◆ IPv6_DEFAULT_MAX_MASK_WIDTH

#define IPv6_DEFAULT_MAX_MASK_WIDTH   128

Definition at line 35 of file sr.h.

◆ SR_ARGUMENT_SIZE

#define SR_ARGUMENT_SIZE   4

Definition at line 55 of file sr.h.

◆ SR_BEHAVIOR_D_FIRST

#define SR_BEHAVIOR_D_FIRST   4 /* Unused. Separator in between regular and D */

Definition at line 40 of file sr.h.

◆ SR_BEHAVIOR_DT4

#define SR_BEHAVIOR_DT4   9

Definition at line 45 of file sr.h.

◆ SR_BEHAVIOR_DT6

#define SR_BEHAVIOR_DT6   8

Definition at line 44 of file sr.h.

◆ SR_BEHAVIOR_DX2

#define SR_BEHAVIOR_DX2   5

Definition at line 41 of file sr.h.

◆ SR_BEHAVIOR_DX4

#define SR_BEHAVIOR_DX4   7

Definition at line 43 of file sr.h.

◆ SR_BEHAVIOR_DX6

#define SR_BEHAVIOR_DX6   6

Definition at line 42 of file sr.h.

◆ SR_BEHAVIOR_END

#define SR_BEHAVIOR_END   1

Definition at line 37 of file sr.h.

◆ SR_BEHAVIOR_END_UN

#define SR_BEHAVIOR_END_UN   11

Definition at line 47 of file sr.h.

◆ SR_BEHAVIOR_END_UN_PERF

#define SR_BEHAVIOR_END_UN_PERF   10

Definition at line 46 of file sr.h.

◆ SR_BEHAVIOR_LAST

#define SR_BEHAVIOR_LAST   12 /* Must always be the last one */

Definition at line 48 of file sr.h.

◆ SR_BEHAVIOR_T

#define SR_BEHAVIOR_T   3

Definition at line 39 of file sr.h.

◆ SR_BEHAVIOR_X

#define SR_BEHAVIOR_X   2

Definition at line 38 of file sr.h.

◆ SR_FUNCTION_SIZE

#define SR_FUNCTION_SIZE   4

Definition at line 54 of file sr.h.

◆ SR_POLICY_TYPE_DEFAULT

#define SR_POLICY_TYPE_DEFAULT   0

Definition at line 90 of file sr.h.

◆ SR_POLICY_TYPE_SPRAY

#define SR_POLICY_TYPE_SPRAY   1

Definition at line 91 of file sr.h.

◆ SR_SEGMENT_LIST_WEIGHT_DEFAULT

#define SR_SEGMENT_LIST_WEIGHT_DEFAULT   1

Definition at line 57 of file sr.h.

◆ SR_STEER_IPV4

#define SR_STEER_IPV4   4

Definition at line 51 of file sr.h.

◆ SR_STEER_IPV6

#define SR_STEER_IPV6   6

Definition at line 52 of file sr.h.

◆ SR_STEER_L2

#define SR_STEER_L2   2

Definition at line 50 of file sr.h.

Typedef Documentation

◆ sr_p_plugin_callback_t

typedef int() sr_p_plugin_callback_t(ip6_sr_policy_t *sr)

Definition at line 117 of file sr.h.

◆ sr_plugin_callback_t

typedef int() sr_plugin_callback_t(ip6_sr_localsid_t *localsid)

Definition at line 158 of file sr.h.

Function Documentation

◆ ip6_sr_compute_rewrite_string_insert()

static u8* ip6_sr_compute_rewrite_string_insert ( ip6_address_t *  sl)
inlinestatic

SR rewrite string computation for SRH insertion (inline)

Parameters
slis a vector of IPv6 addresses composing the Segment List
Returns
precomputed rewrite string for SRH insertion

Definition at line 378 of file sr.h.

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

◆ sr_cli_localsid()

int sr_cli_localsid ( char  is_del,
ip6_address_t *  localsid_addr,
u16  localsid_prefix_len,
char  end_psp,
u8  behavior,
u32  sw_if_index,
u32  vlan_index,
u32  fib_table,
ip46_address_t *  nh_addr,
int  usid_len,
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 77 of file sr_localsid.c.

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

◆ sr_dpo_lock()

void sr_dpo_lock ( dpo_id_t dpo)

no-op lock function.

The lifetime of the SR entry is managed by the control plane

Definition at line 38 of file sr.c.

◆ sr_dpo_unlock()

void sr_dpo_unlock ( dpo_id_t dpo)

no-op unlock function.

The lifetime of the SR entry is managed by the control plane

Definition at line 47 of file sr.c.

◆ sr_get_encaps_source()

ip6_address_t* sr_get_encaps_source ( )

Definition at line 123 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_get_hop_limit()

u8 sr_get_hop_limit ( void  )

Definition at line 160 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_localsid_register_function()

int sr_localsid_register_function ( vlib_main_t vm,
u8 fn_name,
u8 keyword_str,
u8 def_str,
u8 params_str,
u8  prefix_length,
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 2347 of file sr_localsid.c.

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

◆ sr_policy_add()

int sr_policy_add ( ip6_address_t *  bsid,
ip6_address_t *  segments,
u32  weight,
u8  behavior,
u32  fib_table,
u8  is_encap,
u16  plugin,
void *  ls_plugin_mem 
)

Create a new SR policy.

Parameters
bsidis the bindingSID of the SR Policy
segmentsis a vector of IPv6 address composing the segment list
weightis the weight of the sid list. optional.
behavioris the behavior of the SR policy. (default//spray)
fib_tableis the VRF where to install the FIB entry for the BSID
is_encap(bool) whether SR policy should behave as Encap/SRH Insertion
Returns
0 if correct, else error

Definition at line 635 of file sr_policy_rewrite.c.

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

◆ sr_policy_del()

int sr_policy_del ( ip6_address_t *  bsid,
u32  index 
)

Delete a SR policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
Returns
0 if correct, else error

Definition at line 723 of file sr_policy_rewrite.c.

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

◆ sr_policy_mod()

int sr_policy_mod ( ip6_address_t *  bsid,
u32  index,
u32  fib_table,
u8  operation,
ip6_address_t *  segments,
u32  sl_index,
u32  weight 
)

Modify an existing SR policy.

The possible modifications are adding a new Segment List, modifying an existing Segment List (modify the weight only) and delete a given Segment List from the SR Policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
fib_tableis the VRF where to install the FIB entry for the BSID
operationis the operation to perform (among the top ones)
segmentsis a vector of IPv6 address composing the segment list
sl_indexis the index of the Segment List to modify/delete
weightis the weight of the sid list. optional.
is_encapMode. Encapsulation or SRH insertion.
Returns
0 if correct, else error

Definition at line 831 of file sr_policy_rewrite.c.

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

◆ sr_policy_register_function()

int sr_policy_register_function ( vlib_main_t vm,
u8 fn_name,
u8 keyword_str,
u8 def_str,
u8 params_str,
u8  prefix_length,
dpo_type_t dpo,
format_function_t ls_format,
unformat_function_t ls_unformat,
sr_p_plugin_callback_t creation_fn,
sr_p_plugin_callback_t removal_fn 
)

SR Policy plugin registry.

Definition at line 3396 of file sr_policy_rewrite.c.

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

◆ sr_set_hop_limit()

void sr_set_hop_limit ( u8  hop_limit)

Definition at line 154 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

◆ sr_set_source()

void sr_set_source ( ip6_address_t *  address)

Definition at line 117 of file sr_policy_rewrite.c.

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

◆ sr_steering_policy()

int sr_steering_policy ( int  is_del,
ip6_address_t *  bsid,
u32  sr_policy_index,
u32  table_id,
ip46_address_t *  prefix,
u32  mask_width,
u32  sw_if_index,
u8  traffic_type 
)

Steer traffic L2 and L3 traffic through a given SR policy.

Parameters
is_del
bsidis the bindingSID of the SR Policy (alt to sr_policy_index)
sr_policyis the index of the SR Policy (alt to bsid)
table_idis the VRF where to install the FIB entry for the BSID
prefixis the IPv4/v6 address for L3 traffic type
mask_widthis the mask for L3 traffic type
sw_if_indexis the incoming interface for L2 traffic
traffic_typedescribes the type of traffic
Returns
0 if correct, else error

Definition at line 60 of file sr_steering.c.

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

Variable Documentation

◆ sr_localsid_d_node

vlib_node_registration_t sr_localsid_d_node

(constructor) VLIB_REGISTER_NODE (sr_localsid_d_node)

Definition at line 1442 of file sr_localsid.c.

◆ sr_localsid_node

vlib_node_registration_t sr_localsid_node

(constructor) VLIB_REGISTER_NODE (sr_localsid_node)

Definition at line 1752 of file sr_localsid.c.

◆ sr_main

ip6_sr_main_t sr_main

Definition at line 31 of file sr.c.

◆ sr_policy_rewrite_encaps_node

vlib_node_registration_t sr_policy_rewrite_encaps_node

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node)

Definition at line 1501 of file sr_policy_rewrite.c.

◆ sr_policy_rewrite_insert_node

vlib_node_registration_t sr_policy_rewrite_insert_node

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node)

Definition at line 2658 of file sr_policy_rewrite.c.