52 "FLOWPERPKT-L2: rx_sw_if_index %d, tx_sw_if_index %d, src %U dst %U ethertype %0x2, timestamp %lld, size %d",
63 #define foreach_flowperpkt_l2_error 67 #define _(sym,str) FLOWPERPKT_ERROR_##sym, 74 #define _(sym,string) string, 101 u32 rx_sw_if_index,
u32 tx_sw_if_index,
102 u8 * src_mac,
u8 * dst_mac,
103 u16 ethertype,
u64 timestamp,
u16 length,
int do_flush)
188 udp->
src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
189 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
203 offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
213 u32 ingress_interface = clib_host_to_net_u32 (rx_sw_if_index);
215 sizeof (ingress_interface));
216 offset +=
sizeof (ingress_interface);
220 u32 egress_interface = clib_host_to_net_u32 (tx_sw_if_index);
222 sizeof (egress_interface));
223 offset +=
sizeof (egress_interface);
237 b0->
data[offset++] = ethertype >> 8;
238 b0->
data[offset++] = ethertype & 0xFF;
242 offset +=
sizeof (
f64);
246 u16 pkt_size = clib_host_to_net_u16 (length);
248 offset +=
sizeof (pkt_size);
253 2 *
sizeof (
u32) + 12 +
sizeof (
u16) +
sizeof (
f64) +
sizeof (
u16);
258 (do_flush || (offset + 2 *
sizeof (
u32) + 12 +
sizeof (
u16) +
269 (sizeof (*ip) +
sizeof (*udp) +
272 (sizeof (*ip) +
sizeof (*udp)));
295 memset (t, 0,
sizeof (*t));
334 u32 n_left_from, *from, *to_next;
346 while (n_left_from > 0)
352 while (n_left_from >= 4 && n_left_to_next >= 2)
376 to_next[0] = bi0 = from[0];
377 to_next[1] = bi1 = from[1];
400 eh0->
type, now, len0, 0 );
411 eh1->
type, now, len1, 0 );
443 to_next, n_left_to_next,
444 bi0, bi1, next0, next1);
447 while (n_left_from > 0 && n_left_to_next > 0)
477 eh0->
type, now, len0, 0 );
495 to_next, n_left_to_next,
537 .name =
"flowperpkt-l2",
538 .vector_size =
sizeof (
u32),
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
vlib_frame_t ** l2_frames_per_worker
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
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.
struct _vlib_node_registration vlib_node_registration_t
ip4_address_t src_address
u16 buffer_size
size of the buffer
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
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.
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static void add_to_flow_record_l2(vlib_main_t *vm, vlib_node_runtime_t *node, flowperpkt_main_t *fm, u32 rx_sw_if_index, u32 tx_sw_if_index, u8 *src_mac, u8 *dst_mac, u16 ethertype, u64 timestamp, u16 length, int do_flush)
add an entry to the flow record under construction
static char * flowperpkt_l2_error_strings[]
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.
u64 timestamp
packet timestamp
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
#define VLIB_BUFFER_FLOW_REPORT
u32 rx_sw_if_index
interface handle
#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).
void flowperpkt_flush_callback_l2(void)
static u32 version_length(u16 length)
static u8 * format_flowperpkt_l2_trace(u8 *s, va_list *args)
vlib_buffer_t ** l2_buffers_per_worker
#define CLIB_PREFETCH(addr, size, type)
#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)
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
u16 * l2_next_record_offset_per_worker
u8 src_mac[6]
src and dst L2 addresses
#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)
static uword flowperpkt_l2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define foreach_flowperpkt_l2_error
vlib_node_registration_t flowperpkt_l2_node
IPFIX l2 flow-per-packet graph node.
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
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)