|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
25 #include <vpp/app/version.h>
28 #include <tracedump/tracedump.api_enum.h>
29 #include <tracedump/tracedump.api_types.h>
31 #define REPLY_MSG_ID_BASE tdmp->msg_id_base
43 u32 flag = clib_net_to_host_u32 (mp->
flag);
45 vl_api_trace_set_filters_reply_t *rmp;
54 rv = VNET_API_ERROR_INVALID_VALUE;
62 rv = VNET_API_ERROR_NO_SUCH_NODE;
83 vl_api_trace_capture_packets_reply_t *rmp;
94 rv = VNET_API_ERROR_NO_SUCH_NODE;
101 rv = VNET_API_ERROR_NO_SUCH_NODE;
118 vl_api_trace_clear_capture_reply_t *rmp;
135 return dt < 0 ? -1 : (dt > 0 ? +1 : 0);
146 for (
i = 0;
i <
vec_len (client_trace_cache);
i++)
148 th = client_trace_cache[
i];
154 tdmp->
traces[client_index] = client_trace_cache;
167 client_trace_cache = tdmp->
traces[client_index];
185 u32 iterator_thread_id, iterator_position, max_records;
186 i32 retval = VNET_API_ERROR_NO_SUCH_ENTRY;
187 u32 last_thread_id = ~0, last_position = ~0;
189 u8 last_more_this_thread = 0;
190 u8 last_more_threads = 0;
202 client_trace_cache = tdmp->
traces[client_index];
208 client_trace_cache = 0;
212 iterator_thread_id = clib_net_to_host_u32 (mp->
thread_id);
213 iterator_position = clib_net_to_host_u32 (mp->
position);
214 max_records = clib_net_to_host_u32 (mp->
max_records);
218 u32 queue_slots_available = q->maxsize - q->cursize;
219 int chunk = (queue_slots_available > 0) ? queue_slots_available - 1 : 0;
220 if (chunk < max_records)
224 if (
vec_len (client_trace_cache) == 0
225 && (iterator_thread_id != ~0 || iterator_position != ~0))
246 if (
vec_len (client_trace_cache[
i]))
255 tdmp->
traces[client_index] = client_trace_cache;
257 for (
i = iterator_thread_id;
i <
vec_len (client_trace_cache);
i++)
259 for (j = iterator_position; j <
vec_len (client_trace_cache[
i]); j++)
261 if (max_records == 0)
265 th = &client_trace_cache[
i][j];
274 htons (VL_API_TRACE_DETAILS + (tdmp->
msg_id_base));
277 last_position = dmp->
position = ntohl (j);
284 if (max_records == 1)
287 if (j == (
vec_len (client_trace_cache[
i]) - 1))
294 if (
i == (
vec_len (client_trace_cache) - 1) &&
295 j == (
vec_len (client_trace_cache[
i]) - 1))
297 last_done = dmp->
done = 1;
303 last_done = dmp->
done;
308 iterator_position = 0;
314 rmp->_vl_msg_id = htons (VL_API_TRACE_DUMP_REPLY + (tdmp->
msg_id_base));
316 rmp->
retval = clib_host_to_net_u32 (retval);
319 rmp->
done = last_done;
324 if (iterator_thread_id == ~0 && iterator_position == ~0)
336 #include <tracedump/tracedump.api.c>
361 .version = VPP_BUILD_VER,
362 .description =
"Streaming packet trace dump plugin",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void toss_client_cache(tracedump_main_t *tdmp, u32 client_index, vlib_trace_header_t ***client_trace_cache)
static void vl_api_trace_capture_packets_t_handler(vl_api_trace_capture_packets_t *mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
void trace_apply_filter(vlib_main_t *vm)
format_function_t format_vlib_trace
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
vl_api_trace_filter_flag_t flag
vlib_main_t vlib_node_runtime_t * node
struct _svm_queue svm_queue_t
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
svm_queue_t * vl_input_queue
shared memory only: pointer to client input queue
static clib_error_t * tracedump_cache_reaper(u32 client_index)
tracedump_main_t tracedump_main
void trace_filter_set(u32 node_index, u32 flag, u32 count)
u32 node_index[default=0xffffffff]
#define foreach_vlib_main()
#define pool_foreach(VAR, POOL)
Iterate through pool.
void vlib_trace_stop_and_clear(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vnet_main_t * vnet_get_main(void)
#define vlib_worker_thread_barrier_sync(X)
An API client registration, only in vpp/vlib.
static void setup_message_id_table(api_main_t *am)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static void vl_api_trace_dump_t_handler(vl_api_trace_dump_t *mp)
static api_main_t * vlibapi_get_main(void)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
static void vl_api_trace_clear_capture_t_handler(vl_api_trace_clear_capture_t *mp)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
API main structure, used by both vpp and binary API clients.
vlib_trace_header_t **** traces
#define vec_free(V)
Free vector's memory (no header).
int vl_api_vec_to_api_string(const u8 *vec, vl_api_string_t *str)
vlib_trace_header_t ** trace_buffer_pool
u8 * vnet_trace_placeholder
description fragment has unexpected format
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
VL_MSG_API_REAPER_FUNCTION(tracedump_cache_reaper)
#define VLIB_INIT_FUNCTION(x)
static int trace_cmp(void *a1, void *a2)
static vlib_main_t * vlib_get_first_main(void)
static clib_error_t * tracedump_init(vlib_main_t *vm)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static u32 vlib_get_n_threads()
static vlib_main_t * vlib_get_main(void)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static void vl_api_trace_set_filters_t_handler(vl_api_trace_set_filters_t *mp)
void trace_update_capture_options(u32 add, u32 node_index, u32 filter, u8 verbose)
u32 vl_api_registration_pool_index
Index in VLIB's brain (not shared memory).
void * vl_msg_api_alloc(int nbytes)