summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/pcap_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-03-05 14:41:25 +0100
committerDamjan Marion <damarion@cisco.com>2021-03-07 15:58:54 +0100
commit25ab6c541062f436989b89962cdab10f21f1b4f0 (patch)
tree9b68793eee358dffd1afd0843f4b92996b717523 /src/vppinfra/pcap_funcs.h
parent46353f069337051b9299c1a21a7110d19816e66d (diff)
dispatch-trace: move dispatch trace pcap code to plugin
Type: refactor Change-Id: I02a527f57853ebff797f0d85761b71127916d6ce Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pcap_funcs.h')
-rw-r--r--src/vppinfra/pcap_funcs.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/vppinfra/pcap_funcs.h b/src/vppinfra/pcap_funcs.h
index 125c3bd2517..2c51ab72383 100644
--- a/src/vppinfra/pcap_funcs.h
+++ b/src/vppinfra/pcap_funcs.h
@@ -54,45 +54,6 @@ pcap_add_packet (pcap_main_t * pm,
return h->data;
}
-/**
- * @brief Add buffer (vlib_buffer_t) to the trace
- *
- * @param *pm - pcap_main_t
- * @param *vm - vlib_main_t
- * @param buffer_index - u32
- * @param n_bytes_in_trace - u32
- *
- */
-static inline void
-pcap_add_buffer (pcap_main_t * pm,
- struct vlib_main_t *vm, u32 buffer_index,
- u32 n_bytes_in_trace)
-{
- vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
- u32 n = vlib_buffer_length_in_chain (vm, b);
- i32 n_left = clib_min (n_bytes_in_trace, n);
- f64 time_now = vlib_time_now (vm);
- void *d;
-
- if (PREDICT_TRUE (pm->n_packets_captured < pm->n_packets_to_capture))
- {
- clib_spinlock_lock_if_init (&pm->lock);
- d = pcap_add_packet (pm, time_now, n_left, n);
- while (1)
- {
- u32 copy_length = clib_min ((u32) n_left, b->current_length);
- clib_memcpy_fast (d, b->data + b->current_data, copy_length);
- n_left -= b->current_length;
- if (n_left <= 0)
- break;
- d += b->current_length;
- ASSERT (b->flags & VLIB_BUFFER_NEXT_PRESENT);
- b = vlib_get_buffer (vm, b->next_buffer);
- }
- clib_spinlock_unlock_if_init (&pm->lock);
- }
-}
-
#endif /* included_vppinfra_pcap_funcs_h */
/*