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 162 offset +=
sizeof (rx_if);
167 offset +=
sizeof (tx_if);
172 offset +=
sizeof (
u64);
177 offset +=
sizeof (
u32);
180 offset +=
sizeof (
u32);
185 offset +=
sizeof (
u32);
188 offset +=
sizeof (
u32);
190 return offset - start;
210 return offset - start;
220 sizeof (ip6_address_t));
221 offset +=
sizeof (ip6_address_t);
225 sizeof (ip6_address_t));
226 offset +=
sizeof (ip6_address_t);
234 offset +=
sizeof (
u64);
236 return offset - start;
260 offset +=
sizeof (
u64);
262 return offset - start;
283 return offset - start;
292 #ifdef clib_crc32c_uses_intrinsics 293 h = clib_crc32c ((
u8 *) k,
sizeof (*k));
297 for (i = 0; i <
sizeof (*k) / 8; i++)
298 tmp ^= ((
u64 *) k)[
i];
318 if (*poolindex != ~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)
421 if (collect_ip4 && ethertype == ETHERNET_TYPE_IP4)
430 if ((flags & FLOW_RECORD_L4) && k.
protocol == IP_PROTOCOL_UDP)
432 else if ((flags & FLOW_RECORD_L4) && k.
protocol == IP_PROTOCOL_TCP)
435 octets = clib_net_to_host_u16 (ip4->
length);
447 tcp_flags = tcp->flags;
470 bool collision =
false;
481 FLOWPROBE_ERROR_COLLISION, 1);
503 e->
prot.
tcp.flags |= tcp_flags;
541 for (i = 0; i <
index; i++)
566 udp->
src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
567 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
583 (sizeof (*ip) +
sizeof (*udp) +
586 (sizeof (*ip) +
sizeof (*udp)));
620 FLOWPROBE_ERROR_EXPORTED_PACKETS, 1);
646 FLOWPROBE_ERROR_BUFFER, 1);
658 (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT);
675 bool collect_ip4 =
false, collect_ip6 =
false;
724 u32 n_left_from, *from, *to_next;
735 while (n_left_from > 0)
741 while (n_left_from >= 4 && n_left_to_next >= 2)
764 to_next[0] = bi0 = from[0];
765 to_next[1] = bi1 = from[1];
779 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
789 u16 ethertype1 = clib_net_to_host_u16 (eh1->
type);
799 to_next, n_left_to_next,
800 bi0, bi1, next0, next1);
803 while (n_left_from > 0 && n_left_to_next > 0)
824 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
830 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
841 to_next, n_left_to_next,
941 u32 *to_be_removed = 0, *
i;
950 tw_timer_expire_timers_2t_1w_2048sl (fm->timers_per_worker[cpu_index],
957 if (now > start_time + 100e-6
977 (fm->timers_per_worker[cpu_index], *
i, 0, delta);
1003 .name =
"flowprobe-ip4",
1004 .vector_size =
sizeof (
u32),
1014 .name =
"flowprobe-ip6",
1015 .vector_size =
sizeof (
u32),
1025 .name =
"flowprobe-l2",
1026 .vector_size =
sizeof (
u32),
1036 .name =
"flowprobe-walker",
1038 .state = VLIB_NODE_STATE_INTERRUPT,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
vlib_node_registration_t flowprobe_ip4_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip4_node)
flowprobe_protocol_context_t context[FLOW_N_VARIANTS]
static void flowprobe_export_entry(vlib_main_t *vm, flowprobe_entry_t *e)
u16 buffer_size
size of the buffer
static u32 flowprobe_l2_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
u32 ** expired_passive_per_worker
ip46_address_t src_address
L3 information.
vl_api_wireguard_peer_flags_t flags
ip46_address_t src_address
void flowprobe_flush_callback_ip6(void)
static uword flowprobe_ip6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 src_mac[6]
L2 information.
static void flowprobe_delete_by_index(u32 my_cpu_number, u32 poolindex)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
static void flush_record(flowprobe_variant_t which)
static f64 vlib_time_now(vlib_main_t *vm)
void flowprobe_flush_callback_ip4(void)
u16 current_length
Nbytes between current data and the end of this buffer.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_xxhash(u64 key)
ip4_address_t src_address
union flowprobe_entry_t::@53 prot
flowprobe_entry_t * stateless_entry
static vlib_buffer_t * flowprobe_get_buffer(vlib_main_t *vm, flowprobe_variant_t which)
u16 template_reports[FLOW_N_RECORDS]
flowprobe_entry_t * flowprobe_lookup(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex, bool *collision)
flowprobe_entry_t * flowprobe_create(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
struct _tcp_header tcp_header_t
ip46_address_t dst_address
ip4_address_t ipfix_collector
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
flowprobe_entry_t ** pool_per_worker
flow_report_stream_t * streams
static char * flowprobe_error_strings[]
flowprobe_variant_t which
flow-per-packet plugin header file
static void flowprobe_export_send(vlib_main_t *vm, vlib_buffer_t *b0, flowprobe_variant_t which)
u8 * format_ethernet_address(u8 *s, va_list *args)
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
vlib_node_registration_t flowprobe_ip6_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip6_node)
static u32 flowprobe_common_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
u64 timestamp
packet timestamp
void flowprobe_flush_callback_l2(void)
vlib_frame_t ** frames_per_worker
frames containing ipfix buffers, per-worker thread
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_node_registration_t flowprobe_walker_node
(constructor) VLIB_REGISTER_NODE (flowprobe_walker_node)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static void unix_time_now_nsec_fraction(u32 *sec, u32 *nsec)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
u8 ht_log2len
Per CPU flow-state.
vl_api_fib_path_type_t type
flow_report_main_t flow_report_main
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
vlib_node_registration_t flowprobe_l2_node
(constructor) VLIB_REGISTER_NODE (flowprobe_l2_node)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u16 src_port
L4 information.
static uword flowprobe_walker_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static u8 * format_flowprobe_trace(u8 *s, va_list *args)
u32 node_index
Node index.
#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).
static u32 version_length(u16 length)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
format_function_t format_ip46_address
static u32 flowprobe_hash(flowprobe_key_t *k)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
#define clib_warning(format, args...)
static u16 flowprobe_get_headersize(void)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
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.
timestamp_nsec_t flow_start
vlib_main_t vlib_node_runtime_t * node
vl_api_mac_address_t src_mac
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define pool_put_index(p, i)
Free pool element with given index.
u32 rx_sw_if_index
interface handle
static u32 flowprobe_l3_ip6_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
#define foreach_flowprobe_error
static char * flowprobe_variant_strings[]
static flowprobe_variant_t flowprobe_get_variant(flowprobe_variant_t which, flowprobe_record_t flags, u16 ethertype)
static u32 flowprobe_l4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
#define FLOW_MAXIMUM_EXPORT_ENTRIES
static vlib_main_t * vlib_get_main(void)
flowprobe_main_t flowprobe_main
flowprobe_variant_t which
struct _vlib_node_registration vlib_node_registration_t
template key/value backing page structure
static u32 ipfix_set_id_length(u16 set_id, u16 length)
vlib_buffer_t ** buffers_per_worker
ipfix buffers under construction, per-worker thread
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
VLIB buffer representation.
u16 template_size[FLOW_N_RECORDS]
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static_always_inline uword os_get_thread_index(void)
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)
#define FLOWPROBE_NEXT_NODES
struct clib_bihash_value offset
template key/value backing page structure
static uword flowprobe_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
ip46_address_t dst_address
#define vec_foreach(var, vec)
Vector iterator.
struct flowprobe_entry_t::@53::@54 tcp
u16 flags
Copy of main node flags.
static u32 flowprobe_l3_ip4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u16 * next_record_offset_per_worker
next record offset, per worker thread
timestamp_nsec_t flow_end
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
static uword flowprobe_ip4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
uword flowprobe_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, flowprobe_variant_t which)