|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
38 u32 n_elts,
u32 * stream_index)
60 u8 transport_protocol;
74 real_mask = (
u8 *) (tblp->
mask);
78 #define _(field,mask,item,length) \
79 if (((u8 *)&field >= real_mask) && (memcmp(&field, &mask, length) == 0)) \
83 fr->fields_to_send = clib_bitmap_set (fr->fields_to_send, \
109 ip->ip_version_and_header_length = 0x45;
111 ip->protocol = IP_PROTOCOL_UDP;
113 ip->dst_address.as_u32 = collector_address->
as_u32;
115 udp->
dst_port = clib_host_to_net_u16 (collector_port);
120 h->domain_id = clib_host_to_net_u32 (stream->
domain_id);
124 #define _(field,mask,item,length) \
125 if (((u8 *)&field >= real_mask) && (memcmp(&field, &mask, length) == 0)) \
127 f->e_id_length = ipfix_e_id_length (0 , \
154 ip->length = clib_host_to_net_u16 ((
u8 *)
f - (
u8 *)
ip);
173 u32 record_offset = 0;
185 u32 records_this_buffer;
191 u8 transport_protocol;
212 for (j = 0; j < (1 <<
b->log2_pages); j++)
234 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
245 h->export_time = (
u32)
248 h->export_time = clib_host_to_net_u32 (
h->export_time);
253 clib_host_to_net_u32 (
h->sequence_number);
255 next_offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
256 record_offset = next_offset;
257 records_this_buffer = 0;
263 #define _(field,mask,item,length) \
264 if (clib_bitmap_get (fr->fields_to_send, field_index)) \
266 clib_memcpy_fast (b0->data + next_offset, &field, \
268 next_offset += length; \
279 next_offset +=
sizeof (
packets);
281 records_this_buffer++;
285 u32 next_record_size = next_offset - record_offset;
286 record_offset = next_offset;
288 if (next_offset + next_record_size > frm->
path_mtu)
297 (
sizeof (*
ip) +
sizeof (*udp)));
299 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
307 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
351 (sizeof (*
ip) +
sizeof (*udp) +
354 (
sizeof (*
ip) +
sizeof (*udp)));
356 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
364 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
407 u8 transport_protocol = 255;
428 transport_protocol = 6;
430 transport_protocol = 17;
457 "Specified classifier table already used");
465 "Specified classifier table not registered");
483 if (is_add == 0 || (
rv && is_add))
491 .path =
"ipfix classify table",
492 .short_help =
"ipfix classify table add|del <table-index>",
509 if (
unformat (input,
"domain %d", &domain_id))
534 .path =
"set ipfix classify stream",
535 .short_help =
"set ipfix classify stream"
536 "[domain <domain-id>] [src-port <src-port>]",
static clib_error_t * ipfix_classify_table_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
flow_report_main_t flow_report_main
struct _vnet_classify_entry vnet_classify_entry_t
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
vl_api_ip_port_and_mask_t dst_port
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
static vlib_cli_command_t ipfix_classify_table_add_del_command
(constructor) VLIB_CLI_COMMAND (ipfix_classify_table_add_del_command)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
vnet_classify_main_t vnet_classify_main
#define clib_error_return(e, args...)
int vnet_stream_change(flow_report_main_t *frm, u32 old_domain_id, u16 old_src_port, u32 new_domain_id, u16 new_src_port)
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
#define vlib_call_init_function(vm, x)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
ipfix_classify_table_t * tables
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static clib_error_t * set_ipfix_classify_stream_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * flow_report_classify_init(vlib_main_t *vm)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static_always_inline u8 ipfix_classify_table_index_valid(u32 index)
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 * ipfix_classify_send_flows(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static vlib_cli_command_t set_ipfix_classify_stream_command
(constructor) VLIB_CLI_COMMAND (set_ipfix_classify_stream_command)
vnet_classify_bucket_t * buckets
vnet_flow_data_callback_t * flow_data_callback
vl_api_ip_port_and_mask_t src_port
#define VLIB_CLI_COMMAND(x,...)
static u32 version_length(u16 length)
flow_report_stream_t * streams
#define CLIB_CACHE_LINE_BYTES
flow_report_classify_main_t flow_report_classify_main
u16 current_length
Nbytes between current data and the end of this buffer.
static clib_error_t * flow_report_init(vlib_main_t *vm)
static u32 ipfix_id_count(u16 id, u16 count)
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
#define VLIB_INIT_FUNCTION(x)
struct _vnet_classify_main vnet_classify_main_t
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
u8 * ipfix_classify_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)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define ip_csum_update(sum, old, new, type, field)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u16 ip4_header_checksum(ip4_header_t *i)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
clib_spinlock_t writer_lock
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define foreach_ipfix_field
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a, u16 *template_id)
static f64 vlib_time_now(vlib_main_t *vm)
static_always_inline ipfix_classify_table_t * ipfix_classify_add_table(void)
vl_api_address_union_t src_address
static u16 ip_csum_fold(ip_csum_t c)
static_always_inline void ipfix_classify_delete_table(u32 index)
vnet_flow_rewrite_callback_t * rewrite_callback
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.