26 u32 n_elts,
u32 * stream_index)
44 #define _(field,mask,item,length) \ 47 fr->fields_to_send = clib_bitmap_set (fr->fields_to_send, \ 78 udp->
src_port = clib_host_to_net_u16 (collector_port);
79 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
80 udp->
length = clib_host_to_net_u16 (
vec_len (rewrite) -
sizeof (*ip));
88 sizeof (ip6_address_t));
92 destinationIPv6Address,
93 sizeof (ip6_address_t));
97 sourceTransportPort, 2);
101 destinationTransportPort, 2);
104 #define _(field,mask,item,length) \ 106 f->e_id_length = ipfix_e_id_length (0 , \ 114 ioamNumberOfPaths, 2);
140 ip->
length = clib_host_to_net_u16 ((
u8 *) f - (
u8 *) ip);
150 ip6_address_t *
src, ip6_address_t *
dst,
159 u16 num_paths_offset;
163 memcpy (b0->
data + offset, &src->as_u64[0], sizeof (
u64));
164 offset +=
sizeof (
u64);
165 memcpy (b0->
data + offset, &src->as_u64[1], sizeof (
u64));
166 offset +=
sizeof (
u64);
169 memcpy (b0->
data + offset, &dst->as_u64[0], sizeof (
u64));
170 offset +=
sizeof (
u64);
171 memcpy (b0->
data + offset, &dst->as_u64[1], sizeof (
u64));
172 offset +=
sizeof (
u64);
175 tmp = clib_host_to_net_u16 (src_port);
176 memcpy (b0->
data + offset, &tmp, sizeof (
u16));
177 offset +=
sizeof (
u16);
180 tmp = clib_host_to_net_u16 (dst_port);
181 memcpy (b0->
data + offset, &tmp, sizeof (
u16));
182 offset +=
sizeof (
u16);
184 #define _(field,mask,item,length) \ 185 if (clib_bitmap_get (fr->fields_to_send, field_index)) \ 189 tmp = clib_host_to_net_u32((u32)record->field - (u32)record->chached_data_list->field);\ 190 memcpy (b0->data + offset, &tmp, length); \ 198 num_paths_offset =
offset;
199 offset +=
sizeof (
u16);
254 num_paths = clib_host_to_net_u16 (num_paths);
255 memcpy (b0->
data + num_paths_offset, &num_paths, sizeof (
u16));
278 u32 records_this_buffer;
293 data_len =
vec_len (aggregated_data);
298 record = aggregated_data +
i;
301 if (i == (data_len - 1))
316 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
331 next_offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
332 records_this_buffer = 0;
338 records_this_buffer++;
341 if (next_offset > (frm->
path_mtu - 250))
348 next_offset - (
sizeof (*ip) +
352 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
359 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
416 case VNET_API_ERROR_NO_SUCH_ENTRY:
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
#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)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
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, ipfix_report_element_t *elts, u32 n_elts, u32 *stream_index)
ioam_path_map_t path[IOAM_TRACE_MAX_NODES]
Actual PATH flow has taken.
seqno_rx_info seqno_data
Analysed iOAM seqno data.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
vl_api_ip_port_and_mask_t dst_port
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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)
u16 current_length
Nbytes between current data and the end of this buffer.
#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
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)
flow_report_main_t flow_report_main
#define IOAM_MAX_PATHS_PER_FLOW
ioam_analyse_trace_data trace_data
Analysed iOAM trace data.
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
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
vl_api_address_union_t src_address
static u32 version_length(u16 length)
vl_api_ip_port_and_mask_t src_port
sll srl srl sll sra u16x4 i
#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)
clib_spinlock_t writer_lock
Lock to since we use this to export the data in other thread.
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
VLIB buffer representation.
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
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 u16 ip_csum_fold(ip_csum_t c)