21 #include <vpp/app/version.h> 25 #define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS (64 * 1024) 26 #define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE (32<<20) 28 #define foreach_ila_error \ 29 _(NONE, "valid ILA packets") 32 #define _(sym,str) ILA_ERROR_##sym, 39 #define _(sym,string) string, 58 .dir = ILA_DIR_ILA2SIR,
74 u64 v = clib_net_to_host_u64 (va_arg (*va,
u64));
76 return format (s,
"%04x:%04x:%04x:%04x",
77 v >> 48, (v >> 32) & 0xffff, (v >> 16) & 0xffff, v & 0xffff);
86 if (t == ILA_DIR_##i) \ 90 return format (s,
"invalid_ila_direction");
102 case ILA_CSUM_MODE_##i: \ 108 txt =
"invalid_ila_csum_mode";
119 if (t == ILA_TYPE_##i) \ 120 return format(s, st); 123 return format (s,
"invalid_ila_type");
134 return format (s,
"%-15s%=40s%=40s%+16s%+18s%+11s",
"Type",
"SIR Address",
135 "ILA Address",
"Checksum Mode",
"Direction",
"Next DPO");
141 return format (s,
"%-15U%=40U%=40U%18U%11U%s",
151 return format (s,
"%-15U%=40U%=40U%18U%11U%U",
171 "ILA -> SIR adj index: %d entry index: %d initial_dst: %U",
181 if (unformat(input, s)) \ 183 *result = ILA_DIR_##i; \ 197 if (unformat(input, s)) \ 199 *result = ILA_TYPE_##i; \ 214 *result = ILA_CSUM_MODE_NO_ACTION;
217 if (
unformat (input,
"neutral-map"))
219 *result = ILA_CSUM_MODE_NEUTRAL_MAP;
222 if (
unformat (input,
"adjust-transport"))
224 *result = ILA_CSUM_MODE_ADJUST_TRANSPORT;
233 u64 *result = va_arg (*args,
u64 *);
236 if (!
unformat (input,
"%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3]))
239 if (a[0] > 0xFFFF || a[1] > 0xFFFF || a[2] > 0xFFFF || a[3] > 0xFFFF)
242 *result = clib_host_to_net_u64 ((((
u64) a[0]) << 48) |
243 (((
u64) a[1]) << 32) |
244 (((
u64) a[2]) << 16) | (((
u64) a[3])));
255 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
262 while (n_left_from > 0)
266 while (n_left_from >= 4 && n_left_to_next >= 2)
286 pi0 = to_next[0] = from[0];
287 pi1 = to_next[1] = from[1];
322 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
323 sir_address1 = (ie1->
dir != ILA_DIR_SIR2ILA) ? &ie1->
sir_address : sir_address1;
333 n_left_to_next, pi0, pi1,
339 while (n_left_from > 0 && n_left_to_next > 0)
347 pi0 = to_next[0] = from[0];
368 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
387 .name =
"ila-to-sir",
388 .vector_size =
sizeof (
u32),
419 return format (s,
"SIR -> ILA entry index: %d initial_dst: %U",
429 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
436 while (n_left_from > 0)
440 while (n_left_from >= 4 && n_left_to_next >= 2)
447 BVT (clib_bihash_kv) kv0, value0;
448 BVT (clib_bihash_kv) kv1, value1;
465 pi0 = to_next[0] = from[0];
466 pi1 = to_next[1] = from[1];
487 ie0 = &ilm->
entries[value0.value];
488 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
491 if ((BV (clib_bihash_search)
493 ie1 = &ilm->
entries[value1.value];
494 ila_address1 = (ie1->
dir != ILA_DIR_ILA2SIR) ? &ie1->
ila_address : ila_address1;
524 n_left_to_next, pi0, pi1, next0,
529 while (n_left_from > 0 && n_left_to_next > 0)
535 BVT (clib_bihash_kv) kv0, value0;
539 pi0 = to_next[0] = from[0];
555 ie0 = &ilm->
entries[value0.value];
556 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
575 n_left_to_next, pi0, next0);
587 .vector_size =
sizeof (
u32),
602 .arc_name =
"ip6-unicast",
603 .node_name =
"sir-to-ila",
625 BVT (clib_bihash_kv) kv, value;
628 if (args->
type == ILA_TYPE_IID || args->
type == ILA_TYPE_LUID)
632 clib_warning (
"Incorrect SIR address (ILA type mismatch %d %d)",
638 clib_warning (
"Checksum bit should not be set in SIR address");
642 else if (args->
type == ILA_TYPE_VNIDM)
647 clib_warning (
"SIR multicast address must start with fff");
654 clib_warning (
"SIR multicast address must start with fff");
699 if (e->
csum_mode == ILA_CSUM_MODE_NEUTRAL_MAP)
703 for (i = 0; i < 4; i++)
785 e = &ilm->
entries[value.value];
826 .version = VPP_BUILD_VER,
827 .description =
"Identifier-locator addressing for IPv6",
837 return format(s,
"ILA: idx:%d sir:%U",
933 "ila id to entry index table",
954 args.
type = ILA_TYPE_IID;
955 args.
csum_mode = ILA_CSUM_MODE_NO_ACTION;
957 args.
dir = ILA_DIR_BIDIR;
987 else if (
unformat (line_input,
"del"))
1017 .path =
"ila entry",
1018 .short_help =
"ila entry [type <type>] [sir-address <address>] [locator <locator>] [vnid <hex-vnid>]" 1019 " [adj-index <adj-index>] [next-hop <next-hop>] [direction (bidir|sir2ila|ila2sir)]" 1020 " [csum-mode (no-action|neutral-map|transport-adjust)] [del]",
1051 .path =
"ila interface",
1052 .short_help =
"ila interface <interface-name> [disable]",
1068 vlib_cli_output (vm,
" %U\n", format_ila_entry, vnm, e);
1076 .path =
"show ila entries",
1077 .short_help =
"show ila entries",
static u8 * format_ila_entry(u8 *s, va_list *va)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
dpo_lock_fn_t dv_lock
A reference counting lock function.
ip6_address_t initial_dst
Recursive resolution source.
clib_bihash_24_8_t id_to_entry_table
A virtual function table regisitered for a DPO type.
ila_sir2ila_next_t
INDENT-ON
ip6_address_t initial_dst
vnet_main_t * vnet_get_main(void)
static fib_node_type_t ila_fib_node_type
Dynamically registered FIB node type for ILA.
u8 * format_half_ip6_address(u8 *s, va_list *va)
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
u8 * format_ila_sir2ila_trace(u8 *s, va_list *args)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
static uword unformat_ila_type(unformat_input_t *input, va_list *args)
dpo_id_t ila_dpo
The next DPO in the grpah to follow.
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
ip6_address_t ila_address
VNET_FEATURE_INIT(ila_sir2ila, static)
INDENT-ON
static void ila_entry_stack(ila_entry_t *ie)
INDENT-ON
#define STRUCT_OFFSET_OF(t, f)
static ila_main_t ila_main
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
clib_error_t * ila_init(vlib_main_t *vm)
ip6_address_t sir_address
int ila_add_del_entry(ila_add_del_entry_args_t *args)
static fib_node_t * ila_fib_node_get_node(fib_node_index_t index)
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
fib_node_index_t next_hop_fib_entry_index
The FIB entry index for the next-hop.
static clib_error_t * ila_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip6_address_t next_hop_address
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
#define VLIB_INIT_FUNCTION(x)
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
#define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
A high priority source a plugin can use.
Aggregrate type for a prefix.
static uword unformat_ila_direction(unformat_input_t *input, va_list *args)
#define clib_error_return(e, args...)
static ila_entry_t ila_sir2ila_default_entry
static char * ila_error_strings[]
u64 lookup_table_nbuckets
static uword unformat_half_ip6_address(unformat_input_t *input, va_list *args)
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
static vlib_node_registration_t ila_ila2sir_node
INDENT-OFF
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define ila_csum_foreach_type
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
ila_csum_mode_t csum_mode
static clib_error_t * ila_show_entries_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
static fib_node_back_walk_rc_t ila_fib_node_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Callback function invoked when the forwarding changes for the ILA next-hop.
An node in the FIB graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
static void ila_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
u8 * format_ila_direction(u8 *s, va_list *args)
static vlib_node_registration_t ila_sir2ila_node
INDENT-OFF
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a 'special' entry to the FIB.
static const char *const ila_ip6_nodes[]
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
static uword ip6_address_is_zero(const ip6_address_t *a)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
u8 * format_ila_ila2sir_trace(u8 *s, va_list *args)
static ila_entry_t * ila_entry_from_fib_node(fib_node_t *node)
#define clib_warning(format, args...)
static uword ila_ila2sir(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 fib_node_index_t
A typedef of a node index.
fib_node_t ila_fib_node
Fib Node base class.
static clib_error_t * ila_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void ila_fib_node_last_lock_gone(fib_node_t *node)
no-op unlock function.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Context passed between object during a back walk.
#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...
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
ip6_address_t sir_address
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
#define VNET_FEATURES(...)
static u8 * format_csum_mode(u8 *s, va_list *va)
static dpo_type_t ila_dpo_type
Dynamically registered DPO Type for ILA.
u8 * format_ila_dpo(u8 *s, va_list *va)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
u32 next_hop_child_index
The child index on the FIB entry.
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
static uword max_log2(uword x)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
static void ila_dpo_lock(dpo_id_t *dpo)
no-op lock function.
A FIB graph nodes virtual function table.
ila_csum_mode_t csum_mode
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
u16 dpoi_next_node
The next VLIB node to follow.
#define foreach_ila_error
static uword unformat_ila_csum_mode(unformat_input_t *input, va_list *args)
static const char *const *const ila_nodes[DPO_PROTO_NUM]
static uword ila_sir2ila(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 * format_ila_type(u8 *s, va_list *args)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int ila_interface(u32 sw_if_index, u8 disable)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE
static u16 ip_csum_fold(ip_csum_t c)
static ip_csum_t ip_csum_add_even(ip_csum_t c, ip_csum_t x)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.