22 #define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS (64 * 1024) 23 #define ILA_TABLE_DEFAULT_HASH_MEMORY_SIZE (32<<20) 25 #define foreach_ila_error \ 26 _(NONE, "valid ILA packets") 30 #define _(sym,str) ILA_ERROR_##sym, 37 #define _(sym,string) string, 59 .dir = ILA_DIR_ILA2SIR,
65 u64 v = clib_net_to_host_u64 (va_arg (*va,
u64));
67 return format (s,
"%04x:%04x:%04x:%04x",
68 v >> 48, (v >> 32) & 0xffff, (v >> 16) & 0xffff, v & 0xffff);
77 if (t == ILA_DIR_##i) \ 81 return format (s,
"invalid_ila_direction");
93 case ILA_CSUM_MODE_##i: \ 99 txt =
"invalid_ila_csum_mode";
110 if (t == ILA_TYPE_##i) \ 111 return format(s, st); 114 return format (s,
"invalid_ila_type");
125 return format (s,
"%-15s%=40s%=40s%+16s%+18s%+11s",
"Type",
126 "SIR Address",
"ILA Address",
"Adjacency Index",
127 "Checksum Mode",
"Direction");
134 return format (s,
"%-15U%=40U%=40U%16s%18U%11U",
143 return format (s,
"%-15U%=40U%=40U%16d%18U%11U",
162 "ILA -> SIR adj index: %d entry index: %d initial_dst: %U",
172 if (unformat(input, s)) \ 174 *result = ILA_DIR_##i; \ 188 if (unformat(input, s)) \ 190 *result = ILA_TYPE_##i; \ 205 *result = ILA_CSUM_MODE_NO_ACTION;
208 if (
unformat (input,
"neutral-map"))
210 *result = ILA_CSUM_MODE_NEUTRAL_MAP;
213 if (
unformat (input,
"adjust-transport"))
215 *result = ILA_CSUM_MODE_ADJUST_TRANSPORT;
224 u64 *result = va_arg (*args,
u64 *);
227 if (!
unformat (input,
"%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3]))
230 if (a[0] > 0xFFFF || a[1] > 0xFFFF || a[2] > 0xFFFF || a[3] > 0xFFFF)
233 *result = clib_host_to_net_u64 ((((
u64) a[0]) << 48) |
234 (((
u64) a[1]) << 32) |
235 (((
u64) a[2]) << 16) | (((
u64) a[3])));
248 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
255 while (n_left_from > 0)
259 while (n_left_from >= 4 && n_left_to_next >= 2)
281 pi0 = to_next[0] = from[0];
282 pi1 = to_next[1] = from[1];
334 n_left_to_next, pi0, pi1,
340 while (n_left_from > 0 && n_left_to_next > 0)
350 pi0 = to_next[0] = from[0];
391 .function =
ila_ila2sir,.name =
"ila-to-sir",.vector_size =
419 return format (s,
"SIR -> ILA entry index: %d initial_dst: %U",
432 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
439 while (n_left_from > 0)
443 while (n_left_from >= 4 && n_left_to_next >= 2)
450 BVT (clib_bihash_kv) kv0, value0;
451 BVT (clib_bihash_kv) kv1, value1;
468 pi0 = to_next[0] = from[0];
469 pi1 = to_next[1] = from[1];
491 ie0 = &ilm->
entries[value0.value];
494 ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
500 ie1 = &ilm->
entries[value1.value];
503 ILA_DIR_ILA2SIR) ? &ie1->
ila_address : ila_address1;
538 n_left_to_next, pi0, pi1, next0,
543 while (n_left_from > 0 && n_left_to_next > 0)
549 BVT (clib_bihash_kv) kv0, value0;
553 pi0 = to_next[0] = from[0];
570 ie0 = &ilm->
entries[value0.value];
573 ILA_DIR_ILA2SIR) ? &ie0->
ila_address : ila_address0;
594 n_left_to_next, pi0, next0);
604 .function =
ila_sir2ila,.name =
"sir-to-ila",.vector_size =
614 .node_name =
"sir-to-ila",.runs_before =
623 BVT (clib_bihash_kv) kv, value;
626 if (args->
type == ILA_TYPE_IID || args->
type == ILA_TYPE_LUID)
630 clib_warning (
"Incorrect SIR address (ILA type mismatch %d %d)",
636 clib_warning (
"Checksum bit should not be set in SIR address");
640 else if (args->
type == ILA_TYPE_VNIDM)
645 clib_warning (
"SIR multicast address must start with fff");
652 clib_warning (
"SIR multicast address must start with fff");
708 if (e->
csum_mode == ILA_CSUM_MODE_NEUTRAL_MAP)
712 for (i = 0; i < 4; i++)
735 memset (&adj, 0,
sizeof (adj));
742 memset (&route_args, 0,
sizeof (route_args));
767 e = &ilm->
entries[value.value];
773 memset (&route_args, 0,
sizeof (route_args));
801 u32 ci, feature_index;
808 (vm, vcm, ci, feature_index,
851 "ila id to entry index table",
875 args.
type = ILA_TYPE_IID;
876 args.
csum_mode = ILA_CSUM_MODE_NO_ACTION;
878 args.
dir = ILA_DIR_BIDIR;
914 else if (
unformat (line_input,
"del"))
927 "Specified both next hop and adjacency index");
939 "Next-Hop route has to be a rewrite route");
959 .short_help =
"ila entry [type (" "iid,luid,vnid-ip4,vnid-ip6,vnid-multicast" ")]" 960 " [sir-address <address>] [locator <locator>] [vnid <hex-vnid>]" 961 " [adj-index <adj-index>] [next-hop <next-hop>]" 962 " [direction (" "bidir,sir2ila,ila2sir" ")]" 963 " [csum-mode (" "no-action,neutral-map,adjust-transport" ")] [del]",
973 u32 sw_if_index = ~0;
995 .path =
"ila interface",.short_help =
996 "ila interface <interface-name> [disable]",.function =
1011 vlib_cli_output (vm,
" %U\n",
1012 format_ila_entry, vnm, e);
1020 .path =
"show ila entries",.short_help =
"show ila entries",.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.
static u8 * format_ila_entry(u8 *s, va_list *va)
ip6_address_t initial_dst
clib_bihash_24_8_t id_to_entry_table
sll srl srl sll sra u16x4 i
u32 * config_index_by_sw_if_index
ip6_address_t initial_dst
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
static vlib_main_t * vlib_get_main(void)
u8 * format_half_ip6_address(u8 *s, va_list *va)
ip_lookup_next_t lookup_next_index
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
u8 * format_ila_sir2ila_trace(u8 *s, va_list *args)
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
ip_config_main_t rx_config_mains[VNET_N_CAST]
rx/tx interface/feature configuration.
static uword unformat_ila_type(unformat_input_t *input, va_list *args)
ip6_address_t ila_address
struct _vlib_node_registration vlib_node_registration_t
static ila_main_t ila_main
unformat_function_t unformat_vnet_sw_interface
u8 opaque[IP_ADJACENCY_OPAQUE_SZ]
#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)
u8 * ila_format_adjacency(u8 *s, va_list *va)
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)
#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)
#define ILA_TABLE_DEFAULT_HASH_NUM_BUCKETS
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static uword unformat_ila_direction(unformat_input_t *input, va_list *args)
#define clib_warning(format, args...)
u32 table_index_or_table_id
static ila_entry_t ila_sir2ila_default_entry
static char * ila_error_strings[]
void ip6_add_del_route(ip6_main_t *im, ip6_add_del_route_args_t *args)
u64 lookup_table_nbuckets
static uword unformat_half_ip6_address(unformat_input_t *input, va_list *args)
static vlib_node_registration_t ila_ila2sir_node
(constructor) VLIB_REGISTER_NODE (ila_ila2sir_node)
ip6_address_t dst_address
#define ila_csum_foreach_type
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define pool_put(P, E)
Free an object E in pool P.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
u8 * format_ila_csum_mode(u8 *s, va_list *va)
ila_csum_mode_t csum_mode
u32 ip6_get_route(ip6_main_t *im, u32 fib_index_or_table_id, u32 flags, ip6_address_t *address, u32 address_length)
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.
#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,...)
u8 * format_ila_direction(u8 *s, va_list *args)
static vlib_node_registration_t ila_sir2ila_node
(constructor) VLIB_REGISTER_NODE (ila_sir2ila_node)
VNET_IP6_REGISTER_ADJACENCY(ila2sir)
#define CLIB_PREFETCH(addr, size, type)
u8 * format_ila_ila2sir_trace(u8 *s, va_list *args)
#define IP6_ROUTE_FLAG_DEL
static uword ila_ila2sir(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static clib_error_t * ila_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 ila_sir2ila_feature_index
ip_lookup_main_t lookup_main
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)
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
u32 ip6_lookup_next_index
#define VLIB_BUFFER_IS_TRACED
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
static uword max_log2(uword x)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define IP_ADJACENCY_OPAQUE_SZ
VNET_IP6_UNICAST_FEATURE_INIT(ila_sir2ila, static)
ila_csum_mode_t csum_mode
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
This packet is to be rewritten and forwarded to the next processing node.
#define IP6_ROUTE_FLAG_ADD
i16 explicit_fib_index
Force re-lookup in a different FIB.
#define clib_error_return(e, args...)
#define foreach_ila_error
static uword unformat_ila_csum_mode(unformat_input_t *input, va_list *args)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
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
vnet_config_main_t config_main
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)
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)