69 return (label << 1 | eos);
259 for (ii = 0; ii <
ARRAY_LEN(special_labels); ii++)
263 prefix.
fp_label = special_labels[ii];
369 s =
format(s,
"%=30s %=6ld %=8ld\n",
"MPLS", n_tables, mem);
383 vec_add1(lfeis, lfei);
437 else if (
unformat (input,
"table %d", &table_id))
445 if (table_id >= 0 && table_id != fib_table->ft_table_id)
448 vlib_cli_output (vm,
"%v, fib_index %d",
449 fib_table->ft_desc, mpls_main.fibs - fib_table);
451 if (MPLS_LABEL_INVALID == label)
453 mpls_fib_table_show_all(mpls_fib_get(fib_table->ft_index), vm);
457 mpls_fib_table_show_one(mpls_fib_get(fib_table->ft_index), label, vm);
465 .path =
"show mpls fib",
466 .short_help =
"show mpls fib [summary] [table <n>]",
static void mpls_fib_table_show_all(const mpls_fib_t *mpls_fib, vlib_main_t *vm)
u8 * format_fib_entry(u8 *s, va_list *args)
void mpls_fib_table_entry_remove(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
#define hash_set(h, key, value)
fib_protocol_t ft_proto
Which protocol this table serves.
#define hash_unset(h, key)
fib_node_index_t mpls_fib_table_lookup(const mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
void mpls_fib_table_destroy(u32 fib_index)
#define FIB_ENTRY_FORMAT_DETAIL
static clib_error_t * mpls_fib_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static index_t mpls_fib_drop_dpo_index
An MPLS_FIB table;.
u32 mpls_label_t
A label value only, i.e.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define MPLS_IETF_ROUTER_ALERT_LABEL
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void mpls_fib_table_entry_insert(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos, fib_node_index_t lfei)
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
static u32 mpls_fib_entry_mk_key(mpls_label_t label, mpls_eos_bit_t eos)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define hash_foreach(key_var, value_var, h, body)
#define MPLS_IS_REPLICATE
The top bit of the index, which is the result of the MPLS lookup is used to determine if the DPO is a...
Aggregrate type for a prefix.
const dpo_id_t * punt_dpo_get(dpo_proto_t proto)
int fib_entry_cmp_for_sort(void *i1, void *i2)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
enum fib_source_t_ fib_source_t
The different sources that can create a route.
u32 mpls_fib_table_find_or_create_and_lock(u32 table_id, fib_source_t src)
void mpls_fib_table_walk(mpls_fib_t *mpls_fib, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
dpo_type_t dpoi_type
the type
load-balancing over a choice of [un]equal cost paths
#define MPLS_FLOW_HASH_DEFAULT
There are no options for controlling the MPLS flow hash.
struct mpls_fib_t_ mpls_fib_t
#define pool_put(P, E)
Free an object E in pool P.
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
static void mpls_fib_table_show_one(const mpls_fib_t *mpls_fib, mpls_label_t label, vlib_main_t *vm)
struct fib_table_t_ * fibs
A pool of all the MPLS FIBs.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
fib_node_index_t ft_index
Index into FIB vector.
u32 ft_table_id
Table ID (hash key) for this FIB.
u32 ft_flow_hash_config
flow hash configuration
#define MPLS_LABEL_INVALID
#define vec_free(V)
Free vector's memory (no header).
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
#define MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL
u32 fib_node_index_t
A typedef of a node index.
u32 mpls_fib_index_from_table_id(u32 table_id)
fib_table_walk_rc_t(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
#define VLIB_CLI_COMMAND(x,...)
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
#define FOR_EACH_MPLS_EOS_BIT(_eos)
#define hash_create(elts, value_bytes)
void mpls_fib_forwarding_table_reset(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos)
uword * mf_entries
A hash table of entries.
void mpls_fib_forwarding_table_update(mpls_fib_t *mf, mpls_label_t label, mpls_eos_bit_t eos, const dpo_id_t *dpo)
void load_balance_set_bucket(index_t lbi, u32 bucket, const dpo_id_t *next)
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
#define MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL
u8 * format_mpls_fib_table_memory(u8 *s, va_list *args)
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_CACHE_LINE_BYTES
u32 mpls_fib_table_create_and_lock(fib_source_t src)
index_t mf_lbs[MPLS_FIB_DB_SIZE]
The load-balance indices keyed by 21 bit label+eos bit.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword * fib_index_by_table_id
A hash table to lookup the mpls_fib by table ID.
static u32 mpls_fib_create_with_table_id(u32 table_id, fib_source_t src)
struct mpls_fib_t_ * mpls_fibs
A pool of all the MPLS FIBs.
A protocol Independent FIB table.
enum mpls_eos_bit_t_ mpls_eos_bit_t
static uword pool_elts(void *v)
Number of active elements in a pool.