79 "FLOWPROBE[%s]: rx_sw_if_index %d, tx_sw_if_index %d, " 105 #define foreach_flowprobe_error \ 106 _(COLLISION, "Hash table collisions") \ 107 _(BUFFER, "Buffer allocation error") \ 108 _(EXPORTED_PACKETS, "Exported packets") \ 109 _(INPATH, "Exported packets in path") 113 #define _(sym,str) FLOWPROBE_ERROR_##sym, 120 #define _(sym,string) string, 132 #define FLOWPROBE_NEXT_NODES { \ 133 [FLOWPROBE_NEXT_DROP] = "error-drop", \ 134 [FLOWPROBE_NEXT_IP4_LOOKUP] = "ip4-lookup", \ 151 #define NTP_TIMESTAMP 2208988800L 161 offset +=
sizeof (rx_if);
166 offset +=
sizeof (tx_if);
171 offset +=
sizeof (
u64);
176 offset +=
sizeof (
u32);
179 offset +=
sizeof (
u32);
184 offset +=
sizeof (
u32);
187 offset +=
sizeof (
u32);
189 return offset - start;
209 return offset - start;
233 offset +=
sizeof (
u64);
235 return offset - start;
259 offset +=
sizeof (
u64);
261 return offset - start;
282 return offset - start;
291 #ifdef clib_crc32c_uses_intrinsics 292 h = clib_crc32c ((
u8 *) k,
sizeof (*k));
296 for (i = 0; i <
sizeof (*k) / 8; i++)
297 tmp ^= ((
u64 *) k)[
i];
317 if (*poolindex != ~0)
352 (fm->timers_per_worker[my_cpu_number], *poolindex, 0,
371 bool collect_ip4 =
false, collect_ip6 =
false;
374 u16 ethertype = clib_net_to_host_u16 (eth->
type);
401 if (collect_ip6 && ethertype == ETHERNET_TYPE_IP6)
414 else if (k.
protocol == IP_PROTOCOL_TCP)
420 if (collect_ip4 && ethertype == ETHERNET_TYPE_IP4)
429 if ((flags & FLOW_RECORD_L4) && k.
protocol == IP_PROTOCOL_UDP)
431 else if ((flags & FLOW_RECORD_L4) && k.
protocol == IP_PROTOCOL_TCP)
434 octets = clib_net_to_host_u16 (ip4->
length);
446 tcp_flags = tcp->flags;
469 bool collision =
false;
480 FLOWPROBE_ERROR_COLLISION, 1);
502 e->
prot.
tcp.flags |= tcp_flags;
540 for (i = 0; i < index; i++)
565 udp->
src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
566 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
582 (sizeof (*ip) +
sizeof (*udp) +
585 (sizeof (*ip) +
sizeof (*udp)));
619 FLOWPROBE_ERROR_EXPORTED_PACKETS, 1);
646 FLOWPROBE_ERROR_BUFFER, 1);
661 (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT);
678 bool collect_ip4 =
false, collect_ip6 =
false;
727 u32 n_left_from, *from, *to_next;
738 while (n_left_from > 0)
744 while (n_left_from >= 4 && n_left_to_next >= 2)
767 to_next[0] = bi0 = from[0];
768 to_next[1] = bi1 = from[1];
784 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
794 u16 ethertype1 = clib_net_to_host_u16 (eh1->
type);
804 to_next, n_left_to_next,
805 bi0, bi1, next0, next1);
808 while (n_left_from > 0 && n_left_to_next > 0)
830 u16 ethertype0 = clib_net_to_host_u16 (eh0->
type);
836 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
847 to_next, n_left_to_next,
947 u32 *to_be_removed = 0, *
i;
956 tw_timer_expire_timers_2t_1w_2048sl (fm->timers_per_worker[cpu_index],
963 if (now > start_time + 100e-6
983 (fm->timers_per_worker[cpu_index], *
i, 0, delta);
1009 .name =
"flowprobe-ip4",
1010 .vector_size =
sizeof (
u32),
1020 .name =
"flowprobe-ip6",
1021 .vector_size =
sizeof (
u32),
1031 .name =
"flowprobe-l2",
1032 .vector_size =
sizeof (
u32),
1042 .name =
"flowprobe-walker",
1044 .state = VLIB_NODE_STATE_INTERRUPT,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
flowprobe_protocol_context_t context[FLOW_N_VARIANTS]
u16 buffer_size
size of the buffer
u32 ** expired_passive_per_worker
ip46_address_t src_address
L3 information.
static u32 flowprobe_l4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
ip46_address_t src_address
u8 src_mac[6]
L2 information.
vlib_node_registration_t flowprobe_ip6_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip6_node)
static char * flowprobe_error_strings[]
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)
static f64 vlib_time_now(vlib_main_t *vm)
static u32 flowprobe_l3_ip6_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_xxhash(u64 key)
static u32 flowprobe_l3_ip4_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
ip4_address_t src_address
flowprobe_entry_t * stateless_entry
u16 template_reports[FLOW_N_RECORDS]
static uword flowprobe_ip6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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
static void flush_record(flowprobe_variant_t which)
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
static u32 flowprobe_hash(flowprobe_key_t *k)
flow_report_stream_t * streams
flowprobe_variant_t which
flow-per-packet plugin header file
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
u8 * format_ethernet_address(u8 *s, va_list *args)
u64 timestamp
packet timestamp
vlib_frame_t ** frames_per_worker
frames containing ipfix buffers, per-worker thread
void flowprobe_flush_callback_ip6(void)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
vlib_node_registration_t flowprobe_walker_node
(constructor) VLIB_REGISTER_NODE (flowprobe_walker_node)
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.
static uword flowprobe_ip4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 ht_log2len
Per CPU flow-state.
uword flowprobe_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, flowprobe_variant_t which)
flow_report_main_t flow_report_main
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u16 current_length
Nbytes between current data and the end of this buffer.
#define FLOWPROBE_NEXT_NODES
static void flowprobe_export_send(vlib_main_t *vm, vlib_buffer_t *b0, flowprobe_variant_t which)
static u32 flowprobe_common_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
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.
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
u16 src_port
L4 information.
static char * flowprobe_variant_strings[]
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.
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 vlib_buffer_t * flowprobe_get_buffer(vlib_main_t *vm, flowprobe_variant_t which)
#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)
static u32 flowprobe_l2_add(vlib_buffer_t *to_b, flowprobe_entry_t *e, u16 offset)
#define foreach_flowprobe_error
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
#define vec_free(V)
Free vector's memory (no header).
union flowprobe_entry_t::@396 prot
#define clib_warning(format, args...)
flowprobe_entry_t * flowprobe_lookup(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex, bool *collision)
static u8 * format_flowprobe_trace(u8 *s, va_list *args)
#define clib_memcpy(a, b, c)
void flowprobe_flush_callback_l2(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
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
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.
void flowprobe_flush_callback_ip4(void)
#define FLOW_MAXIMUM_EXPORT_ENTRIES
static vlib_main_t * vlib_get_main(void)
flowprobe_main_t flowprobe_main
vlib_node_registration_t flowprobe_ip4_node
(constructor) VLIB_REGISTER_NODE (flowprobe_ip4_node)
static uword flowprobe_walker_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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
static void flowprobe_export_entry(vlib_main_t *vm, flowprobe_entry_t *e)
vlib_node_registration_t flowprobe_l2_node
(constructor) VLIB_REGISTER_NODE (flowprobe_l2_node)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
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)
struct clib_bihash_value offset
template key/value backing page structure
static void vlib_buffer_init_for_free_list(vlib_buffer_t *dst, vlib_buffer_free_list_t *fl)
ip46_address_t dst_address
struct flowprobe_entry_t::@396::@397 tcp
#define vec_foreach(var, vec)
Vector iterator.
static flowprobe_variant_t flowprobe_get_variant(flowprobe_variant_t which, flowprobe_record_t flags, u16 ethertype)
u16 flags
Copy of main node flags.
u16 * next_record_offset_per_worker
next record offset, per worker thread
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, vlib_buffer_free_list_index_t free_list_index)
flowprobe_entry_t * flowprobe_create(u32 my_cpu_number, flowprobe_key_t *k, u32 *poolindex)
timestamp_nsec_t flow_end
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
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)
static void flowprobe_delete_by_index(u32 my_cpu_number, u32 poolindex)
static u16 flowprobe_get_headersize(void)
static uword flowprobe_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)