24 #define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS (64 * 1024) 25 #define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE (32<<20) 27 #define foreach_ila_error \ 28 _(NONE, "valid ILA packets") 31 #define _(sym,str) ILA_ERROR_##sym, 38 #define _(sym,string) string, 57 .dir = ILA_DIR_ILA2SIR,
73 u64 v = clib_net_to_host_u64 (va_arg (*va,
u64));
75 return format (s,
"%04x:%04x:%04x:%04x",
76 v >> 48, (v >> 32) & 0xffff, (v >> 16) & 0xffff, v & 0xffff);
85 if (t == ILA_DIR_##i) \ 89 return format (s,
"invalid_ila_direction");
101 case ILA_CSUM_MODE_##i: \ 107 txt =
"invalid_ila_csum_mode";
118 if (t == ILA_TYPE_##i) \ 119 return format(s, st); 122 return format (s,
"invalid_ila_type");
133 return format (s,
"%-15s%=40s%=40s%+16s%+18s%+11s",
"Type",
"SIR Address",
134 "ILA Address",
"Checksum Mode",
"Direction",
"Next DPO");
140 return format (s,
"%-15U%=40U%=40U%18U%11U%s",
150 return format (s,
"%-15U%=40U%=40U%18U%11U%U",
170 "ILA -> SIR adj index: %d entry index: %d initial_dst: %U",
180 if (unformat(input, s)) \ 182 *result = ILA_DIR_##i; \ 196 if (unformat(input, s)) \ 198 *result = ILA_TYPE_##i; \ 213 *result = ILA_CSUM_MODE_NO_ACTION;
216 if (
unformat (input,
"neutral-map"))
218 *result = ILA_CSUM_MODE_NEUTRAL_MAP;
221 if (
unformat (input,
"adjust-transport"))
223 *result = ILA_CSUM_MODE_ADJUST_TRANSPORT;
232 u64 *result = va_arg (*args,
u64 *);
235 if (!
unformat (input,
"%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3]))
238 if (a[0] > 0xFFFF || a[1] > 0xFFFF || a[2] > 0xFFFF || a[3] > 0xFFFF)
241 *result = clib_host_to_net_u64 ((((
u64) a[0]) << 48) |
242 (((
u64) a[1]) << 32) |
243 (((
u64) a[2]) << 16) | (((
u64) a[3])));
254 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
261 while (n_left_from > 0)
265 while (n_left_from >= 4 && n_left_to_next >= 2)
285 pi0 = to_next[0] = from[0];
286 pi1 = to_next[1] = from[1];
321 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
322 sir_address1 = (ie1->
dir != ILA_DIR_SIR2ILA) ? &ie1->
sir_address : sir_address1;
332 n_left_to_next, pi0, pi1,
338 while (n_left_from > 0 && n_left_to_next > 0)
346 pi0 = to_next[0] = from[0];
367 sir_address0 = (ie0->
dir != ILA_DIR_SIR2ILA) ? &ie0->
sir_address : sir_address0;
386 .name =
"ila-to-sir",
387 .vector_size =
sizeof (
u32),
418 return format (s,
"SIR -> ILA entry index: %d initial_dst: %U",
428 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
435 while (n_left_from > 0)
439 while (n_left_from >= 4 && n_left_to_next >= 2)
446 BVT (clib_bihash_kv) kv0, value0;
447 BVT (clib_bihash_kv) kv1, value1;
464 pi0 = to_next[0] = from[0];
465 pi1 = to_next[1] = from[1];
486 ie0 = &ilm->
entries[value0.value];
487 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
492 ie1 = &ilm->
entries[value1.value];
493 ila_address1 = (ie1->
dir != ILA_DIR_ILA2SIR) ? &ie1->
ila_address : ila_address1;
523 n_left_to_next, pi0, pi1, next0,
528 while (n_left_from > 0 && n_left_to_next > 0)
534 BVT (clib_bihash_kv) kv0, value0;
538 pi0 = to_next[0] = from[0];
554 ie0 = &ilm->
entries[value0.value];
555 ila_address0 = (ie0->
dir != ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
574 n_left_to_next, pi0, next0);
586 .vector_size =
sizeof (
u32),
601 .arc_name =
"ip6-unicast",
602 .node_name =
"sir-to-ila",
624 BVT (clib_bihash_kv) kv, value;
627 if (args->
type == ILA_TYPE_IID || args->
type == ILA_TYPE_LUID)
631 clib_warning (
"Incorrect SIR address (ILA type mismatch %d %d)",
637 clib_warning (
"Checksum bit should not be set in SIR address");
641 else if (args->
type == ILA_TYPE_VNIDM)
646 clib_warning (
"SIR multicast address must start with fff");
653 clib_warning (
"SIR multicast address must start with fff");
698 if (e->
csum_mode == ILA_CSUM_MODE_NEUTRAL_MAP)
702 for (i = 0; i < 4; i++)
785 e = &ilm->
entries[value.value];
839 return format(s,
"ILA: idx:%d sir:%U",
935 "ila id to entry index table",
955 args.
type = ILA_TYPE_IID;
956 args.
csum_mode = ILA_CSUM_MODE_NO_ACTION;
958 args.
dir = ILA_DIR_BIDIR;
988 else if (
unformat (line_input,
"del"))
1008 .path =
"ila entry",
1009 .short_help =
"ila entry [type <type>] [sir-address <address>] [locator <locator>] [vnid <hex-vnid>]" 1010 " [adj-index <adj-index>] [next-hop <next-hop>] [direction (bidir|sir2ila|ila2sir)]" 1011 " [csum-mode (no-action|neutral-map|transport-adjust)] [del]",
1020 u32 sw_if_index = ~0;
1042 .path =
"ila interface",
1043 .short_help =
"ila interface <interface-name> [disable]",
1059 vlib_cli_output (vm,
" %U\n", format_ila_entry, vnm, e);
1067 .path =
"show ila entries",
1068 .short_help =
"show ila entries",
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.
static u8 * format_ila_entry(u8 *s, va_list *va)
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
sll srl srl sll sra u16x4 i
A virtual function table regisitered for a DPO type.
ila_sir2ila_next_t
INDENT-ON
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
ip6_address_t initial_dst
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
struct _vlib_node_registration vlib_node_registration_t
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)
vnet_main_t * vnet_get_main(void)
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
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
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_warning(format, 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 ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
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, adj_index_t adj_index)
Add a 'special' entry to the FIB that links to the adj passed A special entry is an entry that the FI...
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
#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.
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#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
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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
static const char *const ila_ip6_nodes[]
#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.
u8 * format_ila_ila2sir_trace(u8 *s, va_list *args)
static ila_entry_t * ila_entry_from_fib_node(fib_node_t *node)
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 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...
static uword ip6_address_is_zero(ip6_address_t *a)
int clib_bihash_search(clib_bihash *h, clib_bihash_kv *search_v, clib_bihash_kv *return_v)
Search a bi-hash table.
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
ip6_address_t sir_address
clib_error_t * vlib_plugin_register(vlib_main_t *vm, vnet_plugin_handoff_t *h, int from_early_init)
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
#define VLIB_BUFFER_IS_TRACED
#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)
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)
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
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
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 clib_error_return(e, args...)
#define foreach_ila_error
static uword unformat_ila_csum_mode(unformat_input_t *input, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
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)
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.