51 "FLOWPERPKT: rx_sw_if_index %d, tx_sw_if_index %d, src %U dst %U tos %0x2, timestamp %lld, size %d",
61 #define foreach_flowperpkt_error \ 62 _(SWAPPED, "Mac swap packets processed") 66 #define _(sym,str) FLOWPERPKT_ERROR_##sym, 73 #define _(sym,string) string, 98 u32 rx_sw_if_index,
u32 tx_sw_if_index,
99 u32 src_address,
u32 dst_address,
100 u8 tos,
u64 timestamp,
u16 length,
int do_flush)
184 udp->
src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
185 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
199 offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
209 u32 ingress_interface = clib_host_to_net_u32 (rx_sw_if_index);
211 sizeof (ingress_interface));
212 offset +=
sizeof (ingress_interface);
216 u32 egress_interface = clib_host_to_net_u32 (tx_sw_if_index);
218 sizeof (egress_interface));
219 offset +=
sizeof (egress_interface);
224 offset +=
sizeof (src_address);
229 offset +=
sizeof (dst_address);
233 b0->
data[offset++] = tos;
237 offset +=
sizeof (
f64);
241 u16 pkt_size = clib_host_to_net_u16 (length);
243 offset +=
sizeof (pkt_size);
248 4 *
sizeof (
u32) +
sizeof (
u8) +
sizeof (
f64) +
sizeof (
u16);
253 (do_flush || (offset +
sizeof (
u32) +
sizeof (
u8)
264 (sizeof (*ip) +
sizeof (*udp) +
267 (sizeof (*ip) +
sizeof (*udp)));
315 u32 n_left_from, *from, *to_next;
327 while (n_left_from > 0)
333 while (n_left_from >= 4 && n_left_to_next >= 2)
357 to_next[0] = bi0 = from[0];
358 to_next[1] = bi1 = from[1];
383 ip0->
tos, now, len0, 0 );
395 ip1->
tos, now, len1, 0 );
427 to_next, n_left_to_next,
428 bi0, bi1, next0, next1);
431 while (n_left_from > 0 && n_left_to_next > 0)
469 ip0->
tos, now, len0, 0 );
487 to_next, n_left_to_next,
529 .name =
"flowperpkt",
530 .vector_size =
sizeof (
u32),
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 vlib_main_t * vlib_get_main(void)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
u64 nanosecond_time_0
Time reference pair.
static f64 vlib_time_now(vlib_main_t *vm)
struct _vlib_node_registration vlib_node_registration_t
ip4_address_t src_address
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
u16 buffer_size
size of the buffer
ip4_address_t ipfix_collector
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
static u8 * format_flowperpkt_trace(u8 *s, va_list *args)
flow_report_stream_t * streams
flow-per-packet plugin header file
static void vlib_buffer_init_for_free_list(vlib_buffer_t *_dst, vlib_buffer_free_list_t *fl)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static char * flowperpkt_error_strings[]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_buffer_t ** buffers_per_worker
ipfix buffers under construction, per-worker thread
static uword flowperpkt_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
flow_report_main_t flow_report_main
u16 current_length
Nbytes between current data and the end of this buffer.
u64 timestamp
packet timestamp
vlib_node_registration_t flowperpkt_node
IPFIX flow-per-packet graph node.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#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.
#define foreach_flowperpkt_error
#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)
#define CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
#define VLIB_BUFFER_FLOW_REPORT
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
static void add_to_flow_record(vlib_main_t *vm, flowperpkt_main_t *fm, u32 rx_sw_if_index, u32 tx_sw_if_index, u32 src_address, u32 dst_address, u8 tos, u64 timestamp, u16 length, int do_flush)
add an entry to the flow record under construction
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
flowperpkt_main_t flowperpkt_main
u16 * next_record_offset_per_worker
next record offset, per worker thread
#define VLIB_NODE_FLAG_TRACE
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
#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)
static u32 ipfix_set_id_length(u16 set_id, u16 length)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
struct clib_bihash_value offset
template key/value backing page structure
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
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)
u32 rx_sw_if_index
interface handle
vlib_frame_t ** frames_per_worker
frames containing ipfix buffers, per-worker thread
void flowperpkt_flush_callback(void)