|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
44 #ifndef CLIB_MARCH_VARIANT
48 #define foreach_ip6_hbyh_ioam_input_next \
49 _(IP6_REWRITE, "ip6-rewrite") \
50 _(IP6_LOOKUP, "ip6-lookup") \
55 #define _(s,n) IP6_HBYH_IOAM_INPUT_NEXT_##s,
61 #ifndef CLIB_MARCH_VARIANT
65 u64 *opaquep = va_arg (*args,
u64 *);
69 if (
unformat (input,
"ioam-encap %s", &flow_name))
74 else if (
unformat (input,
"ioam-decap %s", &flow_name))
97 return (
flow->flow_name);
104 int rewrite_options (
u8 * rewrite_string,
140 int config_handler (
void *
data,
u8 disable))
148 return (VNET_API_ERROR_INVALID_REGISTRATION);
164 return (VNET_API_ERROR_INVALID_REGISTRATION);
173 u32 ioam_flow_handler (
u32 flow_ctx,
u8 add))
181 return (VNET_API_ERROR_INVALID_REGISTRATION);
197 return (VNET_API_ERROR_INVALID_REGISTRATION);
224 #define foreach_ip6_add_hop_by_hop_error \
225 _(PROCESSED, "Pkts w/ added ip6 hop-by-hop options")
229 #define _(sym,str) IP6_ADD_HOP_BY_HOP_ERROR_##sym,
236 #define _(sym,string) string,
268 u64 *copy_src0, *copy_dst0, *copy_src1, *copy_dst1;
288 to_next[0] = bi0 =
from[0];
289 to_next[1] = bi1 =
from[1];
303 copy_dst0 = (
u64 *) (((
u8 *) ip0) - rewrite_length);
304 copy_dst1 = (
u64 *) (((
u8 *) ip1) - rewrite_length);
305 copy_src0 = (
u64 *) ip0;
306 copy_src1 = (
u64 *) ip1;
308 copy_dst0[0] = copy_src0[0];
309 copy_dst0[1] = copy_src0[1];
310 copy_dst0[2] = copy_src0[2];
311 copy_dst0[3] = copy_src0[3];
312 copy_dst0[4] = copy_src0[4];
314 copy_dst1[0] = copy_src1[0];
315 copy_dst1[1] = copy_src1[1];
316 copy_dst1[2] = copy_src1[2];
317 copy_dst1[3] = copy_src1[3];
318 copy_dst1[4] = copy_src1[4];
336 clib_net_to_host_u16 (ip0->payload_length) + rewrite_length;
339 ip0->payload_length = clib_host_to_net_u16 (new_l0);
343 next0 = IP6_HBYH_IOAM_INPUT_NEXT_IP6_LOOKUP;
344 next1 = IP6_HBYH_IOAM_INPUT_NEXT_IP6_LOOKUP;
351 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
357 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
367 to_next, n_left_to_next,
368 bi0, bi1, next0, next1);
377 u64 *copy_src0, *copy_dst0;
393 copy_dst0 = (
u64 *) (((
u8 *) ip0) - rewrite_length);
394 copy_src0 = (
u64 *) ip0;
396 copy_dst0[0] = copy_src0[0];
397 copy_dst0[1] = copy_src0[1];
398 copy_dst0[2] = copy_src0[2];
399 copy_dst0[3] = copy_src0[3];
400 copy_dst0[4] = copy_src0[4];
411 clib_net_to_host_u16 (ip0->payload_length) + rewrite_length;
412 ip0->payload_length = clib_host_to_net_u16 (new_l0);
415 next0 = IP6_HBYH_IOAM_INPUT_NEXT_IP6_LOOKUP;
418 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
429 to_next, n_left_to_next,
437 IP6_ADD_HOP_BY_HOP_ERROR_PROCESSED, processed);
438 return frame->n_vectors;
444 .name =
"ip6-add-hop-by-hop",
445 .vector_size =
sizeof (
u32),
453 #define _(s,n) [IP6_HBYH_IOAM_INPUT_NEXT_##s] = n,
479 #ifndef CLIB_MARCH_VARIANT
517 #define foreach_ip6_pop_hop_by_hop_error \
518 _(PROCESSED, "Pkts w/ removed ip6 hop-by-hop options") \
519 _(NO_HOHO, "Pkts w/ no ip6 hop-by-hop options") \
520 _(OPTION_FAILED, "ip6 pop hop-by-hop failed to process")
524 #define _(sym,str) IP6_POP_HOP_BY_HOP_ERROR_##sym,
531 #define _(sym,string) string,
551 ((
u8 *) hbh0 + ((hbh0->
length + 1) << 3));
554 while (opt0 < limit0)
571 IP6_POP_HOP_BY_HOP_ERROR_OPTION_FAILED,
606 u32 adj_index0, adj_index1;
610 u64 *copy_dst0, *copy_src0, *copy_dst1, *copy_src1;
628 to_next[0] = bi0 =
from[0];
629 to_next[1] = bi1 =
from[1];
659 ((hbh0->
length + 1) << 3);
661 ((hbh1->
length + 1) << 3);
669 copy_src0 = (
u64 *) ip0;
670 copy_src1 = (
u64 *) ip1;
671 copy_dst0 = copy_src0 + (hbh0->
length + 1);
672 copy_dst0[4] = copy_src0[4];
673 copy_dst0[3] = copy_src0[3];
674 copy_dst0[2] = copy_src0[2];
675 copy_dst0[1] = copy_src0[1];
676 copy_dst0[0] = copy_src0[0];
677 copy_dst1 = copy_src1 + (hbh1->
length + 1);
678 copy_dst1[4] = copy_src1[4];
679 copy_dst1[3] = copy_src1[3];
680 copy_dst1[2] = copy_src1[2];
681 copy_dst1[1] = copy_src1[1];
682 copy_dst1[0] = copy_src1[0];
688 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
694 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
704 to_next, n_left_to_next,
705 bi0, bi1, next0, next1);
717 u64 *copy_dst0, *copy_src0;
745 ((hbh0->
length + 1) << 3);
748 copy_src0 = (
u64 *) ip0;
749 copy_dst0 = copy_src0 + (hbh0->
length + 1);
750 copy_dst0[4] = copy_src0[4];
751 copy_dst0[3] = copy_src0[3];
752 copy_dst0[2] = copy_src0[2];
753 copy_dst0[1] = copy_src0[1];
754 copy_dst0[0] = copy_src0[0];
758 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
767 to_next, n_left_to_next,
775 IP6_POP_HOP_BY_HOP_ERROR_PROCESSED, processed);
777 IP6_POP_HOP_BY_HOP_ERROR_NO_HOHO, no_header);
778 return frame->n_vectors;
784 .name =
"ip6-pop-hop-by-hop",
785 .vector_size =
sizeof (
u32),
788 .sibling_of =
"ip6-lookup",
802 #ifndef CLIB_MARCH_VARIANT
813 s =
format (s,
"IP6_LOCAL_HOP_BY_HOP: protocol %d, next index %d\n",
822 #define foreach_ip6_local_hop_by_hop_error \
823 _(UNKNOWN, "Unknown protocol ip6 local h-b-h packets dropped") \
824 _(OK, "Good ip6 local h-b-h packets")
828 #define _(sym,str) IP6_LOCAL_HOP_BY_HOP_ERROR_##sym,
834 #ifndef CLIB_MARCH_VARIANT
836 #define _(sym,string) string,
857 u32 unknown_proto_error =
node->errors[IP6_LOCAL_HOP_BY_HOP_ERROR_UNKNOWN];
873 u8 *hbh0, *hbh1, *hbh2, *hbh3;
908 next[0] =
rt->next_index_by_protocol[*hbh0];
909 next[1] =
rt->next_index_by_protocol[*hbh1];
910 next[2] =
rt->next_index_by_protocol[*hbh2];
911 next[3] =
rt->next_index_by_protocol[*hbh3];
913 b[0]->
error = unknown_proto_error;
914 b[1]->
error = unknown_proto_error;
915 b[2]->
error = unknown_proto_error;
916 b[3]->
error = unknown_proto_error;
926 if (
b[0]->
flags & VLIB_BUFFER_IS_TRACED)
933 if (
b[1]->
flags & VLIB_BUFFER_IS_TRACED)
940 if (
b[2]->
flags & VLIB_BUFFER_IS_TRACED)
947 if (
b[3]->
flags & VLIB_BUFFER_IS_TRACED)
970 next[0] =
rt->next_index_by_protocol[*hbh0];
972 b[0]->
error = unknown_proto_error;
977 if (
b[0]->
flags & VLIB_BUFFER_IS_TRACED)
994 IP6_LOCAL_HOP_BY_HOP_ERROR_OK, ok);
995 return frame->n_vectors;
1008 #ifndef CLIB_MARCH_VARIANT
1012 .name =
"ip6-local-hop-by-hop",
1013 .vector_size =
sizeof (
u32),
1064 .path =
"show ip6 hbh",
1065 .short_help =
"show ip6 hbh",
1074 #ifndef CLIB_MARCH_VARIANT
1111 .runs_after =
VLIB_INITS(
"ip_main_init",
"ip6_lookup_init"),
1132 if (old_next_index &&
1139 int has_pot_option,
int has_seqno_option)
1146 u8 *trace_data_size = NULL;
1147 u8 *pot_data_size = NULL;
1151 if (has_trace_option == 0 && has_pot_option == 0)
1158 if (has_trace_option
1169 if (has_seqno_option)
1175 rnd_size = (
size + 7) & ~7;
1182 hbh->
length = (rnd_size >> 3) - 1;
1183 current = (
u8 *) (hbh + 1);
1185 if (has_trace_option
1195 current += *trace_data_size;
1206 current += *pot_data_size;
1209 if (has_seqno_option &&
1269 .path =
"clear ioam rewrite",
1270 .short_help =
"clear ioam rewrite",
1277 int has_seqno_option,
int has_analyse_option)
1282 has_pot_option, has_seqno_option);
1287 if (has_trace_option)
1303 if (has_seqno_option)
1309 &has_analyse_option,
1317 "ip6_ioam_set_rewrite returned %d",
rv);
1329 int has_trace_option = 0;
1330 int has_pot_option = 0;
1331 int has_seqno_option = 0;
1332 int has_analyse_option = 0;
1338 has_trace_option = 1;
1341 else if (
unformat (input,
"seqno"))
1342 has_seqno_option = 1;
1343 else if (
unformat (input,
"analyse"))
1344 has_analyse_option = 1;
1351 has_seqno_option, has_analyse_option);
1376 .path =
"set ioam rewrite",
1377 .short_help =
"set ioam [trace] [pot] [seqno] [analyse]",
1393 s =
format (s,
" REWRITE FLOW CONFIGS - \n");
1394 s =
format (s,
" Destination Address : %U\n",
1397 format (s,
" Flow operation : %d (%s)\n",
1405 s =
format (s,
" REWRITE FLOW CONFIGS - Not configured\n");
1409 s =
format (s,
" TRACE OPTION - %d (%s)\n",
1415 "Try 'show ioam trace and show ioam-trace profile' for more information\n");
1418 s =
format (s,
" POT OPTION - %d (%s)\n",
1424 "Try 'show ioam pot and show pot profile' for more information\n");
1426 s =
format (s,
" EDGE TO EDGE - SeqNo OPTION - %d (%s)\n",
1430 s =
format (s,
"Try 'show ioam e2e' for more information\n");
1432 s =
format (s,
" iOAM Analyse OPTION - %d (%s)\n",
1460 .path =
"show ioam summary",
1461 .short_help =
"show ioam summary",
ip6_local_hop_by_hop_runtime_t * ip6_local_hbh_runtime
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main
@ IP6_POP_HOP_BY_HOP_N_ERROR
static void ioam_pop_hop_by_hop_processing(vlib_main_t *vm, ip6_header_t *ip0, ip6_hop_by_hop_header_t *hbh0, vlib_buffer_t *b)
@ IP6_HBYH_IOAM_INPUT_N_NEXT
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
int ip6_hbh_flow_handler_unregister(u8 option)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define foreach_ip6_add_hop_by_hop_error
nat44_ei_hairpin_src_next_t next_index
@ IP6_LOCAL_HOP_BY_HOP_N_NEXT
@ IP6_LOCAL_HOP_BY_HOP_N_ERROR
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 next_index_by_protocol[256]
vlib_get_buffers(vm, from, b, n_left_from)
int ip6_ioam_set_rewrite(u8 **rwp, int has_trace_option, int has_pot_option, int has_seqno_option)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
int(* add_options[MAX_IP6_HBH_OPTION])(u8 *rewrite_string, u8 *rewrite_size)
void * ioam_end_of_path_cb
static uword unformat_opaque_ioam(unformat_input_t *input, va_list *args)
#define vlib_call_init_function(vm, x)
@ IP6_ADD_HOP_BY_HOP_N_ERROR
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
int ip6_hbh_pop_unregister_option(u8 option)
u32(* flow_handler[MAX_IP6_HBH_OPTION])(u32 flow_ctx, u8 add)
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
static u32 ioam_flow_add(u8 encap, u8 *flow_name)
static clib_error_t * ip6_hop_by_hop_ioam_init(vlib_main_t *vm)
static void * ip6_next_header(ip6_header_t *i)
static char * ip6_add_hop_by_hop_error_strings[]
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
u8 * get_flow_name_from_flow_ctx(u32 flow_ctx)
#define IOAM_MASK_DECAP_BIT(x)
void vnet_classify_register_unformat_opaque_index_fn(unformat_function_t *fn)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
int(* config_handler[MAX_IP6_HBH_OPTION])(void *data, u8 disable)
ip6_pop_hop_by_hop_error_t
#define CLIB_PREFETCH(addr, size, type)
int ip6_hbh_add_unregister_option(u8 option)
#define clib_error_return_code(e, code, flags, args...)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
ip6_local_hop_by_hop_error_t
@ IP6_LOCAL_HOP_BY_HOP_NEXT_DROP
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_node_registration_t ip6_local_hop_by_hop_node
(constructor) VLIB_REGISTER_NODE (ip6_local_hop_by_hop_node)
int ip6_hbh_flow_handler_register(u8 option, u32 ioam_flow_handler(u32 flow_ctx, u8 add))
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static u8 is_zero_ip6_address(ip6_address_t *a)
sll srl srl sll sra u16x4 i
static vlib_cli_command_t ip6_set_ioam_rewrite_cmd
(constructor) VLIB_CLI_COMMAND (ip6_set_ioam_rewrite_cmd)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define foreach_ip6_hbyh_ioam_input_next
#define VLIB_CLI_COMMAND(x,...)
static u8 * format_ip6_pop_hop_by_hop_trace(u8 *s, va_list *args)
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
clib_error_t * ip_main_init(vlib_main_t *vm)
#define CLIB_CACHE_LINE_BYTES
static clib_error_t * ip6_show_ioam_summary_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip6_add_hop_by_hop_error_t
vlib_node_registration_t ip6_pop_hop_by_hop_node
(constructor) VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node)
ip_lookup_next_t
An adjacency is a representation of an attached L3 peer.
clib_error_t * ip6_ioam_enable(int has_trace_option, int has_pot_option, int has_seqno_option, int has_analyse_option)
vlib_node_registration_t ip6_add_hop_by_hop_node
(constructor) VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node)
static clib_error_t * ip6_set_ioam_rewrite_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE
#define vec_free(V)
Free vector's memory (no header).
#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 vlib_cli_command_t show_ip6_hbh
(constructor) VLIB_CLI_COMMAND (show_ip6_hbh)
static char * ip6_pop_hop_by_hop_error_strings[]
#define HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
static vlib_cli_command_t ip6_show_ioam_run_cmd
(constructor) VLIB_CLI_COMMAND (ip6_show_ioam_run_cmd)
int ip6_hbh_config_handler_unregister(u8 option)
#define VLIB_INIT_FUNCTION(x)
static struct option options[]
vl_api_ip_proto_t protocol
int(* pop_options[MAX_IP6_HBH_OPTION])(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
static u8 * format_ip6_add_hop_by_hop_trace(u8 *s, va_list *args)
clib_error_t * show_ip6_hbh_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip6_local_hop_by_hop_next_t
int ip6_hbh_pop_register_option(u8 option, int options(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt))
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static uword ip6_local_hop_by_hop_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_trace)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static u8 * format_ip6_local_hop_by_hop_trace(u8 *s, va_list *args)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
void ip6_local_hop_by_hop_register_protocol(u32 protocol, u32 node_index)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
ip6_hbyh_ioam_input_next_t
#define clib_warning(format, args...)
void vnet_register_ioam_end_of_path_callback(void *cb)
void ip6_register_protocol(u32 protocol, u32 node_index)
static void * clib_mem_alloc_aligned(uword size, uword align)
u16 nexts[VLIB_FRAME_SIZE]
#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 f64 vlib_time_now(vlib_main_t *vm)
clib_error_t * clear_ioam_rewrite_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 options_size[MAX_IP6_HBH_OPTION]
static vlib_cli_command_t ip6_clear_ioam_rewrite_cmd
(constructor) VLIB_CLI_COMMAND (ip6_clear_ioam_rewrite_cmd)
#define foreach_ip6_pop_hop_by_hop_error
clib_error_t * clear_ioam_rewrite_fn(void)
#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).
static char * ip6_local_hop_by_hop_error_strings[]
int ip6_hbh_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 *rewrite_size))
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
#define foreach_ip6_local_hop_by_hop_error
vl_api_fib_path_type_t type
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
int ip6_hbh_config_handler_register(u8 option, int config_handler(void *data, u8 disable))
vl_api_wireguard_peer_flags_t flags