|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
42 #define SRMPLS_TE_OFFSET 50
63 uword *color_table, *result_label;
76 (
uword *) & color_t, NULL);
83 return (
u32) * result_label;
86 u32 *new_internal_label = 0;
88 *new_internal_label = 0;
98 ip46_address_t zero,
any;
100 any.as_u64[0] =
any.as_u64[1] = (
u64) ~ 0;
128 uword *color_table, *result_label;
152 ip46_address_t zero,
any;
154 any.as_u64[0] =
any.as_u64[1] = (
u64) ~ 0;
182 uword *color_table, *result_label;
200 if (*label_lock == 0)
231 u32 *internal_labels = 0;
232 ip46_address_t zero,
any;
234 any.as_u64[0] =
any.as_u64[1] = (
u64) ~ 0;
271 "SR-MPLS Traffic Engineering (NextHop,Color)");
281 .frp_sw_if_index = ~0,
314 path.frp_local_label = internal_labels[label_i];
315 path.frp_preference = label_i;
323 path.frp_label_stack = NULL;
382 u8 traffic_type, ip46_address_t * next_hop,
383 u8 nh_type,
u32 color,
char co_bits,
400 key.prefix.as_u64[0] =
prefix->as_u64[0];
401 key.prefix.as_u64[1] =
prefix->as_u64[1];
404 key.traffic_type = traffic_type;
418 if (steer_pl->
bsid != (
u32) ~ 0)
426 if (steer_pl->
co_bits != co_bits)
449 steer_pl->
color = NULL;
457 if (bsid != (
u32) ~ 0)
461 steer_pl->
bsid = bsid;
469 .frp_local_label = sr_policy->
bsid,
471 .frp_sw_if_index = ~0,
493 path.frp_fib_index = 0;
494 path.frp_preference = 0;
508 path.frp_fib_index = 0;
509 path.frp_preference = 0;
562 key.prefix.as_u64[0] =
prefix->as_u64[0];
563 key.prefix.as_u64[1] =
prefix->as_u64[1];
566 key.traffic_type = traffic_type;
581 if (steer_pl->
bsid == (
u32) ~ 0)
666 u32 dst_mask_width = 0;
669 u32 fib_table = (
u32) ~ 0, color = (
u32) ~ 0;
674 u8 sr_policy_set = 0;
684 else if (!traffic_type
686 &
prefix.ip6, &dst_mask_width))
688 else if (!traffic_type
690 &
prefix.ip4, &dst_mask_width))
692 else if (!sr_policy_set
693 &&
unformat (input,
"via sr policy bsid %U",
696 else if (!sr_policy_set
697 &&
unformat (input,
"via next-hop %U color %d co %d",
703 else if (!sr_policy_set
704 &&
unformat (input,
"via next-hop %U color %d co %d",
710 else if (fib_table == (
u32) ~ 0
711 &&
unformat (input,
"fib-table %d", &fib_table));
712 else if (
unformat (input,
"vpn-label %U",
727 (dst_mask_width ? (0xFFFFFFFFu >> (32 - dst_mask_width)) : 0);
743 traffic_type, fib_table, color);
748 traffic_type, &
nh, nh_type, color, co_bits,
776 .path =
"sr mpls steer",
777 .short_help =
"sr mpls steer (del) l3 <ip_addr/mask> "
778 "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)",
780 "\tSteer L3 traffic through an existing SR policy.\n"
782 "\t\tsr steer l3 2001::/64 via sr_policy bsid 29999\n"
783 "\t\tsr steer del l3 2001::/64 via sr_policy bsid 29999\n"
784 "\t\tsr steer l3 2001::/64 via next-hop 1.1.1.1 color 1234 co 0\n"
785 "\t\tsr steer l3 2001::/64 via next-hop 2001::1 color 1234 co 2 vpn-label 500\n",
807 for (
i = 0;
i <
vec_len (steer_policies);
i++)
810 steer_pl = steer_policies[
i];
826 if (steer_pl->
bsid != (
u32) ~ 0)
849 s =
format (s,
"%d, ", *color_i);
877 .path =
"show sr mpls steering policies",
878 .short_help =
"show sr mpls steering policies",
static vlib_cli_command_t show_sr_mpls_steering_policies_command
(constructor) VLIB_CLI_COMMAND (show_sr_mpls_steering_policies_command)
u32 fib_table
VRF of the prefix.
mhash_t sr_steer_policies_hash
#define clib_memcpy(d, s, n)
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
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.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void compute_sr_te_automated_steering_fib_entry(mpls_sr_steering_policy_t *steer_pl)
function to update the FIB
static void ip46_address_reset(ip46_address_t *ip46)
static void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
static int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
#define clib_error_return(e, args...)
static void internal_label_unlock_co(ip46_address_t endpoint, u32 color, char co_bits)
mpls_sr_steering_policy_t * steer_policies
Segment Routing MPLS data structures definitions.
mpls_label_t bsid
BindingSID (key)
mpls_sr_main_t sr_mpls_main
u16 fp_len
The mask length.
#define pool_put(P, E)
Free an object E in pool P.
static uword * mhash_get(mhash_t *h, const void *key)
sr_mpls_steering_key_t classify
Traffic classification.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
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...
static void internal_label_lock_co(ip46_address_t endpoint, u32 color, char co_bits)
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
#define hash_create(elts, value_bytes)
ip46_address_t prefix
IP address of the prefix.
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,...
@ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
mpls_sr_policy_t * sr_policies
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
u32 mask_width
Mask width of the prefix.
ip46_address_t next_hop
SR TE NH.
Segment Routing main datastructure.
#define vec_foreach_index(var, v)
Iterate over vector indices.
uword * sr_policies_index_hash
void fib_table_flush(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Flush all entries from a table for the source.
sll srl srl sll sra u16x4 i
unformat_function_t unformat_mpls_unicast_label
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define VLIB_CLI_COMMAND(x,...)
@ FIB_SOURCE_SR
SRv6 and SR-MPLS.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
static void ip6_address_mask(ip6_address_t *a, const ip6_address_t *mask)
mpls_label_t fml_value
The label value.
static uword mhash_elts(mhash_t *m)
#define vec_free(V)
Free vector's memory (no header).
char co_bits
Color-Only bits.
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpaths)
Add n paths to an entry (aka route) in the FIB.
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
description fragment has unexpected format
vl_api_address_t endpoint
int sort_color_descent(const u32 *x, u32 *y)
function to sort the colors in descending order
mpls_label_t bsid
SR Policy index.
@ FIB_ROUTE_PATH_FLAG_NONE
u32 fib_table_create_and_lock(fib_protocol_t proto, fib_source_t src, const char *const fmt,...)
Create a new table with no table ID.
#define VLIB_INIT_FUNCTION(x)
A representation of a path as described by a route producer.
#define vec_foreach(var, vec)
Vector iterator.
fib_protocol_t fp_proto
protocol type
static clib_error_t * show_sr_mpls_steering_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
@ FIB_SOURCE_SPECIAL
Special sources.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
Configuration for each label value in the output-stack.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
u32 mpls_label_t
A label value only, i.e.
mhash_t sr_policies_c2e2eclabel_hash
SR TE.
u32 * color
Vector of SR TE colors.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
format_function_t format_mpls_unicast_label
static vlib_cli_command_t sr_mpls_steer_policy_command
(constructor) VLIB_CLI_COMMAND (sr_mpls_steer_policy_command)
clib_error_t * sr_mpls_steering_init(vlib_main_t *vm)
__clib_export uword mhash_set_mem(mhash_t *h, void *key, uword *new_value, uword *old_value)
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
static void mhash_free(mhash_t *h)
Aggregate type for a prefix.
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.
#define vec_del1(v, i)
Delete the element at index I.
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
u8 traffic_type
Traffic type (IPv4, IPv6, L2)
static clib_error_t * sr_mpls_steer_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)