FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
sr_mpls.h File Reference

Segment Routing MPLS data structures definitions. More...

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

Go to the source code of this file.

Data Structures

struct  mpls_sr_sl_t
 SR Segment List (SID list) More...
 
struct  mpls_sr_policy_t
 
struct  sr_mpls_steering_key_t
 Steering db key. More...
 
struct  mpls_sr_steering_policy_t
 
struct  mpls_sr_main_t
 Segment Routing main datastructure. More...
 

Macros

#define SR_POLICY_TYPE_DEFAULT   0
 
#define SR_POLICY_TYPE_SPRAY   1
 
#define SR_SEGMENT_LIST_WEIGHT_DEFAULT   1
 
#define SR_STEER_IPV4   4
 
#define SR_STEER_IPV6   6
 
#define SR_TE_CO_BITS_00   0
 
#define SR_TE_CO_BITS_01   1
 
#define SR_TE_CO_BITS_10   2
 
#define SR_TE_CO_BITS_11   3
 

Functions

int sr_mpls_policy_add (mpls_label_t bsid, mpls_label_t *segments, u8 behavior, u32 weight)
 Create a new SR policy. More...
 
int sr_mpls_policy_mod (mpls_label_t bsid, u8 operation, mpls_label_t *segments, u32 sl_index, u32 weight)
 Modify an existing SR policy. More...
 
int sr_mpls_policy_del (mpls_label_t bsid)
 Delete a SR policy. More...
 
int sr_mpls_policy_assign_endpoint_color (mpls_label_t bsid, ip46_address_t *endpoint, u8 endpoint_type, u32 color)
 Update the Endpoint,Color tuple of an SR policy. More...
 
int sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id, ip46_address_t *prefix, u32 mask_width, u8 traffic_type, ip46_address_t *next_hop, u8 nh_type, u32 color, char co_bits, mpls_label_t vpn_label)
 Steer traffic L3 traffic through a given SR-MPLS policy. More...
 
int sr_mpls_steering_policy_del (ip46_address_t *prefix, u32 mask_width, u8 traffic_type, u32 table_id, u32 color)
 Delete steering rule for an SR-MPLS policy. More...
 
u32 find_or_create_internal_label (ip46_address_t endpoint, u32 color)
 find the corresponding label for (endpoint, color) and lock it endpoint might be NULL or ANY NULL = 0, ANY=~0 More...
 
void internal_label_lock (ip46_address_t endpoint, u32 color)
 lock the label for (NH, C) endpoint might be NULL or ANY NULL = 0, ANY=~0 More...
 
void internal_label_unlock (ip46_address_t endpoint, u32 color)
 Release lock on label for (endpoint, color) endpoint might be NULL or ANY NULL = 0, ANY=~0. More...
 

Variables

mpls_sr_main_t sr_mpls_main
 

Detailed Description

Segment Routing MPLS data structures definitions.

Definition in file sr_mpls.h.

Macro Definition Documentation

#define SR_POLICY_TYPE_DEFAULT   0

Definition at line 36 of file sr_mpls.h.

#define SR_POLICY_TYPE_SPRAY   1

Definition at line 37 of file sr_mpls.h.

#define SR_SEGMENT_LIST_WEIGHT_DEFAULT   1

Definition at line 39 of file sr_mpls.h.

#define SR_STEER_IPV4   4

Definition at line 41 of file sr_mpls.h.

#define SR_STEER_IPV6   6

Definition at line 42 of file sr_mpls.h.

#define SR_TE_CO_BITS_00   0

Definition at line 44 of file sr_mpls.h.

#define SR_TE_CO_BITS_01   1

Definition at line 45 of file sr_mpls.h.

#define SR_TE_CO_BITS_10   2

Definition at line 46 of file sr_mpls.h.

#define SR_TE_CO_BITS_11   3

Definition at line 47 of file sr_mpls.h.

Function Documentation

u32 find_or_create_internal_label ( ip46_address_t  endpoint,
u32  color 
)

find the corresponding label for (endpoint, color) and lock it endpoint might be NULL or ANY NULL = 0, ANY=~0

Definition at line 60 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void internal_label_lock ( ip46_address_t  endpoint,
u32  color 
)

lock the label for (NH, C) endpoint might be NULL or ANY NULL = 0, ANY=~0

Definition at line 125 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void internal_label_unlock ( ip46_address_t  endpoint,
u32  color 
)

Release lock on label for (endpoint, color) endpoint might be NULL or ANY NULL = 0, ANY=~0.

Definition at line 179 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_policy_add ( mpls_label_t  bsid,
mpls_label_t segments,
u8  behavior,
u32  weight 
)

Create a new SR policy.

Parameters
bsidis the bindingSID of the SR Policy
segmentsis a vector of MPLS labels composing the segment list
behavioris the behavior of the SR policy. (default//spray)
fib_tableis the VRF where to install the FIB entry for the BSID
weightis the weight of this specific SID list
Returns
0 if correct, else error

Definition at line 152 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_policy_assign_endpoint_color ( mpls_label_t  bsid,
ip46_address_t *  endpoint,
u8  endpoint_type,
u32  color 
)

Update the Endpoint,Color tuple of an SR policy.

Parameters
bsidis the bindingSID of the SR Policy
endpointrepresents the IP46 of the endpoint
colorrepresents the color (u32)

To reset to NULL use ~0 as parameters.

Returns
0 if correct, else error

Definition at line 671 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_policy_del ( mpls_label_t  bsid)

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 207 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_policy_mod ( mpls_label_t  bsid,
u8  operation,
mpls_label_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
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.
Returns
0 ok, >0 index of SL, <0 error

Definition at line 299 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_steering_policy_add ( mpls_label_t  bsid,
u32  table_id,
ip46_address_t *  prefix,
u32  mask_width,
u8  traffic_type,
ip46_address_t *  next_hop,
u8  nh_type,
u32  color,
char  co_bits,
mpls_label_t  vpn_label 
)

Steer traffic L3 traffic through a given SR-MPLS 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
traffic_typedescribes the type of traffic
next_hopSR TE Next-Hop
nh_typeis the AF of Next-Hop
colorSR TE color
co_bitsSR TE color-only bits
Returns
0 if correct, else error

Definition at line 380 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_steering_policy_del ( ip46_address_t *  prefix,
u32  mask_width,
u8  traffic_type,
u32  table_id,
u32  color 
)

Delete steering rule for an SR-MPLS 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
traffic_typedescribes the type of traffic
next_hopSR TE Next-HOP
nh_typeis the AF of Next-Hop
colorSR TE color
Returns
0 if correct, else error

Definition at line 547 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

mpls_sr_main_t sr_mpls_main

Definition at line 42 of file sr_mpls_policy.c.