|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
67 clib_memset (segment_list, 0,
sizeof (*segment_list));
81 .frp_sw_if_index = ~0,
83 .frp_weight = segment_list->
weight,
85 .frp_label_stack = NULL,
86 .frp_local_label = sl[0],
92 for (ii = 1; ii <
vec_len (sl); ii++)
94 path.frp_label_stack[ii - 1].fml_value = sl[ii];
115 .fp_label = sr_policy->
bsid,
164 return (VNET_API_ERROR_NO_SUCH_TABLE);
183 sr_policy->
bsid = bsid;
184 sr_policy->
type = behavior;
232 .frp_sw_if_index = ~0,
234 .frp_weight = segment_list->
weight,
236 .frp_local_label = segment_list->
segments[0],
252 .fp_label = sr_policy->
bsid,
305 u32 *sl_index_iterate;
323 else if (operation == 2)
347 .frp_sw_if_index = ~0,
349 .frp_weight = segment_list->
weight,
351 .frp_local_label = segment_list->
segments[0],
366 .fp_label = sr_policy->
bsid,
381 else if (operation == 3)
399 .frp_sw_if_index = ~0,
401 .frp_weight = segment_list->
weight,
403 .frp_local_label = segment_list->
segments[0],
418 .fp_label = sr_policy->
bsid,
441 .fp_label = sr_policy->
bsid,
467 char is_del = 0, is_add = 0, is_mod = 0;
478 if (!is_add && !is_mod && !is_del &&
unformat (input,
"add"))
480 else if (!is_add && !is_mod && !is_del &&
unformat (input,
"del"))
482 else if (!is_add && !is_mod && !is_del &&
unformat (input,
"mod"))
492 vec_add (segments, &next_label, 1);
494 else if (
unformat (input,
"add sl"))
506 if (!is_add && !is_mod && !is_del)
530 if (operation == 1 &&
vec_len (segments) == 0)
532 if (operation == 3 &&
weight == (
u32) ~ 0)
545 "There is already a FIB entry for the BindingSID address.\n"
546 "The SR policy could not be created.");
549 "The selected SR policy only contains ONE segment list. "
550 "Please remove the SR policy instead");
553 "Could not delete the segment list. "
554 "It is not associated with that SR policy.");
557 "Could not delete the segment list. "
558 "It is not associated with that SR policy.");
561 "Could not modify the segment list. "
562 "The given SL is not associated with such SR policy.");
563 case VNET_API_ERROR_NO_SUCH_TABLE:
574 .path =
"sr mpls policy",
575 .short_help =
"sr mpls policy [add||del||mod] bsid 2999 "
576 "next 10 next 20 next 30 (weight 1) (spray)",
577 .long_help =
"TBD.\n",
608 sr_policy = vec_policies[
i];
641 s =
format (s,
"\b\b > ");
653 .path =
"show sr mpls policies",
654 .short_help =
"show sr mpls policies",
673 u8 endpoint_type,
u32 color)
677 uword *endpoint_table, *p, *old_value;
680 any.as_u64[0] =
any.as_u64[1] = (
u64) ~ 0;
752 sr_policy->
color = color;
762 "SR-MPLS Traffic Engineering (NextHop,Color)");
774 .frp_sw_if_index = ~0,
780 path.frp_local_label = sr_policy->
bsid;
840 u8 endpoint_type = 0;
841 char clear = 0, color_set = 0, bsid_set = 0;
852 else if (!endpoint_type
856 else if (!color_set &&
unformat (input,
"color %u", &color))
862 else if (!clear &&
unformat (input,
"clear"))
870 if (!endpoint_type && !clear)
872 if (!color_set && !clear)
894 .path =
"sr mpls policy te",
895 .short_help =
"sr mpls policy te bsid xxxxx endpoint x.x.x.x color 12341234",
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.
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
SR Segment List (SID list)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
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...
#define clib_error_return(e, args...)
u32 * segments_lists
Pool of SID lists indexes.
Segment Routing MPLS data structures definitions.
mpls_label_t bsid
BindingSID (key)
static clib_error_t * show_sr_mpls_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to display onscreen all the SR MPLS policies.
#define MPLS_IETF_IMPLICIT_NULL_LABEL
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)
#define SR_POLICY_TYPE_DEFAULT
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
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,...
int sr_mpls_policy_del(mpls_label_t bsid)
Delete a SR policy.
#define hash_create(elts, value_bytes)
#define pool_put_index(p, i)
Free pool element with given index.
#define SR_POLICY_TYPE_SPRAY
@ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
#define hash_set(h, key, value)
#define pool_foreach(VAR, POOL)
Iterate through pool.
clib_error_t * sr_mpls_policy_rewrite_init(vlib_main_t *vm)
SR MPLS Policy initialization.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ FIB_ENTRY_FLAG_MULTICAST
static vlib_cli_command_t show_sr_mpls_policies_command
(constructor) VLIB_CLI_COMMAND (show_sr_mpls_policies_command)
mpls_sr_policy_t * sr_policies
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
Segment Routing main datastructure.
#define vec_foreach_index(var, v)
Iterate over vector indices.
int sr_mpls_policy_add(mpls_label_t bsid, mpls_label_t *segments, u8 behavior, u32 weight)
Create a new SR policy.
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 vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * cli_sr_mpls_policy_ec_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to modify the Endpoint,Color of an SR policy.
#define ALWAYS_ASSERT(truth)
@ FIB_SOURCE_SR
SRv6 and SR-MPLS.
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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static mpls_sr_sl_t * create_sl(mpls_sr_policy_t *sr_policy, mpls_label_t *sl, u32 weight)
Creates a Segment List and adds it to an SR policy.
mpls_label_t fml_value
The label value.
#define vec_free(V)
Free vector's memory (no header).
static vlib_cli_command_t cli_sr_mpls_policy_ec_command
(constructor) VLIB_CLI_COMMAND (cli_sr_mpls_policy_ec_command)
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.
static clib_error_t * sr_mpls_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI for 'sr mpls policies' command family.
description fragment has unexpected format
vl_api_address_t endpoint
@ 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 MPLS_FIB_DEFAULT_TABLE_ID
#define VLIB_INIT_FUNCTION(x)
u8 type
Type (default is 0)
u32 color
Optional color for SR TE.
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpaths)
Remove n paths to an entry (aka route) in the FIB.
A representation of a path as described by a route producer.
static void ip6_address_set_zero(ip6_address_t *a)
#define vec_foreach(var, vec)
Vector iterator.
static uword pool_elts(void *v)
Number of active elements in a pool.
fib_protocol_t fp_proto
protocol type
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
@ FIB_SOURCE_SPECIAL
Special sources.
#define hash_unset(h, key)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define FOR_EACH_MPLS_EOS_BIT(_eos)
Configuration for each label value in the output-stack.
mpls_sr_main_t sr_mpls_main
static vlib_cli_command_t sr_mpls_policy_command
(constructor) VLIB_CLI_COMMAND (sr_mpls_policy_command)
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.
ip46_address_t endpoint
Optional NH for SR TE.
enum mpls_eos_bit_t_ mpls_eos_bit_t
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
#define SR_SEGMENT_LIST_WEIGHT_DEFAULT
Aggregate type for a prefix.
#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.