72 s =
format (s,
"sw_if_index: %d\n%U%U",
120 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
127 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
148 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
168 int is_ip4 = (b->
flags & VNET_BUFFER_F_IS_IP4) != 0;
169 int is_ip6 = (b->
flags & VNET_BUFFER_F_IS_IP6) != 0;
171 ASSERT (!(is_ip4 && is_ip6));
181 if (b->
flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM)
183 if (b->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM)
185 if (b->
flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)
191 if (b->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM)
193 if (b->
flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)
197 b->
flags &= ~VNET_BUFFER_F_OFFLOAD_TCP_CKSUM;
198 b->
flags &= ~VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
199 b->
flags &= ~VNET_BUFFER_F_OFFLOAD_IP_CKSUM;
211 u32 n_left_to_tx, *from, *from_end, *to_tx;
212 u32 n_bytes, n_buffers, n_packets;
213 u32 n_bytes_b0, n_bytes_b1, n_bytes_b2, n_bytes_b3;
217 u32 current_config_index = ~0;
218 u8 arc = im->output_feature_arc_index;
256 from_end = from + n_buffers;
273 while (from < from_end)
279 while (from + 8 <= from_end && n_left_to_tx >= 4)
281 u32 bi0, bi1, bi2, bi3;
283 u32 tx_swif0, tx_swif1, tx_swif2, tx_swif3;
325 n_bytes += n_bytes_b0 + n_bytes_b1;
326 n_bytes += n_bytes_b2 + n_bytes_b3;
346 thread_index, tx_swif0, 1,
355 thread_index, tx_swif1, 1,
364 thread_index, tx_swif2, 1,
372 thread_index, tx_swif3, 1,
381 (VNET_BUFFER_F_OFFLOAD_TCP_CKSUM |
382 VNET_BUFFER_F_OFFLOAD_UDP_CKSUM |
383 VNET_BUFFER_F_OFFLOAD_IP_CKSUM))
393 while (from + 1 <= from_end && n_left_to_tx >= 1)
413 n_bytes += n_bytes_b0;
427 thread_index, tx_swif0, 1,
473 u32 n_left_to_next, *from, *to_next;
474 u32 n_left_from, next_index;
481 while (n_left_from > 0)
485 while (n_left_from >= 4 && n_left_to_next >= 2)
487 u32 bi0, bi1, next0, next1;
520 n_left_to_next, bi0, bi1, next0,
524 while (n_left_from > 0 && n_left_to_next > 0)
547 n_left_to_next, bi0, next0);
566 ASSERT (ci < n->n_errors);
594 u32 n_left, *buffers;
615 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
620 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
639 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
657 return format (0,
"[%d], node index out of range 0x%x, error 0x%x",
658 index, node_index, e[0]);
662 return format (0,
"[%d], code %d out of range for node %v",
663 index, code, n->
name);
711 u32 *buffers, *first_buffer;
713 u32 current_counter_index, n_errors_left;
714 u32 current_sw_if_index, n_errors_current_sw_if_index;
723 first_buffer = buffers;
728 if (!memory_init[disposition])
730 memory_init[disposition] = 1;
731 memory[disposition] = b->
error;
735 n_errors_current_sw_if_index = 0;
738 current_error = memory[disposition];
739 current_counter_index =
counter_index (vm, memory[disposition]);
740 current_counter = em->
counters[current_counter_index];
751 while (n_errors_left >= 2)
757 u32 sw_if_index0, sw_if_index1;
775 n_errors_current_sw_if_index += 2;
779 current_counter += 2;
782 || e1 != current_error
783 || sw_if_index0 != current_sw_if_index
784 || sw_if_index1 != current_sw_if_index))
786 current_counter -= 2;
787 n_errors_current_sw_if_index -= 2;
804 em->
counters[current_counter_index] = current_counter;
809 if (e0 == e1 && e1 != current_error)
814 current_counter = em->
counters[current_counter_index];
818 while (n_errors_left >= 1)
823 u32 bi0, sw_if_index0;
829 current_counter += 1;
847 current_counter -= 1;
851 - em->
counters[current_counter_index]));
853 em->
counters[current_counter_index] = current_counter;
858 current_counter = em->
counters[current_counter_index];
862 if (n_errors_current_sw_if_index > 0)
867 n_errors_current_sw_if_index);
872 n_errors_current_sw_if_index);
877 - em->
counters[current_counter_index]));
880 em->
counters[current_counter_index] = current_counter;
883 memory[disposition] = current_error;
907 i16 save_current_data;
908 u16 save_current_length;
987 .name =
"error-drop",
989 .vector_size =
sizeof (
u32),
1002 .name =
"error-punt",
1003 .vector_size =
sizeof (
u32),
1014 .name =
"interface-output",
1015 .vector_size =
sizeof (
u32),
1027 u32 last_sw_if_index = ~0;
1030 u32 *from, *to_next = 0;
1035 while (n_left_from > 0)
1047 if (
PREDICT_FALSE ((last_sw_if_index != sw_if_index0) || to_frame == 0))
1054 last_sw_if_index = sw_if_index0;
1071 .name =
"interface-tx",
1072 .vector_size =
sizeof (
u32),
1081 .arc_name =
"interface-output",
1087 .arc_name =
"interface-output",
1088 .node_name =
"span-output",
1093 .arc_name =
"interface-output",
1094 .node_name =
"interface-tx",
1123 u32 hw_if_index,
u32 node_index)
1197 else if (
unformat (input,
"max %d", &max))
1203 else if (
unformat (input,
"intfc %U",
1207 else if (
unformat (input,
"intfc any"))
1212 else if (
unformat (input,
"file %s", &filename))
1214 u8 *chroot_filename;
1216 if (strstr ((
char *) filename,
"..")
1217 || index ((
char *) filename,
'/'))
1224 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
1233 else if (
unformat (input,
"status"))
1260 .path =
"pcap drop trace",
1262 "pcap drop trace on off max <nn> intfc <intfc> file <name> status",
u8 * format_vnet_interface_output_trace(u8 *s, va_list *va)
vnet_config_main_t config_main
VNET_FEATURE_ARC_INIT(interface_output, static)
#define hash_set(h, key, value)
char * file_name
File name of pcap output.
void vnet_set_interface_output_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Set interface output node - for interface registered without its output/tx nodes created because its ...
static_always_inline uword vnet_interface_output_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vnet_main_t *vnm, vnet_hw_interface_t *hi, int do_tx_offloads)
VLIB_NODE_FUNCTION_MULTIARCH_CLONE(vnet_interface_output_node)
#define hash_unset(h, key)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
u8 runtime_data[0]
Function dependent node-runtime data.
u32 n_packets_to_capture
Number of packets to capture.
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static uword vnet_interface_output_node(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vnet_interface_main_t interface_main
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define VLIB_NODE_FLAG_IS_PUNT
clib_error_t * vnet_per_buffer_interface_output_hw_interface_add_del(vnet_main_t *vnm, u32 hw_if_index, u32 is_create)
static void vnet_interface_output_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, uword n_buffers)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
unformat_function_t unformat_vnet_sw_interface
static_always_inline int vnet_have_features(u8 arc, u32 sw_if_index)
void vnet_pcap_drop_trace_filter_add_del(u32 error_index, int is_add)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
CLIB_MULTIARCH_SELECT_FN(vnet_interface_output_node)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
struct _tcp_header tcp_header_t
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
vhost_user_memory_t memory
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define static_always_inline
uword * pcap_drop_filter_hash
#define vlib_prefetch_buffer_with_index(vm, bi, type)
Prefetch buffer metadata by buffer index The first 64 bytes of buffer contains most header informatio...
static u8 * validate_error_frame(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
static_always_inline void calc_checksums(vlib_main_t *vm, vlib_buffer_t *b)
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
u8 feature_arc_index
Used to identify feature arcs by intermediate feature node.
#define vlib_get_new_next_frame(vm, node, next_index, vectors, n_vectors_left)
#define clib_error_return(e, args...)
static vlib_node_registration_t drop_buffers
(constructor) VLIB_REGISTER_NODE (drop_buffers)
A collection of simple counters.
static void pcap_drop_trace(vlib_main_t *vm, vnet_interface_main_t *im, vlib_frame_t *f)
static vlib_node_registration_t vnet_per_buffer_interface_output_node
(constructor) VLIB_REGISTER_NODE (vnet_per_buffer_interface_output_node)
static uword interface_tx_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
format_function_t format_vnet_sw_interface_name
u16 current_length
Nbytes between current data and the end of this buffer.
static u8 * format_vnet_error_trace(u8 *s, va_list *va)
vlib_error_main_t error_main
#define VNET_SW_INTERFACE_FLAG_BOND_SLAVE
VNET_FEATURE_INIT(span_tx, static)
uword vlib_error_drop_buffers(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u32 next_buffer_stride, u32 n_buffers, u32 next_index, u32 drop_error_node, u32 drop_error_code)
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.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
void vlib_frame_free(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_frame_t *f)
static void pcap_add_buffer(pcap_main_t *pm, vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
vlib_simple_counter_main_t * sw_if_counters
format_function_t * format_buffer
u32 node_index
Node index.
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static u32 vlib_error_get_code(vlib_error_t e)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword process_drop_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vnet_error_disposition_t disposition)
char ** error_strings_heap
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
#define clib_memcpy(a, b, c)
VLIB_NODE_FUNCTION_MULTIARCH(drop_buffers, process_drop)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
clib_error_t * pcap_write(pcap_main_t *pm)
Write PCAP file.
static uword process_drop(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_CLI_COMMAND(x,...)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
#define hash_create(elts, value_bytes)
u32 output_node_next_index
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
u8 output_feature_arc_index
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
static void trace_errors_with_buffers(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define clib_error_report(e)
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static vlib_node_registration_t interface_tx
(constructor) VLIB_REGISTER_NODE (interface_tx)
#define VNET_FEATURES(...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
VNET_HW_INTERFACE_ADD_DEL_FUNCTION(vnet_per_buffer_interface_output_hw_interface_add_del)
pcap_packet_type_t packet_type
Packet type.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static_always_inline u32 vnet_get_feature_config_index(u8 arc, u32 sw_if_index)
vlib_node_main_t node_main
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define VLIB_NODE_FLAG_IS_DROP
static clib_error_t * pcap_drop_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void vlib_error_elog_count(vlib_main_t *vm, uword counter, uword increment)
static vlib_node_registration_t punt_buffers
(constructor) VLIB_REGISTER_NODE (punt_buffers)
static uword vnet_per_buffer_interface_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
void(* os_punt_frame)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
u16 flags
Copy of main node flags.
static uword process_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_NODE_FLAG_TRACE
static u32 vlib_error_get_node(vlib_error_t e)
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_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void do_packet(vlib_main_t *vm, vlib_error_t a)
u32 n_packets_captured
Number of packets currently captured.
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)
static u8 * validate_error(vlib_main_t *vm, vlib_error_t *e, u32 index)