24 #include <vpp/app/version.h> 27 #include <mdata/mdata.api_enum.h> 28 #include <mdata/mdata.api_types.h> 30 #define REPLY_MSG_ID_BASE mmp->msg_id_base 71 if (before_or_after == 1 )
81 while (n_left_from > 0)
111 while (n_left_from > 0)
119 if (before->
mdata[i] != after[i])
120 modifies->
mdata[
i] = 0xff;
156 (
vlib_mains[i]->vlib_node_runtime_perf_counter_cbs,
157 vlib_mains[i]->vlib_node_runtime_perf_counter_cb_tmp,
158 vlib_mains[i]->worker_thread_main_loop_callback_lock,
171 int enable_disable = 1;
215 .path =
"buffer metadata tracking",
216 .short_help =
"buffer metadata tracking [on][off]",
225 vl_api_mdata_enable_disable_reply_t *rmp;
235 #include <mdata/mdata.api.c> 257 .version = VPP_BUILD_VER,
258 .description =
"Buffer metadata change tracker." 263 #define foreach_primary_metadata_field \ 269 _(buffer_pool_index) \ 272 _(current_config_index) \ 275 #define foreach_opaque_metadata_field \ 281 _(feature_arc_index) \ 285 _(ip.save_protocol) \ 290 _(ip.reass.next_index) \ 291 _(ip.reass.error_next_index) \ 292 _(ip.reass.owner_thread_index) \ 293 _(ip.reass.ip_proto) \ 294 _(ip.reass.l4_src_port) \ 295 _(ip.reass.l4_dst_port) \ 296 _(ip.reass.estimated_mtu) \ 297 _(ip.reass.fragment_first) \ 298 _(ip.reass.fragment_last) \ 299 _(ip.reass.range_first) \ 300 _(ip.reass.range_last) \ 301 _(ip.reass.next_range_bi) \ 302 _(ip.reass.ip6_frag_hdr_offset) \ 306 _(mpls.save_rewrite_length) \ 307 _(mpls.mpls_hdr_length) \ 308 _(mpls.bier.n_bytes) \ 309 _(l2.feature_bitmap) \ 316 _(l2t.session_index) \ 317 _(l2_classify.table_index) \ 318 _(l2_classify.opaque_index) \ 319 _(l2_classify.hash) \ 322 _(ipsec.protect_index) \ 324 _(map_t.map_domain_index) \ 327 _(map_t.v6.frag_offset) \ 328 _(map_t.v6.l4_offset) \ 329 _(map_t.v6.l4_protocol) \ 330 _(map_t.checksum_offset) \ 333 _(ip_frag.next_index) \ 335 _(cop.current_config_index) \ 336 _(lisp.overlay_afi) \ 337 _(tcp.connection_index) \ 339 _(tcp.next_node_opaque) \ 348 #define foreach_opaque2_metadata_field \ 356 _(pg_replay_timestamp) 362 int verbose = va_arg (*args,
int);
382 s =
format (s,
"\n%v: no data\n", node->
name);
389 if (modifies->
mdata[j])
392 s =
format (s,
"\n%v: no metadata changes\n", node->
name);
403 #define _(n) if (b->n) {s = format (s, "%s ", #n); printed = 1;} 408 s =
format (s,
"no vlib_buffer_t metadata changes");
419 s =
format (s,
" vnet_buffer_t: ");
421 #define _(n) if (o->n) {s = format (s, "%s ", #n); printed = 1;} 426 s =
format (s,
"no changes");
432 s =
format (s,
" vnet_buffer2_t: ");
434 #define _(n) if (o2->n) {s = format (s, "%s ", #n); printed = 1;} 438 s =
format (s,
"no changes");
457 if (
unformat (input,
"verbose %=", &verbose, 1))
482 .path =
"show buffer metadata",
483 .short_help =
"show buffer metadata",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vl_api_mdata_enable_disable_t_handler(vl_api_mdata_enable_disable_t *mp)
u16 msg_id_base
API message ID base.
vnet_main_t * vnet_get_main(void)
#define foreach_primary_metadata_field
#define clib_memcpy_fast(a, b, c)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u8 * format_buffer_metadata_changes(u8 *s, va_list *args)
vlib_main_t ** vlib_mains
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
clib_spinlock_t modify_lock
Spinlock to protect modified metadata by node.
#define VLIB_INIT_FUNCTION(x)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
u8 mdata[128]
buffer metadata, cast to vlib_buffer_t as needed
int mdata_enable_disable(mdata_main_t *mmp, int enable_disable)
static void clib_spinlock_init(clib_spinlock_t *p)
u32 node_index
Node index.
API to enable / disable mdata on an interface.
mdata_t ** before_per_thread
Per-thread buffer metadata before calling node fcn.
sll srl srl sll sra u16x4 i
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
#define foreach_opaque_metadata_field
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void mdata_trace_callback(vlib_main_t *vm, u64 *c0, u64 *c1, vlib_node_runtime_t *node, vlib_frame_t *frame, int before_or_after)
Metadata tracking callback before_or_after: 0 => before, 1=> after.
#define clib_callback_enable_disable(h, tmp, l, f, enable)
Add or remove a callback to the specified callback set.
static mdata_t mdata_none
static clib_error_t * mdata_init(vlib_main_t *vm)
u32 node_index
Node index, ~0 means no data from this run.
#define foreach_opaque2_metadata_field
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static vlib_thread_main_t * vlib_get_thread_main()
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
mdata_t * modifies
Modified metadata by node.
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
static clib_error_t * mdata_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
static clib_error_t * show_metadata_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
buffer metadata change tracker definitions