FD.io VPP  v18.07.1-19-g511ce25
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  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_steering_key_t
 Steering db key. More...
 
struct  ip6_sr_steering_policy_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_LAST   10 /* 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_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, 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_add (ip6_address_t *bsid, ip6_address_t *segments, u32 weight, u8 behavior, u32 fib_table, u8 is_encap)
 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, 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...
 
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)
 
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

#define IPv6_DEFAULT_HEADER_LENGTH   40

Definition at line 33 of file sr.h.

#define IPv6_DEFAULT_HOP_LIMIT   64

Definition at line 34 of file sr.h.

#define IPv6_DEFAULT_MAX_MASK_WIDTH   128

Definition at line 35 of file sr.h.

#define SR_ARGUMENT_SIZE   4

Definition at line 53 of file sr.h.

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

Definition at line 40 of file sr.h.

#define SR_BEHAVIOR_DT4   9

Definition at line 45 of file sr.h.

#define SR_BEHAVIOR_DT6   8

Definition at line 44 of file sr.h.

#define SR_BEHAVIOR_DX2   5

Definition at line 41 of file sr.h.

#define SR_BEHAVIOR_DX4   7

Definition at line 43 of file sr.h.

#define SR_BEHAVIOR_DX6   6

Definition at line 42 of file sr.h.

#define SR_BEHAVIOR_END   1

Definition at line 37 of file sr.h.

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

Definition at line 46 of file sr.h.

#define SR_BEHAVIOR_T   3

Definition at line 39 of file sr.h.

#define SR_BEHAVIOR_X   2

Definition at line 38 of file sr.h.

#define SR_FUNCTION_SIZE   4

Definition at line 52 of file sr.h.

#define SR_POLICY_TYPE_DEFAULT   0

Definition at line 75 of file sr.h.

#define SR_POLICY_TYPE_SPRAY   1

Definition at line 76 of file sr.h.

#define SR_SEGMENT_LIST_WEIGHT_DEFAULT   1

Definition at line 55 of file sr.h.

#define SR_STEER_IPV4   4

Definition at line 49 of file sr.h.

#define SR_STEER_IPV6   6

Definition at line 50 of file sr.h.

#define SR_STEER_L2   2

Definition at line 48 of file sr.h.

Typedef Documentation

typedef int( sr_plugin_callback_t) (ip6_sr_localsid_t *localsid)

Definition at line 127 of file sr.h.

Function Documentation

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 289 of file sr.h.

+ Here is the caller 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:

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.

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.

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 1525 of file sr_localsid.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_policy_add ( ip6_address_t bsid,
ip6_address_t segments,
u32  weight,
u8  behavior,
u32  fib_table,
u8  is_encap 
)

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 551 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 632 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 727 of file sr_policy_rewrite.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void sr_set_source ( ip6_address_t address)

Definition at line 116 of file sr_policy_rewrite.c.

+ Here is the caller graph for this function:

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

vlib_node_registration_t sr_localsid_d_node

(constructor) VLIB_REGISTER_NODE (sr_localsid_d_node)

Definition at line 1164 of file sr_localsid.c.

vlib_node_registration_t sr_localsid_node

(constructor) VLIB_REGISTER_NODE (sr_localsid_node)

Definition at line 1469 of file sr_localsid.c.

ip6_sr_main_t sr_main

Definition at line 31 of file sr.c.

vlib_node_registration_t sr_policy_rewrite_encaps_node

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_encaps_node)

Definition at line 1297 of file sr_policy_rewrite.c.

vlib_node_registration_t sr_policy_rewrite_insert_node

(constructor) VLIB_REGISTER_NODE (sr_policy_rewrite_insert_node)

Definition at line 2427 of file sr_policy_rewrite.c.