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,
79 u64 v = clib_net_to_host_u64 (va_arg (*va,
u64));
81 return format (s,
"%04x:%04x:%04x:%04x",
82 v >> 48, (v >> 32) & 0xffff, (v >> 16) & 0xffff, v & 0xffff);
91 if (t == ILA_DIR_##i) \ 95 return format (s,
"invalid_ila_direction");
107 case ILA_CSUM_MODE_##i: \ 113 txt =
"invalid_ila_csum_mode";
124 if (t == ILA_TYPE_##i) \ 125 return format(s, st); 128 return format (s,
"invalid_ila_type");
139 return format (s,
"%-15s%=40s%=40s%+16s%+18s%+11s",
"Type",
"SIR Address",
140 "ILA Address",
"Checksum Mode",
"Direction",
"Next DPO");
146 return format (s,
"%-15U%=40U%=40U%18U%11U%s",
156 return format (s,
"%-15U%=40U%=40U%18U%11U%U",
176 "ILA -> SIR adj index: %d entry index: %d initial_dst: %U",
186 if (unformat(input, s)) \ 188 *result = ILA_DIR_##i; \ 202 if (unformat(input, s)) \ 204 *result = ILA_TYPE_##i; \ 219 *result = ILA_CSUM_MODE_NO_ACTION;
222 if (
unformat (input,
"neutral-map"))
224 *result = ILA_CSUM_MODE_NEUTRAL_MAP;
227 if (
unformat (input,
"adjust-transport"))
229 *result = ILA_CSUM_MODE_ADJUST_TRANSPORT;
238 u64 *result = va_arg (*args,
u64 *);
241 if (!
unformat (input,
"%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3]))
244 if (a[0] > 0xFFFF || a[1] > 0xFFFF || a[2] > 0xFFFF || a[3] > 0xFFFF)
247 *result = clib_host_to_net_u64 ((((
u64) a[0]) << 48) |
248 (((
u64) a[1]) << 32) |
249 (((
u64) a[2]) << 16) | (((
u64) a[3])));
260 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
267 while (n_left_from > 0)
271 while (n_left_from >= 4 && n_left_to_next >= 2)
291 pi0 = to_next[0] = from[0];
292 pi1 = to_next[1] = from[1];
327 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
328 sir_address1 = (ie1->
dir != ILA_DIR_SIR2ILA) ? &ie1->
sir_address : sir_address1;
338 n_left_to_next, pi0, pi1,
344 while (n_left_from > 0 && n_left_to_next > 0)
352 pi0 = to_next[0] = from[0];
373 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
392 .name =
"ila-to-sir",
393 .vector_size =
sizeof (
u32),
424 return format (s,
"SIR -> ILA entry index: %d initial_dst: %U",
434 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
441 while (n_left_from > 0)
445 while (n_left_from >= 4 && n_left_to_next >= 2)
452 BVT (clib_bihash_kv) kv0, value0;
453 BVT (clib_bihash_kv) kv1, value1;
470 pi0 = to_next[0] = from[0];
471 pi1 = to_next[1] = from[1];
492 ie0 = &ilm->
entries[value0.value];
493 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
496 if ((BV (clib_bihash_search)
498 ie1 = &ilm->
entries[value1.value];
499 ila_address1 = (ie1->
dir != ILA_DIR_ILA2SIR) ? &ie1->
ila_address : ila_address1;
529 n_left_to_next, pi0, pi1, next0,
534 while (n_left_from > 0 && n_left_to_next > 0)
540 BVT (clib_bihash_kv) kv0, value0;
544 pi0 = to_next[0] = from[0];
560 ie0 = &ilm->
entries[value0.value];
561 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
580 n_left_to_next, pi0, next0);
592 .vector_size =
sizeof (
u32),
607 .arc_name =
"ip6-unicast",
608 .node_name =
"sir-to-ila",
633 if (args->
type == ILA_TYPE_IID || args->
type == ILA_TYPE_LUID)
637 clib_warning (
"Incorrect SIR address (ILA type mismatch %d %d)",
643 clib_warning (
"Checksum bit should not be set in SIR address");
647 else if (args->
type == ILA_TYPE_VNIDM)
652 clib_warning (
"SIR multicast address must start with fff");
659 clib_warning (
"SIR multicast address must start with fff");
704 if (e->
csum_mode == ILA_CSUM_MODE_NEUTRAL_MAP)
708 for (i = 0; i < 4; i++)
790 e = &ilm->
entries[value.value];
831 .version = VPP_BUILD_VER,
832 .description =
"Identifier Locator Addressing (ILA) for IPv6",
842 return format(s,
"ILA: idx:%d sir:%U",
938 "ila id to entry index table",
961 args.
type = ILA_TYPE_IID;
962 args.
csum_mode = ILA_CSUM_MODE_NO_ACTION;
964 args.
dir = ILA_DIR_BIDIR;
994 else if (
unformat (line_input,
"del"))
1024 .path =
"ila entry",
1025 .short_help =
"ila entry [type <type>] [sir-address <address>] [locator <locator>] [vnid <hex-vnid>]" 1026 " [adj-index <adj-index>] [next-hop <next-hop>] [direction (bidir|sir2ila|ila2sir)]" 1027 " [csum-mode (no-action|neutral-map|transport-adjust)] [del]",
1058 .path =
"ila interface",
1059 .short_help =
"ila interface <interface-name> [disable]",
1075 vlib_cli_output (vm,
" %U\n", format_ila_entry, vnm, e);
1083 .path =
"show ila entries",
1084 .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
enum fib_source_t_ fib_source_t
The different sources that can create a route.
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)
add paths without path extensions
dpo_id_t ila_dpo
The next DPO in the graph 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.
vl_api_interface_index_t sw_if_index
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
Recursive resolution source.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Aggregate type for a prefix.
static uword unformat_ila_direction(unformat_input_t *input, va_list *args)
#define clib_error_return(e, args...)
static fib_source_t ila_fib_src
FIB source for adding entries.
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.
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
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.
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
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.
vlib_main_t vlib_node_runtime_t * node
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.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
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.