25 #include <vpp/app/version.h> 28 #include <mdata/mdata.api_enum.h> 29 #include <mdata/mdata.api_types.h> 31 #define REPLY_MSG_ID_BASE mmp->msg_id_base 87 while (n_left_from > 0)
117 while (n_left_from > 0)
125 if (before->
mdata[i] != after[i])
126 modifies->
mdata[
i] = 0xff;
176 int enable_disable = 1;
220 .path =
"buffer metadata tracking",
221 .short_help =
"buffer metadata tracking [on][off]",
230 vl_api_mdata_enable_disable_reply_t *rmp;
240 #include <mdata/mdata.api.c> 262 .version = VPP_BUILD_VER,
263 .description =
"Buffer metadata change tracker." 268 #define foreach_primary_metadata_field \ 274 _(buffer_pool_index) \ 277 _(current_config_index) \ 280 #define foreach_opaque_metadata_field \ 286 _(feature_arc_index) \ 290 _(ip.save_protocol) \ 295 _(ip.reass.next_index) \ 296 _(ip.reass.error_next_index) \ 297 _(ip.reass.owner_thread_index) \ 298 _(ip.reass.ip_proto) \ 299 _(ip.reass.l4_src_port) \ 300 _(ip.reass.l4_dst_port) \ 301 _(ip.reass.estimated_mtu) \ 302 _(ip.reass.fragment_first) \ 303 _(ip.reass.fragment_last) \ 304 _(ip.reass.range_first) \ 305 _(ip.reass.range_last) \ 306 _(ip.reass.next_range_bi) \ 307 _(ip.reass.ip6_frag_hdr_offset) \ 311 _(mpls.save_rewrite_length) \ 312 _(mpls.mpls_hdr_length) \ 313 _(mpls.bier.n_bytes) \ 314 _(l2.feature_bitmap) \ 321 _(l2t.session_index) \ 322 _(l2_classify.table_index) \ 323 _(l2_classify.opaque_index) \ 324 _(l2_classify.hash) \ 327 _(ipsec.protect_index) \ 329 _(map_t.map_domain_index) \ 332 _(map_t.v6.frag_offset) \ 333 _(map_t.v6.l4_offset) \ 334 _(map_t.v6.l4_protocol) \ 335 _(map_t.checksum_offset) \ 338 _(ip_frag.next_index) \ 340 _(cop.current_config_index) \ 341 _(lisp.overlay_afi) \ 342 _(tcp.connection_index) \ 344 _(tcp.next_node_opaque) \ 353 #define foreach_opaque2_metadata_field \ 361 _(pg_replay_timestamp) 367 int verbose = va_arg (*args,
int);
387 s =
format (s,
"\n%v: no data\n", node->
name);
394 if (modifies->
mdata[j])
397 s =
format (s,
"\n%v: no metadata changes\n", node->
name);
408 #define _(n) if (b->n) {s = format (s, "%s ", #n); printed = 1;} 413 s =
format (s,
"no vlib_buffer_t metadata changes");
424 s =
format (s,
" vnet_buffer_t: ");
426 #define _(n) if (o->n) {s = format (s, "%s ", #n); printed = 1;} 431 s =
format (s,
"no changes");
437 s =
format (s,
" vnet_buffer2_t: ");
439 #define _(n) if (o2->n) {s = format (s, "%s ", #n); printed = 1;} 443 s =
format (s,
"no changes");
462 if (
unformat (input,
"verbose %=", &verbose, 1))
487 .path =
"show buffer metadata",
488 .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.
#define foreach_primary_metadata_field
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#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)
#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.
static void mdata_trace_callback(vlib_node_runtime_perf_callback_data_t *data, vlib_node_runtime_perf_callback_args_t *args)
Metadata tracking callback before_or_after: 0 => before, 1=> after.
#define VLIB_INIT_FUNCTION(x)
vlib_get_buffers(vm, from, b, n_left_from)
description fragment has unexpected format
#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...)
vnet_main_t * vnet_get_main(void)
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)
#define clib_callback_data_enable_disable(set_, fp_, ena_)
Enable/Disable the specified callback.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u32 node_index
Node index.
static void setup_message_id_table(api_main_t *am)
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
Callback multiplex scheme.
vlib_node_runtime_perf_callback_set_t vlib_node_runtime_perf_callbacks
#define VLIB_CLI_COMMAND(x,...)
#define foreach_opaque_metadata_field
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static mdata_t mdata_none
static u32 vlib_get_n_threads()
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static clib_error_t * mdata_init(vlib_main_t *vm)
u32 node_index
Node index, ~0 means no data from this run.
static vlib_main_t * vlib_get_main_by_index(u32 thread_index)
#define foreach_opaque2_metadata_field
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t * node
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_node_runtime_perf_call_type_t call_type
static vlib_thread_main_t * vlib_get_thread_main()
vlib_node_runtime_t * node
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
mdata_t * modifies
Modified metadata by node.
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)
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
buffer metadata change tracker definitions