42 #define _(field,mask,item,length) \ 45 fr->fields_to_send = clib_bitmap_set (fr->fields_to_send, \ 76 udp->
src_port = clib_host_to_net_u16 (collector_port);
77 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
78 udp->
length = clib_host_to_net_u16 (
vec_len (rewrite) -
sizeof (*ip));
90 destinationIPv6Address,
95 sourceTransportPort, 2);
99 destinationTransportPort, 2);
102 #define _(field,mask,item,length) \ 104 f->e_id_length = ipfix_e_id_length (0 , \ 112 ioamNumberOfPaths, 2);
138 ip->
length = clib_host_to_net_u16 ((
u8 *) f - (
u8 *) ip);
149 u16 src_port,
u16 dst_port)
151 while (__sync_lock_test_and_set (record->
writer_lock, 1))
158 u16 num_paths_offset;
163 offset +=
sizeof (
u64);
165 offset +=
sizeof (
u64);
169 offset +=
sizeof (
u64);
171 offset +=
sizeof (
u64);
174 tmp = clib_host_to_net_u16 (src_port);
175 memcpy (b0->
data + offset, &tmp, sizeof (
u16));
176 offset +=
sizeof (
u16);
179 tmp = clib_host_to_net_u16 (dst_port);
180 memcpy (b0->
data + offset, &tmp, sizeof (
u16));
181 offset +=
sizeof (
u16);
183 #define _(field,mask,item,length) \ 184 if (clib_bitmap_get (fr->fields_to_send, field_index)) \ 188 tmp = clib_host_to_net_u32((u32)record->field - (u32)record->chached_data_list->field);\ 189 memcpy (b0->data + offset, &tmp, length); \ 197 num_paths_offset =
offset;
198 offset +=
sizeof (
u16);
253 num_paths = clib_host_to_net_u16 (num_paths);
254 memcpy (b0->
data + num_paths_offset, &num_paths, sizeof (
u16));
277 u32 records_this_buffer;
292 data_len =
vec_len (aggregated_data);
297 record = aggregated_data +
i;
300 if (i == (data_len - 1))
315 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
330 next_offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
331 records_this_buffer = 0;
337 records_this_buffer++;
340 if (next_offset > (frm->
path_mtu - 250))
347 next_offset - (
sizeof (*ip) +
351 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
358 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
403 memset (&args, 0,
sizeof (args));
415 case VNET_API_ERROR_NO_SUCH_ENTRY:
#define vec_foreach_index(var, v)
Iterate over vector indices.
u32 bytes_counter
Num of bytes in the flow going over path.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
ioam_path_map_t path[IOAM_TRACE_MAX_NODES]
Actual PATH flow has taken.
seqno_rx_info seqno_data
Analysed iOAM seqno data.
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a, u16 *template_id)
clib_error_t * ioam_flow_report_init(vlib_main_t *vm)
volatile u32 * writer_lock
Lock to since we use this to export the data in other thread.
#define IOAM_TRACE_MAX_NODES
clib_error_t * ioam_flow_create(u8 del)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
ip6_ioam_analyser_main_t ioam_analyser_main
flow_report_stream_t * streams
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
u8 * ioam_template_rewrite(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port)
Analysed iOAM trace data.
#define VLIB_INIT_FUNCTION(x)
u32 pkt_counter
Num of pkts in the flow going over path.
vnet_flow_rewrite_callback_t * rewrite_callback
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
u16 ioam_analyse_add_ipfix_record(flow_report_t *fr, ioam_analyser_data_t *record, vlib_buffer_t *b0, u16 offset, ip6_address_t *src, ip6_address_t *dst, u16 src_port, u16 dst_port)
#define vlib_call_init_function(vm, x)
flow_report_main_t flow_report_main
#define IOAM_MAX_PATHS_PER_FLOW
u16 current_length
Nbytes between current data and the end of this buffer.
ioam_analyse_trace_data trace_data
Analysed iOAM trace data.
vlib_frame_t * ioam_send_flows(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
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 foreach_ioam_ipfix_field
static u32 version_length(u16 length)
#define IOAM_FLOW_TEMPLATE_ID
static u32 ipfix_id_count(u16 id, u16 count)
struct ioam_analyser_data_t_ * chached_data_list
Cache of previously analysed data, useful for export.
ioam_analyser_data_t * aggregated_data
This contains the aggregated data from the time VPP started analysing.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
template key/value backing page structure
static u32 ipfix_set_id_length(u16 set_id, u16 length)
u8 trace_type
Data contained in trace - NodeId, TTL, Ingress & Egress Link, Timestamp.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ipfix_template_packet_t ipfix
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define ip_csum_update(sum, old, new, type, field)
vnet_flow_data_callback_t * flow_data_callback
struct clib_bihash_value offset
template key/value backing page structure
u8 is_free
Flag to indicate whether node is allocated.
u8 num_nodes
No of nodes in path.
u32 mean_delay
Average Dealay for the flow.
#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)
ioam_analyse_trace_record path_data[IOAM_MAX_PATHS_PER_FLOW]
static clib_error_t * flow_report_init(vlib_main_t *vm)
static u16 ip_csum_fold(ip_csum_t c)