69 return (label << 1 | eos);
100 memset(fib_table, 0,
sizeof(*fib_table));
257 for (ii = 0; ii <
ARRAY_LEN(special_labels); ii++)
261 prefix.
fp_label = special_labels[ii];
369 vec_add1(lfeis, lfei);
423 else if (
unformat (input,
"table %d", &table_id))
431 if (table_id >= 0 && table_id != fib_table->ft_table_id)
434 vlib_cli_output (vm,
"%v, fib_index %d",
435 fib_table->ft_desc, mpls_main.fibs - fib_table);
437 if (MPLS_LABEL_INVALID == label)
439 mpls_fib_table_show_all(mpls_fib_get(fib_table->ft_index), vm);
443 mpls_fib_table_show_one(mpls_fib_get(fib_table->ft_index), label, vm);
451 .path =
"show mpls fib",
452 .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)
fib_protocol_t fp_proto
protocol type
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)
sll srl srl sll sra u16x4 i
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 fib_table_lock(u32 fib_index, fib_protocol_t proto)
Release a reference counting lock on the table.
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)
int(* fib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
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...
u32 mpls_fib_table_find_or_create_and_lock(u32 table_id)
#define MPLS_IETF_ROUTER_ALERT_LABEL
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.
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.
#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 (general version).
u32 mpls_fib_table_create_and_lock(void)
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.
static u32 mpls_fib_create_with_table_id(u32 table_id)
#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)
#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
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_CACHE_LINE_BYTES
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.
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