143 u32 * n_slow_bytes_result)
147 u32 n_slow_bytes = 0;
149 while (n_left_to_tx > 0)
172 *n_slow_bytes_result = n_slow_bytes;
185 u32 * last_sw_if_index,
204 *last_sw_if_index = sw_if_index;
221 u32 n_left_to_tx, * from, * from_end, * to_tx;
222 u32 n_bytes, n_buffers, n_packets;
223 u32 last_sw_if_index;
262 from_end = from + n_buffers;
267 last_sw_if_index = ~0;
269 while (from < from_end)
274 to_tx, n_left_to_tx);
276 while (from + 4 <= from_end && n_left_to_tx >= 2)
303 u32 n_buffers, n_slow_bytes,
i;
311 for (i = 0; i < 2; i++)
313 u32 bi = i ? bi1 : bi0;
317 n_left_to_tx, to_tx, &n_slow_bytes);
325 n_left_to_tx -= n_buffers;
328 &last_sw_if_index, &n_packets, &n_bytes);
334 &last_sw_if_index, &n_packets, &n_bytes);
338 &last_sw_if_index, &n_packets, &n_bytes);
342 while (from + 1 <= from_end && n_left_to_tx >= 1)
361 u32 n_buffers, n_slow_bytes;
369 n_left_to_tx, to_tx, &n_slow_bytes);
377 n_left_to_tx -= n_buffers;
382 &last_sw_if_index, &n_packets, &n_bytes);
391 &last_sw_if_index, &n_packets, &n_bytes);
406 u32 n_left_to_tx, * from, * from_end, * to_tx;
407 u32 n_bytes, n_buffers, n_packets;
408 u32 n_bytes_b0, n_bytes_b1;
450 from_end = from + n_buffers;
456 while (from < from_end)
461 to_tx, n_left_to_tx);
463 while (from + 4 <= from_end && n_left_to_tx >= 2)
467 u32 tx_swif0, tx_swif1;
495 n_bytes += n_bytes_b0 + n_bytes_b1;
500 vnet_buffer(b0)->output_features.bitmap = si->output_feature_bitmap;
501 count_trailing_zeros(next0,
vnet_buffer(b0)->output_features.bitmap);
502 vnet_buffer(b0)->output_features.bitmap &= ~(1 << next0);
524 vnet_buffer(b1)->output_features.bitmap = si->output_feature_bitmap;
525 count_trailing_zeros(next1,
vnet_buffer(b1)->output_features.bitmap);
526 vnet_buffer(b1)->output_features.bitmap &= ~(1 << next1);
547 n_left_to_tx, bi0, bi1, next0, next1);
550 while (from + 1 <= from_end && n_left_to_tx >= 1)
570 n_bytes += n_bytes_b0;
577 vnet_buffer(b0)->output_features.bitmap = si->output_feature_bitmap;
578 count_trailing_zeros(next0,
vnet_buffer(b0)->output_features.bitmap);
579 vnet_buffer(b0)->output_features.bitmap &= ~(1 << next0);
581 n_left_to_tx, bi0, next0);
645 u32 n_left_to_next, * from, * to_next;
646 u32 n_left_from, next_index;
653 while (n_left_from > 0)
657 while (n_left_from >= 4 && n_left_to_next >= 2)
659 u32 bi0, bi1, next0, next1;
686 bi0, bi1, next0, next1);
689 while (n_left_from > 0 && n_left_to_next > 0)
728 ASSERT (ci < n->n_errors);
756 u32 n_left, * buffers;
819 return format (0,
"[%d], node index out of range 0x%x, error 0x%x",
820 index, node_index, e[0]);
824 return format (0,
"[%d], code %d out of range for node %v",
825 index, code, n->
name);
874 u32 * buffers, * first_buffer;
876 u32 current_counter_index, n_errors_left;
877 u32 current_sw_if_index, n_errors_current_sw_if_index;
886 first_buffer = buffers;
891 if (! memory_init[disposition])
893 memory_init[disposition] = 1;
894 memory[disposition] = b->
error;
898 n_errors_current_sw_if_index = 0;
901 current_error = memory[disposition];
902 current_counter_index =
counter_index (vm, memory[disposition]);
903 current_counter = em->
counters[current_counter_index];
914 while (n_errors_left >= 2)
920 u32 sw_if_index0, sw_if_index1;
938 n_errors_current_sw_if_index += 2;
942 current_counter += 2;
945 || e1 != current_error
946 || sw_if_index0 != current_sw_if_index
947 || sw_if_index1 != current_sw_if_index))
949 current_counter -= 2;
950 n_errors_current_sw_if_index -= 2;
967 em->
counters[current_counter_index] = current_counter;
972 if (e0 == e1 && e1 != current_error)
977 current_counter = em->
counters[current_counter_index];
981 while (n_errors_left >= 1)
986 u32 bi0, sw_if_index0;
992 current_counter += 1;
1009 current_counter -= 1;
1013 - em->
counters[current_counter_index]));
1015 em->
counters[current_counter_index] = current_counter;
1020 current_counter = em->
counters[current_counter_index];
1024 if (n_errors_current_sw_if_index > 0)
1029 n_errors_current_sw_if_index);
1034 n_errors_current_sw_if_index);
1039 - em->
counters[current_counter_index]));
1042 em->
counters[current_counter_index] = current_counter;
1045 memory[disposition] = current_error;
1074 i16 save_current_data;
1075 u16 save_current_length;
1154 .name =
"error-drop",
1156 .vector_size =
sizeof (
u32),
1165 .name =
"error-punt",
1166 .vector_size =
sizeof (
u32),
1173 .name =
"interface-output",
1174 .vector_size =
sizeof (
u32),
1190 ASSERT (next_index == hw_if_index);
1262 else if (
unformat (input,
"max %d", &max))
1268 else if (
unformat (input,
"intfc %U",
1272 else if (
unformat (input,
"intfc any"))
1277 else if (
unformat (input,
"file %s", &filename))
1279 u8 * chroot_filename;
1281 if (strstr((
char *)filename,
"..") || index((
char *)filename,
'/'))
1288 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
1297 else if (
unformat (input,
"status"))
1323 .path =
"pcap drop trace",
1325 "pcap drop trace on off max <nn> intfc <intfc> file <name> status",
u8 * format_vnet_interface_output_trace(u8 *s, va_list *va)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
#define hash_set(h, key, value)
void(* os_punt_frame)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, vlib_frame_t *frame)
sll srl srl sll sra u16x4 i
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)
#define hash_unset(h, key)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
vnet_interface_main_t interface_main
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
always_inline u32 vlib_error_get_node(vlib_error_t e)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
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)
unformat_function_t unformat_vnet_sw_interface
void vnet_pcap_drop_trace_filter_add_del(u32 error_index, int is_add)
#define clib_error_report(e)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vhost_user_memory_t memory
vnet_main_t * vnet_get_main(void)
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...
#define VLIB_NODE_FLAG_IS_DROP
static u8 * validate_error_frame(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
always_inline u32 vlib_error_get_code(vlib_error_t e)
vlib_combined_counter_main_t * combined_sw_if_counters
static_always_inline void incr_output_stats(vnet_main_t *vnm, u32 cpu_index, u32 length, u32 sw_if_index, u32 *last_sw_if_index, u32 *n_packets, u32 *n_bytes)
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define vlib_get_new_next_frame(vm, node, next_index, vectors, n_vectors_left)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_node_registration_t drop_buffers
(constructor) VLIB_REGISTER_NODE (drop_buffers)
static void pcap_drop_trace(vlib_main_t *vm, vnet_interface_main_t *im, vlib_frame_t *f)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
vlib_node_registration_t vnet_per_buffer_interface_output_node
(constructor) VLIB_REGISTER_NODE (vnet_per_buffer_interface_output_node)
#define VLIB_BUFFER_NEXT_PRESENT
format_function_t format_vnet_sw_interface_name
void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
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
void vlib_frame_free(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_frame_t *f)
uword vnet_interface_output_node(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
always_inline void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u32 increment)
static void pcap_add_buffer(pcap_main_t *pm, vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
vlib_simple_counter_main_t * sw_if_counters
format_function_t * format_buffer
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
always_inline void * vlib_frame_args(vlib_frame_t *f)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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 BUFFER_OUTPUT_FEAT_DONE
#define clib_memcpy(a, b, c)
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
always_inline vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
clib_error_t * pcap_write(pcap_main_t *pm)
static uword process_drop(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define VLIB_NODE_FLAG_IS_PUNT
static void trace_errors_with_buffers(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 next_buffer
Next buffer for this linked-list of buffers.
always_inline void vlib_error_elog_count(vlib_main_t *vm, uword counter, uword increment)
#define VLIB_NODE_FLAG_TRACE
uword vnet_interface_output_node_no_flatten(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_BUFFER_IS_TRACED
VNET_HW_INTERFACE_ADD_DEL_FUNCTION(vnet_per_buffer_interface_output_hw_interface_add_del)
pcap_packet_type_t packet_type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_node_main_t node_main
always_inline vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
always_inline uword vnet_interface_output_node_no_flatten_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int with_features)
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static clib_error_t * pcap_drop_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
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)
static uword process_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define clib_error_return(e, args...)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
#define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
uword runtime_data[(128-1 *sizeof(vlib_node_function_t *)-1 *sizeof(vlib_error_t *)-11 *sizeof(u32)-5 *sizeof(u16))/sizeof(uword)]
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
always_inline u32 counter_index(vlib_main_t *vm, vlib_error_t e)
always_inline void do_packet(vlib_main_t *vm, vlib_error_t a)
static u8 * validate_error(vlib_main_t *vm, vlib_error_t *e, u32 index)
static never_inline u32 slow_path(vlib_main_t *vm, u32 bi, vlib_buffer_t *b, u32 n_left_to_tx, u32 *to_tx, u32 *n_slow_bytes_result)