27 #include <vpp/app/version.h> 49 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 57 #define vl_api_version(n,v) static u32 api_version=(v); 61 #define REPLY_MSG_ID_BASE fm->msg_id_base 68 .arc_name =
"ip4-output",
69 .node_name =
"flowperpkt-ipv4",
75 .arc_name =
"interface-output",
76 .node_name =
"flowperpkt-l2",
84 vl_print (handle, (char *)s); \ 102 u16 collector_port,
int variant)
188 udp->
dst_port = clib_host_to_net_u16 (collector_port);
189 udp->
length = clib_host_to_net_u16 (
vec_len (rewrite) -
sizeof (*ip));
278 ip->
length = clib_host_to_net_u16 ((
u8 *) f - (
u8 *) ip);
292 (frm, fr, collector_address, src_address, collector_port,
304 (frm, fr, collector_address, src_address, collector_port,
355 memset (a, 0,
sizeof (*a));
366 clib_warning (
"vnet_flow_report_add_del returned %d", rv);
372 memset (a, 0,
sizeof (*a));
383 clib_warning (
"vnet_flow_report_add_del returned %d", rv);
390 sw_if_index, is_add, 0, 0);
393 sw_if_index, is_add, 0, 0);
414 rv = VNET_API_ERROR_UNIMPLEMENTED;
423 REPLY_MACRO (VL_API_FLOWPERPKT_TX_INTERFACE_ADD_DEL_REPLY);
437 s =
format (0,
"SCRIPT: flowperpkt_tx_interface_add_del ");
438 s =
format (s,
"sw_if_index %d is_add %d which %d ",
445 #define foreach_flowperpkt_plugin_api_msg \ 446 _(FLOWPERPKT_TX_INTERFACE_ADD_DEL, flowperpkt_tx_interface_add_del) 450 .version = VPP_BUILD_VER,
451 .description =
"Flow per Packet",
461 u32 sw_if_index = ~0;
479 if (sw_if_index == ~0)
489 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
491 (0,
"Invalid interface, only works on physical ports");
494 case VNET_API_ERROR_UNIMPLEMENTED:
521 .path =
"flowperpkt feature add-del",
523 "flowperpkt feature add-del <interface-name> [disable]",
538 vl_msg_api_set_handlers((VL_API_##N + fm->msg_id_base), \ 540 vl_api_##n##_t_handler, \ 542 vl_api_##n##_t_endian, \ 543 vl_api_##n##_t_print, \ 544 sizeof(vl_api_##n##_t), 1); 551 #define vl_msg_name_crc_list 553 #undef vl_msg_name_crc_list 558 #define _(id,n,crc) \ 559 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + fm->msg_id_base); 560 foreach_vl_msg_name_crc_flowperpkt;
581 name =
format (0,
"flowperpkt_%08x%c", api_version, 0);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * flowperpkt_tx_interface_add_del_feature_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_frame_t ** l2_frames_per_worker
vnet_main_t * vnet_get_main(void)
u16 * ipv4_next_record_offset_per_worker
next record offset, per worker thread
u64 nanosecond_time_0
Time reference pair.
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
static f64 vlib_time_now(vlib_main_t *vm)
unformat_function_t unformat_vnet_sw_interface
u16 msg_id_base
API message ID base.
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
vlib_buffer_t ** ipv4_buffers_per_worker
ipfix buffers under construction, per-worker thread
vlib_frame_t * flowperpkt_data_callback_ipv4(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
Flush accumulated data.
void vl_api_flowperpkt_tx_interface_add_del_t_handler(vl_api_flowperpkt_tx_interface_add_del_t *mp)
API message handler.
static clib_error_t * flowperpkt_plugin_api_hookup(vlib_main_t *vm)
Set up the API message handling tables.
flow_report_stream_t * streams
flow-per-packet plugin header file
static int flowperpkt_tx_interface_add_del_feature(flowperpkt_main_t *fm, u32 sw_if_index, int which, int is_add)
configure / deconfigure the IPFIX flow-per-packet
#define VLIB_INIT_FUNCTION(x)
int ipv4_report_created
Have the reports [templates] been created?
Enable / disable per-packet IPFIX recording on an interface.
vlib_frame_t ** ipv4_frames_per_worker
frames containing ipfix buffers, per-worker thread
vnet_flow_rewrite_callback_t * rewrite_callback
#define clib_error_return(e, args...)
flow_report_main_t flow_report_main
vlib_frame_t * flowperpkt_data_callback_l2(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
vnet_main_t * vnet_main
convenience vnet_main_t pointer
static u8 * flowperpkt_template_rewrite_inline(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port, int variant)
Create an IPFIX template packet rewrite string.
static u32 version_length(u16 length)
vlib_thread_main_t vlib_thread_main
u16 ipv4_report_id
stream/template IDs
vlib_buffer_t ** l2_buffers_per_worker
#define BAD_SW_IF_INDEX_LABEL
#define foreach_flowperpkt_plugin_api_msg
VNET_FEATURE_INIT(flow_perpacket_ipv4, static)
#define vec_free(V)
Free vector's memory (no header).
static u32 ipfix_id_count(u16 id, u16 count)
#define clib_warning(format, args...)
void flowperpkt_flush_callback_ipv4(void)
static u64 unix_time_now_nsec(void)
#define VLIB_CLI_COMMAND(x,...)
u8 * flowperpkt_template_rewrite_ipv4(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port)
flowperpkt_main_t flowperpkt_main
u16 * l2_next_record_offset_per_worker
u8 * flowperpkt_template_rewrite_l2(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port)
#define VNET_FEATURES(...)
void flowperpkt_flush_callback_l2(void)
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * flowperpkt_init(vlib_main_t *vm)
Set up the API message handling tables.
static void * vl_api_flowperpkt_tx_interface_add_del_t_print(vl_api_flowperpkt_tx_interface_add_del_t *mp, void *handle)
API message custom-dump function.
vnet_flow_data_callback_t * flow_data_callback
static void setup_message_id_table(flowperpkt_main_t *fm, api_main_t *am)
u16 vl_msg_api_get_msg_ids(char *name, int n)
#define CLIB_CACHE_LINE_BYTES
Reply to enable/disable per-packet IPFIX recording messages.
static u16 ip4_header_checksum(ip4_header_t *i)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define VALIDATE_SW_IF_INDEX(mp)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a)