|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
80 "FLOWPROBE[%s]: rx_sw_if_index %d, tx_sw_if_index %d, "
106 #define foreach_flowprobe_error \
107 _(COLLISION, "Hash table collisions") \
108 _(BUFFER, "Buffer allocation error") \
109 _(EXPORTED_PACKETS, "Exported packets") \
110 _(INPATH, "Exported packets in path")
114 #define _(sym,str) FLOWPROBE_ERROR_##sym,
121 #define _(sym,string) string,
133 #define FLOWPROBE_NEXT_NODES { \
134 [FLOWPROBE_NEXT_DROP] = "error-drop", \
135 [FLOWPROBE_NEXT_IP4_LOOKUP] = "ip4-lookup", \
152 #define NTP_TIMESTAMP 2208988800LU
220 sizeof (ip6_address_t));
221 offset +=
sizeof (ip6_address_t);
225 sizeof (ip6_address_t));
226 offset +=
sizeof (ip6_address_t);
292 #ifdef clib_crc32c_uses_intrinsics
293 h = clib_crc32c ((
u8 *) k,
sizeof (*k));
297 for (
i = 0;
i <
sizeof (*k) / 8;
i++)
303 return h >> (32 -
fm->ht_log2len);
317 *poolindex =
fm->hash_per_worker[my_cpu_number][
h];
318 if (*poolindex != ~0)
344 pool_get (
fm->pool_per_worker[my_cpu_number], e);
345 *poolindex = e -
fm->pool_per_worker[my_cpu_number];
346 fm->hash_per_worker[my_cpu_number][
h] = *poolindex;
350 if (
fm->passive_timer > 0)
353 (
fm->timers_per_worker[my_cpu_number], *poolindex, 0,
372 bool collect_ip4 =
false, collect_ip6 =
false;
375 u16 ethertype = clib_net_to_host_u16 (eth->
type);
402 if (collect_ip6 && ethertype == ETHERNET_TYPE_IP6)
415 else if (k.
protocol == IP_PROTOCOL_TCP)
418 octets = clib_net_to_host_u16 (
ip6->payload_length)
421 if (collect_ip4 && ethertype == ETHERNET_TYPE_IP4)
435 octets = clib_net_to_host_u16 (
ip4->length);
447 tcp_flags = tcp->flags;
467 if (
fm->active_timer > 0)
470 bool collision =
false;
481 FLOWPROBE_ERROR_COLLISION, 1);
492 e = &
fm->stateless_entry[my_cpu_number];
503 e->
prot.
tcp.flags |= tcp_flags;
504 if (
fm->active_timer == 0
536 if (
fm->context[
which].next_record_offset_per_worker[my_cpu_number] <=
560 ip->ip_version_and_header_length = 0x45;
562 ip->protocol = IP_PROTOCOL_UDP;
563 ip->flags_and_fragment_offset = 0;
571 h->export_time = (
u32)
574 h->export_time = clib_host_to_net_u32 (
h->export_time);
575 h->domain_id = clib_host_to_net_u32 (stream->
domain_id);
579 h->sequence_number = clib_host_to_net_u32 (
h->sequence_number);
583 (sizeof (*
ip) +
sizeof (*udp) +
586 (sizeof (*
ip) +
sizeof (*udp)));
604 f =
fm->context[
which].frames_per_worker[my_cpu_number];
609 fm->context[
which].frames_per_worker[my_cpu_number] =
f;
620 FLOWPROBE_ERROR_EXPORTED_PACKETS, 1);
622 fm->context[
which].frames_per_worker[my_cpu_number] = 0;
623 fm->context[
which].buffers_per_worker[my_cpu_number] = 0;
624 fm->context[
which].next_record_offset_per_worker[my_cpu_number] =
638 b0 =
fm->context[
which].buffers_per_worker[my_cpu_number];
646 FLOWPROBE_ERROR_BUFFER, 1);
651 b0 =
fm->context[
which].buffers_per_worker[my_cpu_number] =
657 (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT);
660 fm->context[
which].next_record_offset_per_worker[my_cpu_number] =
674 bool collect_ip4 =
false, collect_ip6 =
false;
678 fm->context[
which].next_record_offset_per_worker[my_cpu_number];
712 fm->context[
which].next_record_offset_per_worker[my_cpu_number] =
offset;
763 to_next[0] = bi0 =
from[0];
764 to_next[1] = bi1 =
from[1];
778 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
788 u16 ethertype1 = clib_net_to_host_u16 (eh1->
type);
798 to_next, n_left_to_next,
799 bi0, bi1, next0, next1);
823 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
829 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
840 to_next, n_left_to_next,
846 return frame->n_vectors;
913 fm->hash_per_worker[my_cpu_number][
h] = ~0;
937 fm->disabled =
false;
940 u32 *to_be_removed = 0, *
i;
949 tw_timer_expire_timers_2t_1w_2048sl (
fm->timers_per_worker[cpu_index],
956 if (
now > start_time + 100e-6
976 (
fm->timers_per_worker[cpu_index], *
i, 0, delta);
1002 .name =
"flowprobe-ip4",
1003 .vector_size =
sizeof (
u32),
1013 .name =
"flowprobe-ip6",
1014 .vector_size =
sizeof (
u32),
1024 .name =
"flowprobe-l2",
1025 .vector_size =
sizeof (
u32),
1035 .name =
"flowprobe-walker",
1037 .state = VLIB_NODE_STATE_INTERRUPT,
void flowprobe_flush_callback_l2(void)
static char * flowprobe_variant_strings[]
static void flush_record(flowprobe_variant_t which)
flowprobe_main_t flowprobe_main
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
vlib_node_registration_t flowprobe_walker_node
(constructor) VLIB_REGISTER_NODE (flowprobe_walker_node)
flow_report_main_t flow_report_main
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
uword flowprobe_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, flowprobe_variant_t which)
nat44_ei_hairpin_src_next_t next_index
flowprobe_entry_t * flowprobe_create(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex)
vl_api_mac_address_t src_mac
ip46_address_t dst_address
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.
struct _tcp_header tcp_header_t
u8 * format_ethernet_address(u8 *s, va_list *args)
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
@ VLIB_NODE_TYPE_INTERNAL
static char * flowprobe_error_strings[]
vlib_main_t vlib_node_runtime_t * node
static void add_to_flow_record_state(vlib_main_t *vm, vlib_node_runtime_t *node, flowprobe_main_t *fm, vlib_buffer_t *b, timestamp_nsec_t timestamp, u16 length, flowprobe_variant_t which, flowprobe_trace_t *t)
ip46_address_t src_address
static u32 flowprobe_common_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
u8 src_mac[6]
L2 information.
void flowprobe_flush_callback_ip6(void)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static void flowprobe_delete_by_index(u32 my_cpu_number, u32 poolindex)
static uword flowprobe_ip4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
#define pool_put_index(p, i)
Free pool element with given index.
timestamp_nsec_t flow_start
static u16 flowprobe_get_headersize(void)
struct flowprobe_entry_t::@56::@57 tcp
u32 rx_sw_if_index
interface handle
u16 src_port
L4 information.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
vlib_node_registration_t flowprobe_l2_node
(constructor) VLIB_REGISTER_NODE (flowprobe_l2_node)
@ FLOWPROBE_NEXT_IP4_LOOKUP
#define CLIB_PREFETCH(addr, size, type)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static u32 flowprobe_l2_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
timestamp_nsec_t flow_end
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_flowprobe_error
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
#define VLIB_NODE_FLAG_TRACE
struct clib_bihash_value offset
template key/value backing page structure
ip46_address_t dst_address
static flowprobe_variant_t flowprobe_get_variant(flowprobe_variant_t which, flowprobe_record_t flags, u16 ethertype)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
static u32 flowprobe_hash(flowprobe_key_t *k)
u64 timestamp
packet timestamp
void flowprobe_flush_callback_ip4(void)
ip4_address_t ipfix_collector
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
sll srl srl sll sra u16x4 i
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static u64 clib_xxhash(u64 key)
static u32 version_length(u16 length)
flow_report_stream_t * streams
flow-per-packet plugin header file
#define CLIB_CACHE_LINE_BYTES
static u32 flowprobe_l3_ip6_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
struct _vlib_node_registration vlib_node_registration_t
static_always_inline uword os_get_thread_index(void)
u16 current_length
Nbytes between current data and the end of this buffer.
static u32 flowprobe_l3_ip4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
ip46_address_t src_address
L3 information.
#define FLOW_MAXIMUM_EXPORT_ENTRIES
static void unix_time_now_nsec_fraction(u32 *sec, u32 *nsec)
#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.
ip4_address_t src_address
template key/value backing page structure
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
format_function_t format_ip46_address
u16 buffer_size
size of the buffer
vlib_node_registration_t flowprobe_ip4_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip4_node)
#define vec_foreach(var, vec)
Vector iterator.
flowprobe_variant_t which
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static uword flowprobe_walker_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static vlib_main_t * vlib_get_main(void)
static u8 * format_flowprobe_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
flowprobe_variant_t which
static u16 ip4_header_checksum(ip4_header_t *i)
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define clib_warning(format, args...)
static u32 flowprobe_l4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
#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)
static vlib_buffer_t * flowprobe_get_buffer(vlib_main_t *vm, flowprobe_variant_t which)
flowprobe_entry_t * flowprobe_lookup(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex, bool *collision)
static void flowprobe_export_entry(vlib_main_t *vm, flowprobe_entry_t *e)
#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).
union flowprobe_entry_t::@56 prot
vl_api_fib_path_type_t type
static uword flowprobe_ip6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define FLOWPROBE_NEXT_NODES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static void flowprobe_export_send(vlib_main_t *vm, vlib_buffer_t *b0, flowprobe_variant_t which)
VLIB buffer representation.
static uword flowprobe_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_node_registration_t flowprobe_ip6_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip6_node)
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags