X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fflowprobe%2Fnode.c;h=03511689ddadc34d78cffed4ee809c7347ecad91;hb=dcb5eb5a18bf42cb4d39ae29822664f2cb57622c;hp=79d37f8a75e735d2c9a975a3e209fe2efe2caf31;hpb=178cf493d009995b28fdf220f04c98860ff79a9b;p=vpp.git diff --git a/src/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c index 79d37f8a75e..03511689dda 100644 --- a/src/plugins/flowprobe/node.c +++ b/src/plugins/flowprobe/node.c @@ -16,17 +16,19 @@ */ #include #include -#include #include +#include #include #include #include +#include #include static void flowprobe_export_entry (vlib_main_t * vm, flowprobe_entry_t * e); /** - * @file flow record generator graph node + * @file node.c + * flow record generator graph node */ typedef struct @@ -97,9 +99,15 @@ format_flowprobe_trace (u8 * s, va_list * args) return s; } -vlib_node_registration_t flowprobe_ip4_node; -vlib_node_registration_t flowprobe_ip6_node; -vlib_node_registration_t flowprobe_l2_node; +vlib_node_registration_t flowprobe_input_ip4_node; +vlib_node_registration_t flowprobe_input_ip6_node; +vlib_node_registration_t flowprobe_input_l2_node; +vlib_node_registration_t flowprobe_output_ip4_node; +vlib_node_registration_t flowprobe_output_ip6_node; +vlib_node_registration_t flowprobe_output_l2_node; +vlib_node_registration_t flowprobe_flush_ip4_node; +vlib_node_registration_t flowprobe_flush_ip6_node; +vlib_node_registration_t flowprobe_flush_l2_node; /* No counters at the moment */ #define foreach_flowprobe_error \ @@ -148,7 +156,7 @@ flowprobe_get_variant (flowprobe_variant_t which, /* * NTP rfc868 : 2 208 988 800 corresponds to 00:00 1 Jan 1970 GMT */ -#define NTP_TIMESTAMP 2208988800L +#define NTP_TIMESTAMP 2208988800LU static inline u32 flowprobe_common_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) @@ -165,6 +173,11 @@ flowprobe_common_add (vlib_buffer_t * to_b, flowprobe_entry_t * e, u16 offset) clib_memcpy_fast (to_b->data + offset, &tx_if, sizeof (tx_if)); offset += sizeof (tx_if); + /* Flow direction + 0x00: ingress flow + 0x01: egress flow */ + to_b->data[offset++] = (e->key.direction == FLOW_DIRECTION_TX); + /* packet delta count */ u64 packetdelta = clib_host_to_net_u64 (e->packetcount); clib_memcpy_fast (to_b->data + offset, &packetdelta, sizeof (u64)); @@ -356,25 +369,30 @@ flowprobe_create (u32 my_cpu_number, flowprobe_key_t * k, u32 * poolindex) } static inline void -add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, - flowprobe_main_t * fm, vlib_buffer_t * b, +add_to_flow_record_state (vlib_main_t *vm, vlib_node_runtime_t *node, + flowprobe_main_t *fm, vlib_buffer_t *b, timestamp_nsec_t timestamp, u16 length, - flowprobe_variant_t which, flowprobe_trace_t * t) + flowprobe_variant_t which, + flowprobe_direction_t direction, + flowprobe_trace_t *t) { if (fm->disabled) return; + ASSERT (direction == FLOW_DIRECTION_RX || direction == FLOW_DIRECTION_TX); + u32 my_cpu_number = vm->thread_index; u16 octets = 0; flowprobe_record_t flags = fm->context[which].flags; bool collect_ip4 = false, collect_ip6 = false; ASSERT (b); - ethernet_header_t *eth = vlib_buffer_get_current (b); + ethernet_header_t *eth = (direction == FLOW_DIRECTION_TX) ? + vlib_buffer_get_current (b) : + ethernet_buffer_get_header (b); u16 ethertype = clib_net_to_host_u16 (eth->type); - /* *INDENT-OFF* */ + i16 l3_hdr_offset = (u8 *) eth - b->data + sizeof (ethernet_header_t); flowprobe_key_t k = {}; - /* *INDENT-ON* */ ip4_header_t *ip4 = 0; ip6_header_t *ip6 = 0; udp_header_t *udp = 0; @@ -391,6 +409,7 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, k.tx_sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_TX]; k.which = which; + k.direction = direction; if (flags & FLOW_RECORD_L2) { @@ -398,9 +417,22 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, clib_memcpy_fast (k.dst_mac, eth->dst_address, 6); k.ethertype = ethertype; } + if (ethertype == ETHERNET_TYPE_VLAN) + { + /*VLAN TAG*/ + ethernet_vlan_header_tv_t *ethv = + (ethernet_vlan_header_tv_t *) (&(eth->type)); + /*Q in Q possibility */ + while (clib_net_to_host_u16 (ethv->type) == ETHERNET_TYPE_VLAN) + { + ethv++; + l3_hdr_offset += sizeof (ethernet_vlan_header_tv_t); + } + k.ethertype = ethertype = clib_net_to_host_u16 ((ethv)->type); + } if (collect_ip6 && ethertype == ETHERNET_TYPE_IP6) { - ip6 = (ip6_header_t *) (eth + 1); + ip6 = (ip6_header_t *) (b->data + l3_hdr_offset); if (flags & FLOW_RECORD_L3) { k.src_address.as_u64[0] = ip6->src_address.as_u64[0]; @@ -419,7 +451,7 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node, } if (collect_ip4 && ethertype == ETHERNET_TYPE_IP4) { - ip4 = (ip4_header_t *) (eth + 1); + ip4 = (ip4_header_t *) (b->data + l3_hdr_offset); if (flags & FLOW_RECORD_L3) { k.src_address.ip4.as_u32 = ip4->src_address.as_u32; @@ -519,6 +551,7 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, { flowprobe_main_t *fm = &flowprobe_main; flow_report_main_t *frm = &flow_report_main; + ipfix_exporter_t *exp = pool_elt_at_index (frm->exporters, 0); vlib_frame_t *f; ip4_ipfix_template_packet_t *tp; ipfix_set_header_t *s; @@ -536,19 +569,19 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, flowprobe_get_headersize ()) return; - u32 i, index = vec_len (frm->streams); + u32 i, index = vec_len (exp->streams); for (i = 0; i < index; i++) - if (frm->streams[i].domain_id == 1) + if (exp->streams[i].domain_id == 1) { index = i; break; } - if (i == vec_len (frm->streams)) + if (i == vec_len (exp->streams)) { - vec_validate (frm->streams, index); - frm->streams[index].domain_id = 1; + vec_validate (exp->streams, index); + exp->streams[index].domain_id = 1; } - stream = &frm->streams[index]; + stream = &exp->streams[index]; tp = vlib_buffer_get_current (b0); ip = (ip4_header_t *) & tp->ip4; @@ -560,16 +593,15 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, ip->ttl = 254; ip->protocol = IP_PROTOCOL_UDP; ip->flags_and_fragment_offset = 0; - ip->src_address.as_u32 = frm->src_address.as_u32; - ip->dst_address.as_u32 = frm->ipfix_collector.as_u32; - udp->src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix); - udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix); + ip->src_address.as_u32 = exp->src_address.ip.ip4.as_u32; + ip->dst_address.as_u32 = exp->ipfix_collector.ip.ip4.as_u32; + udp->src_port = clib_host_to_net_u16 (stream->src_port); + udp->dst_port = clib_host_to_net_u16 (exp->collector_port); udp->checksum = 0; /* FIXUP: message header export_time */ - h->export_time = (u32) - (((f64) frm->unix_time_0) + - (vlib_time_now (frm->vlib_main) - frm->vlib_time_0)); + h->export_time = + (u32) (((f64) frm->unix_time_0) + (vlib_time_now (vm) - frm->vlib_time_0)); h->export_time = clib_host_to_net_u32 (h->export_time); h->domain_id = clib_host_to_net_u32 (stream->domain_id); @@ -589,7 +621,7 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, ip->checksum = ip4_header_checksum (ip); udp->length = clib_host_to_net_u16 (b0->current_length - sizeof (*ip)); - if (frm->udp_checksum) + if (exp->udp_checksum) { /* RFC 7011 section 10.3.2. */ udp->checksum = ip4_tcp_udp_compute_checksum (vm, b0, ip); @@ -597,7 +629,7 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, udp->checksum = 0xffff; } - ASSERT (ip->checksum == ip4_header_checksum (ip)); + ASSERT (ip4_header_checksum_is_valid (ip)); /* Find or allocate a frame */ f = fm->context[which].frames_per_worker[my_cpu_number]; @@ -615,7 +647,7 @@ flowprobe_export_send (vlib_main_t * vm, vlib_buffer_t * b0, } vlib_put_frame_to_node (vm, ip4_lookup_node.index, f); - vlib_node_increment_counter (vm, flowprobe_l2_node.index, + vlib_node_increment_counter (vm, flowprobe_output_l2_node.index, FLOWPROBE_ERROR_EXPORTED_PACKETS, 1); fm->context[which].frames_per_worker[my_cpu_number] = 0; @@ -628,10 +660,9 @@ static vlib_buffer_t * flowprobe_get_buffer (vlib_main_t * vm, flowprobe_variant_t which) { flowprobe_main_t *fm = &flowprobe_main; - flow_report_main_t *frm = &flow_report_main; + ipfix_exporter_t *exp = pool_elt_at_index (flow_report_main.exporters, 0); vlib_buffer_t *b0; u32 bi0; - vlib_buffer_free_list_t *fl; u32 my_cpu_number = vm->thread_index; /* Find or allocate a buffer */ @@ -642,7 +673,7 @@ flowprobe_get_buffer (vlib_main_t * vm, flowprobe_variant_t which) { if (vlib_buffer_alloc (vm, &bi0, 1) != 1) { - vlib_node_increment_counter (vm, flowprobe_l2_node.index, + vlib_node_increment_counter (vm, flowprobe_output_l2_node.index, FLOWPROBE_ERROR_BUFFER, 1); return 0; } @@ -650,17 +681,13 @@ flowprobe_get_buffer (vlib_main_t * vm, flowprobe_variant_t which) /* Initialize the buffer */ b0 = fm->context[which].buffers_per_worker[my_cpu_number] = vlib_get_buffer (vm, bi0); - fl = - vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX); - vlib_buffer_init_for_free_list (b0, fl); - VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); b0->current_data = 0; b0->current_length = flowprobe_get_headersize (); b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT); vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0; - vnet_buffer (b0)->sw_if_index[VLIB_TX] = frm->fib_index; + vnet_buffer (b0)->sw_if_index[VLIB_TX] = exp->fib_index; fm->context[which].next_record_offset_per_worker[my_cpu_number] = b0->current_length; } @@ -673,9 +700,10 @@ flowprobe_export_entry (vlib_main_t * vm, flowprobe_entry_t * e) { u32 my_cpu_number = vm->thread_index; flowprobe_main_t *fm = &flowprobe_main; - flow_report_main_t *frm = &flow_report_main; + ipfix_exporter_t *exp = pool_elt_at_index (flow_report_main.exporters, 0); vlib_buffer_t *b0; bool collect_ip4 = false, collect_ip6 = false; + bool collect_l4 = false; flowprobe_variant_t which = e->key.which; flowprobe_record_t flags = fm->context[which].flags; u16 offset = @@ -694,6 +722,10 @@ flowprobe_export_entry (vlib_main_t * vm, flowprobe_entry_t * e) collect_ip4 = which == FLOW_VARIANT_L2_IP4 || which == FLOW_VARIANT_IP4; collect_ip6 = which == FLOW_VARIANT_L2_IP6 || which == FLOW_VARIANT_IP6; } + if (flags & FLOW_RECORD_L4) + { + collect_l4 = (which != FLOW_VARIANT_L2); + } offset += flowprobe_common_add (b0, e, offset); @@ -703,26 +735,27 @@ flowprobe_export_entry (vlib_main_t * vm, flowprobe_entry_t * e) offset += flowprobe_l3_ip6_add (b0, e, offset); if (collect_ip4) offset += flowprobe_l3_ip4_add (b0, e, offset); - if (flags & FLOW_RECORD_L4) + if (collect_l4) offset += flowprobe_l4_add (b0, e, offset); /* Reset per flow-export counters */ e->packetcount = 0; e->octetcount = 0; e->last_exported = vlib_time_now (vm); + e->prot.tcp.flags = 0; b0->current_length = offset; fm->context[which].next_record_offset_per_worker[my_cpu_number] = offset; /* Time to flush the buffer? */ - if (offset + fm->template_size[flags] > frm->path_mtu) + if (offset + fm->template_size[flags] > exp->path_mtu) flowprobe_export_send (vm, b0, which); } uword -flowprobe_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame, - flowprobe_variant_t which) +flowprobe_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame, flowprobe_variant_t which, + flowprobe_direction_t direction) { u32 n_left_from, *from, *to_next; flowprobe_next_t next_index; @@ -759,8 +792,8 @@ flowprobe_node_fn (vlib_main_t * vm, vlib_prefetch_buffer_header (p2, LOAD); vlib_prefetch_buffer_header (p3, LOAD); - CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE); - CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE); + clib_prefetch_store (p2->data); + clib_prefetch_store (p3->data); } /* speculatively enqueue b0 and b1 to the current next frame */ @@ -782,20 +815,22 @@ flowprobe_node_fn (vlib_main_t * vm, u16 ethertype0 = clib_net_to_host_u16 (eh0->type); if (PREDICT_TRUE ((b0->flags & VNET_BUFFER_F_FLOW_REPORT) == 0)) - add_to_flow_record_state (vm, node, fm, b0, timestamp, len0, - flowprobe_get_variant - (which, fm->context[which].flags, - ethertype0), 0); + add_to_flow_record_state ( + vm, node, fm, b0, timestamp, len0, + flowprobe_get_variant (which, fm->context[which].flags, + ethertype0), + direction, 0); len1 = vlib_buffer_length_in_chain (vm, b1); ethernet_header_t *eh1 = vlib_buffer_get_current (b1); u16 ethertype1 = clib_net_to_host_u16 (eh1->type); if (PREDICT_TRUE ((b1->flags & VNET_BUFFER_F_FLOW_REPORT) == 0)) - add_to_flow_record_state (vm, node, fm, b1, timestamp, len1, - flowprobe_get_variant - (which, fm->context[which].flags, - ethertype1), 0); + add_to_flow_record_state ( + vm, node, fm, b1, timestamp, len1, + flowprobe_get_variant (which, fm->context[which].flags, + ethertype1), + direction, 0); /* verify speculative enqueues, maybe switch current next frame */ vlib_validate_buffer_enqueue_x2 (vm, node, next_index, @@ -833,10 +868,11 @@ flowprobe_node_fn (vlib_main_t * vm, && (b0->flags & VLIB_BUFFER_IS_TRACED))) t = vlib_add_trace (vm, node, b0, sizeof (*t)); - add_to_flow_record_state (vm, node, fm, b0, timestamp, len0, - flowprobe_get_variant - (which, fm->context[which].flags, - ethertype0), t); + add_to_flow_record_state ( + vm, node, fm, b0, timestamp, len0, + flowprobe_get_variant (which, fm->context[which].flags, + ethertype0), + direction, t); } /* verify speculative enqueue, maybe switch current next frame */ @@ -851,24 +887,51 @@ flowprobe_node_fn (vlib_main_t * vm, } static uword -flowprobe_ip4_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +flowprobe_input_ip4_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) +{ + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP4, + FLOW_DIRECTION_RX); +} + +static uword +flowprobe_input_ip6_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) +{ + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP6, + FLOW_DIRECTION_RX); +} + +static uword +flowprobe_input_l2_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) +{ + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_L2, + FLOW_DIRECTION_RX); +} + +static uword +flowprobe_output_ip4_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) { - return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP4); + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP4, + FLOW_DIRECTION_TX); } static uword -flowprobe_ip6_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +flowprobe_output_ip6_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) { - return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP6); + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_IP6, + FLOW_DIRECTION_TX); } static uword -flowprobe_l2_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +flowprobe_output_l2_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, + vlib_frame_t *frame) { - return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_L2); + return flowprobe_node_fn (vm, node, frame, FLOW_VARIANT_L2, + FLOW_DIRECTION_TX); } static inline void @@ -883,25 +946,63 @@ flush_record (flowprobe_variant_t which) void flowprobe_flush_callback_ip4 (void) { + vlib_main_t *worker_vm; + u32 i; + + /* Flush for each worker thread */ + for (i = 1; i < vlib_get_n_threads (); i++) + { + worker_vm = vlib_get_main_by_index (i); + if (worker_vm) + vlib_node_set_interrupt_pending (worker_vm, + flowprobe_flush_ip4_node.index); + } + + /* Flush for the main thread */ flush_record (FLOW_VARIANT_IP4); } void flowprobe_flush_callback_ip6 (void) { + vlib_main_t *worker_vm; + u32 i; + + /* Flush for each worker thread */ + for (i = 1; i < vlib_get_n_threads (); i++) + { + worker_vm = vlib_get_main_by_index (i); + if (worker_vm) + vlib_node_set_interrupt_pending (worker_vm, + flowprobe_flush_ip6_node.index); + } + + /* Flush for the main thread */ flush_record (FLOW_VARIANT_IP6); } void flowprobe_flush_callback_l2 (void) { + vlib_main_t *worker_vm; + u32 i; + + /* Flush for each worker thread */ + for (i = 1; i < vlib_get_n_threads (); i++) + { + worker_vm = vlib_get_main_by_index (i); + if (worker_vm) + vlib_node_set_interrupt_pending (worker_vm, + flowprobe_flush_l2_node.index); + } + + /* Flush for the main thread */ flush_record (FLOW_VARIANT_L2); flush_record (FLOW_VARIANT_L2_IP4); flush_record (FLOW_VARIANT_L2_IP6); } - -static void +void flowprobe_delete_by_index (u32 my_cpu_number, u32 poolindex) { flowprobe_main_t *fm = &flowprobe_main; @@ -926,14 +1027,15 @@ flowprobe_walker_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) { flowprobe_main_t *fm = &flowprobe_main; - flow_report_main_t *frm = &flow_report_main; flowprobe_entry_t *e; + ipfix_exporter_t *exp = pool_elt_at_index (flow_report_main.exporters, 0); /* * $$$$ Remove this check from here and track FRM status and disable * this process if required. */ - if (frm->ipfix_collector.as_u32 == 0 || frm->src_address.as_u32 == 0) + if (ip_address_is_zero (&exp->ipfix_collector) || + ip_address_is_zero (&exp->src_address)) { fm->disabled = true; return 0; @@ -1000,36 +1102,94 @@ flowprobe_walker_process (vlib_main_t * vm, return 0; } -/* *INDENT-OFF* */ -VLIB_REGISTER_NODE (flowprobe_ip4_node) = { - .function = flowprobe_ip4_node_fn, - .name = "flowprobe-ip4", +static uword +flowprobe_flush_ip4 (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f) +{ + flush_record (FLOW_VARIANT_IP4); + + return 0; +} + +static uword +flowprobe_flush_ip6 (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f) +{ + flush_record (FLOW_VARIANT_IP6); + + return 0; +} + +static uword +flowprobe_flush_l2 (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f) +{ + flush_record (FLOW_VARIANT_L2); + flush_record (FLOW_VARIANT_L2_IP4); + flush_record (FLOW_VARIANT_L2_IP6); + + return 0; +} + +VLIB_REGISTER_NODE (flowprobe_input_ip4_node) = { + .function = flowprobe_input_ip4_node_fn, + .name = "flowprobe-input-ip4", + .vector_size = sizeof (u32), + .format_trace = format_flowprobe_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + .n_errors = ARRAY_LEN (flowprobe_error_strings), + .error_strings = flowprobe_error_strings, + .n_next_nodes = FLOWPROBE_N_NEXT, + .next_nodes = FLOWPROBE_NEXT_NODES, +}; +VLIB_REGISTER_NODE (flowprobe_input_ip6_node) = { + .function = flowprobe_input_ip6_node_fn, + .name = "flowprobe-input-ip6", .vector_size = sizeof (u32), .format_trace = format_flowprobe_trace, .type = VLIB_NODE_TYPE_INTERNAL, - .n_errors = ARRAY_LEN(flowprobe_error_strings), + .n_errors = ARRAY_LEN (flowprobe_error_strings), .error_strings = flowprobe_error_strings, .n_next_nodes = FLOWPROBE_N_NEXT, .next_nodes = FLOWPROBE_NEXT_NODES, }; -VLIB_REGISTER_NODE (flowprobe_ip6_node) = { - .function = flowprobe_ip6_node_fn, - .name = "flowprobe-ip6", +VLIB_REGISTER_NODE (flowprobe_input_l2_node) = { + .function = flowprobe_input_l2_node_fn, + .name = "flowprobe-input-l2", .vector_size = sizeof (u32), .format_trace = format_flowprobe_trace, .type = VLIB_NODE_TYPE_INTERNAL, - .n_errors = ARRAY_LEN(flowprobe_error_strings), + .n_errors = ARRAY_LEN (flowprobe_error_strings), .error_strings = flowprobe_error_strings, .n_next_nodes = FLOWPROBE_N_NEXT, .next_nodes = FLOWPROBE_NEXT_NODES, }; -VLIB_REGISTER_NODE (flowprobe_l2_node) = { - .function = flowprobe_l2_node_fn, - .name = "flowprobe-l2", +VLIB_REGISTER_NODE (flowprobe_output_ip4_node) = { + .function = flowprobe_output_ip4_node_fn, + .name = "flowprobe-output-ip4", .vector_size = sizeof (u32), .format_trace = format_flowprobe_trace, .type = VLIB_NODE_TYPE_INTERNAL, - .n_errors = ARRAY_LEN(flowprobe_error_strings), + .n_errors = ARRAY_LEN (flowprobe_error_strings), + .error_strings = flowprobe_error_strings, + .n_next_nodes = FLOWPROBE_N_NEXT, + .next_nodes = FLOWPROBE_NEXT_NODES, +}; +VLIB_REGISTER_NODE (flowprobe_output_ip6_node) = { + .function = flowprobe_output_ip6_node_fn, + .name = "flowprobe-output-ip6", + .vector_size = sizeof (u32), + .format_trace = format_flowprobe_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + .n_errors = ARRAY_LEN (flowprobe_error_strings), + .error_strings = flowprobe_error_strings, + .n_next_nodes = FLOWPROBE_N_NEXT, + .next_nodes = FLOWPROBE_NEXT_NODES, +}; +VLIB_REGISTER_NODE (flowprobe_output_l2_node) = { + .function = flowprobe_output_l2_node_fn, + .name = "flowprobe-output-l2", + .vector_size = sizeof (u32), + .format_trace = format_flowprobe_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + .n_errors = ARRAY_LEN (flowprobe_error_strings), .error_strings = flowprobe_error_strings, .n_next_nodes = FLOWPROBE_N_NEXT, .next_nodes = FLOWPROBE_NEXT_NODES, @@ -1040,7 +1200,24 @@ VLIB_REGISTER_NODE (flowprobe_walker_node) = { .type = VLIB_NODE_TYPE_INPUT, .state = VLIB_NODE_STATE_INTERRUPT, }; -/* *INDENT-ON* */ +VLIB_REGISTER_NODE (flowprobe_flush_ip4_node) = { + .function = flowprobe_flush_ip4, + .name = "flowprobe-flush-ip4", + .type = VLIB_NODE_TYPE_INPUT, + .state = VLIB_NODE_STATE_INTERRUPT, +}; +VLIB_REGISTER_NODE (flowprobe_flush_ip6_node) = { + .function = flowprobe_flush_ip6, + .name = "flowprobe-flush-ip6", + .type = VLIB_NODE_TYPE_INPUT, + .state = VLIB_NODE_STATE_INTERRUPT, +}; +VLIB_REGISTER_NODE (flowprobe_flush_l2_node) = { + .function = flowprobe_flush_l2, + .name = "flowprobe-flush-l2", + .type = VLIB_NODE_TYPE_INPUT, + .state = VLIB_NODE_STATE_INTERRUPT, +}; /* * fd.io coding-style-patch-verification: ON