51 "FLOWPERPKT-V4: rx_sw_if_index %d, tx_sw_if_index %d, src %U dst %U tos %0x2, timestamp %lld, size %d",
62 #define foreach_flowperpkt_ipv4_error 66 #define _(sym,str) FLOWPERPKT_ERROR_##sym, 73 #define _(sym,string) string, 100 u32 rx_sw_if_index,
u32 tx_sw_if_index,
101 u32 src_address,
u32 dst_address,
102 u8 tos,
u64 timestamp,
u16 length,
int do_flush)
187 udp->
src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
188 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
202 offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
212 u32 ingress_interface = clib_host_to_net_u32 (rx_sw_if_index);
214 sizeof (ingress_interface));
215 offset +=
sizeof (ingress_interface);
219 u32 egress_interface = clib_host_to_net_u32 (tx_sw_if_index);
221 sizeof (egress_interface));
222 offset +=
sizeof (egress_interface);
227 offset +=
sizeof (src_address);
232 offset +=
sizeof (dst_address);
236 b0->
data[offset++] = tos;
240 offset +=
sizeof (
f64);
244 u16 pkt_size = clib_host_to_net_u16 (length);
246 offset +=
sizeof (pkt_size);
251 4 *
sizeof (
u32) +
sizeof (
u8) +
sizeof (
f64) +
sizeof (
u16);
256 (do_flush || (offset + 4 *
sizeof (
u32) +
sizeof (
u8)
267 (sizeof (*ip) +
sizeof (*udp) +
270 (sizeof (*ip) +
sizeof (*udp)));
335 u32 n_left_from, *from, *to_next;
347 while (n_left_from > 0)
353 while (n_left_from >= 4 && n_left_to_next >= 2)
377 to_next[0] = bi0 = from[0];
378 to_next[1] = bi1 = from[1];
403 ip0->
tos, now, len0, 0 );
415 ip1->
tos, now, len1, 0 );
447 to_next, n_left_to_next,
448 bi0, bi1, next0, next1);
451 while (n_left_from > 0 && n_left_to_next > 0)
489 ip0->
tos, now, len0, 0 );
507 to_next, n_left_to_next,
549 .name =
"flowperpkt-ipv4",
550 .vector_size =
sizeof (
u32),
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
u32 rx_sw_if_index
interface handle
static char * flowperpkt_ipv4_error_strings[]
u16 * ipv4_next_record_offset_per_worker
next record offset, per worker thread
u64 nanosecond_time_0
Time reference pair.
static f64 vlib_time_now(vlib_main_t *vm)
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.
u16 buffer_size
size of the buffer
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.
vlib_buffer_t ** ipv4_buffers_per_worker
ipfix buffers under construction, per-worker thread
#define foreach_flowperpkt_ipv4_error
ip4_address_t ipfix_collector
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
static void vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
flow_report_stream_t * streams
flow-per-packet plugin header file
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
vlib_frame_t ** ipv4_frames_per_worker
frames containing ipfix buffers, per-worker thread
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static uword flowperpkt_ipv4_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.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
void flowperpkt_flush_callback_ipv4(void)
#define VLIB_BUFFER_FLOW_REPORT
#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 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)
u16 ipv4_report_id
stream/template IDs
#define CLIB_PREFETCH(addr, size, type)
vlib_node_registration_t flowperpkt_ipv4_node
IPFIX ipv4 flow-per-packet graph node.
#define VLIB_BUFFER_IS_TRACED
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
u64 timestamp
packet timestamp
static void add_to_flow_record_ipv4(vlib_main_t *vm, vlib_node_runtime_t *node, 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 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
flowperpkt_main_t flowperpkt_main
#define VLIB_NODE_FLAG_TRACE
static vlib_main_t * vlib_get_main(void)
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)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
static u8 * format_flowperpkt_ipv4_trace(u8 *s, va_list *args)
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
static void vlib_buffer_init_for_free_list(vlib_buffer_t *dst, vlib_buffer_free_list_t *fl)
#define VLIB_REGISTER_NODE(x,...)
u16 flags
Copy of main node flags.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: 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)