FD.io VPP  v19.08.1-401-g8e4ed521a
Vector Packet Processing
sr_mpls_steering.c File Reference

Packet steering into SR-MPLS Policies. More...

+ Include dependency graph for sr_mpls_steering.c:

Go to the source code of this file.

Macros

#define SRMPLS_TE_OFFSET   50
 

Functions

int sort_color_descent (const u32 *x, u32 *y)
 function to sort the colors in descending order 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...
 
static void internal_label_lock_co (ip46_address_t endpoint, u32 color, char co_bits)
 
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...
 
static void internal_label_unlock_co (ip46_address_t endpoint, u32 color, char co_bits)
 
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...
 
void compute_sr_te_automated_steering_fib_entry (mpls_sr_steering_policy_t *steer_pl)
 function to update the FIB 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...
 
static clib_error_tsr_mpls_steer_policy_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_sr_mpls_steering_policies_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
clib_error_tsr_mpls_steering_init (vlib_main_t *vm)
 

Variables

static vlib_cli_command_t sr_mpls_steer_policy_command
 (constructor) VLIB_CLI_COMMAND (sr_mpls_steer_policy_command) More...
 
static vlib_cli_command_t show_sr_mpls_steering_policies_command
 (constructor) VLIB_CLI_COMMAND (show_sr_mpls_steering_policies_command) More...
 

Detailed Description

Packet steering into SR-MPLS Policies.

This file is in charge of handling the FIB appropiatly to steer packets through SR Policies as defined in 'sr_mpls_policy.c'. Notice that here we are only doing steering. SR policy application is done in sr_policy_rewrite.c

Supports:

  • Steering of IPv6 traffic Destination Address based through BSID
  • Steering of IPv4 traffic Destination Address based through BSID
  • Steering of IPv4 and IPv6 traffic through N,C (SR CP)

Definition in file sr_mpls_steering.c.

Macro Definition Documentation

◆ SRMPLS_TE_OFFSET

#define SRMPLS_TE_OFFSET   50

Definition at line 42 of file sr_mpls_steering.c.

Function Documentation

◆ compute_sr_te_automated_steering_fib_entry()

void compute_sr_te_automated_steering_fib_entry ( mpls_sr_steering_policy_t steer_pl)

function to update the FIB

Definition at line 225 of file sr_mpls_steering.c.

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

◆ find_or_create_internal_label()

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:

◆ internal_label_lock()

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:

◆ internal_label_lock_co()

static void internal_label_lock_co ( ip46_address_t  endpoint,
u32  color,
char  co_bits 
)
inlinestatic

Definition at line 96 of file sr_mpls_steering.c.

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

◆ internal_label_unlock()

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:

◆ internal_label_unlock_co()

static void internal_label_unlock_co ( ip46_address_t  endpoint,
u32  color,
char  co_bits 
)
inlinestatic

Definition at line 150 of file sr_mpls_steering.c.

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

◆ show_sr_mpls_steering_policies_command_fn()

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

Definition at line 791 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

◆ sort_color_descent()

int sort_color_descent ( const u32 x,
u32 y 
)

function to sort the colors in descending order

Definition at line 48 of file sr_mpls_steering.c.

+ Here is the caller graph for this function:

◆ sr_mpls_steer_policy_command_fn()

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

Definition at line 660 of file sr_mpls_steering.c.

+ Here is the call graph for this function:

◆ sr_mpls_steering_init()

clib_error_t* sr_mpls_steering_init ( vlib_main_t vm)

Definition at line 884 of file sr_mpls_steering.c.

◆ sr_mpls_steering_policy_add()

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:

◆ sr_mpls_steering_policy_del()

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

◆ show_sr_mpls_steering_policies_command

vlib_cli_command_t show_sr_mpls_steering_policies_command
static
Initial value:
=
{
.path = "show sr mpls steering policies",
.short_help = "show sr mpls steering policies",
}
static clib_error_t * show_sr_mpls_steering_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (show_sr_mpls_steering_policies_command)

Definition at line 875 of file sr_mpls_steering.c.

◆ sr_mpls_steer_policy_command

vlib_cli_command_t sr_mpls_steer_policy_command
static
Initial value:
=
{
.path = "sr mpls steer",
.short_help = "sr mpls steer (del) l3 <ip_addr/mask> "
"via [sr policy bsid <mpls_label> || next-hop <ip46_addr> color <u32> co <0|1|2|3> ](fib-table <fib_table_index>)(vpn-label 500)",
.long_help =
"\tSteer L3 traffic through an existing SR policy.\n"
"\tExamples:\n"
"\t\tsr steer l3 2001::/64 via sr_policy bsid 29999\n"
"\t\tsr steer del l3 2001::/64 via sr_policy bsid 29999\n"
"\t\tsr steer l3 2001::/64 via next-hop 1.1.1.1 color 1234 co 0\n"
"\t\tsr steer l3 2001::/64 via next-hop 2001::1 color 1234 co 2 vpn-label 500\n",
}
static clib_error_t * sr_mpls_steer_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (sr_mpls_steer_policy_command)

Definition at line 774 of file sr_mpls_steering.c.