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 70 if (before_or_after == 1 )
80 while (n_left_from > 0)
110 while (n_left_from > 0)
118 if (before->
mdata[i] != after[i])
119 modifies->
mdata[
i] = 0xff;
155 (
vlib_mains[i]->vlib_node_runtime_perf_counter_cbs,
156 vlib_mains[i]->vlib_node_runtime_perf_counter_cb_tmp,
157 vlib_mains[i]->worker_thread_main_loop_callback_lock,
170 int enable_disable = 1;
214 .path =
"buffer metadata tracking",
215 .short_help =
"buffer metadata tracking [on][off]",
224 vl_api_mdata_enable_disable_reply_t *rmp;
234 #include <mdata/mdata.api.c> 256 .version = VPP_BUILD_VER,
257 .description =
"Buffer metadata change tracker." 262 #define foreach_primary_metadata_field \ 268 _(buffer_pool_index) \ 271 _(current_config_index) \ 274 #define foreach_opaque_metadata_field \ 280 _(feature_arc_index) \ 284 _(ip.save_protocol) \ 289 _(ip.reass.next_index) \ 290 _(ip.reass.error_next_index) \ 291 _(ip.reass.owner_thread_index) \ 292 _(ip.reass.ip_proto) \ 293 _(ip.reass.l4_src_port) \ 294 _(ip.reass.l4_dst_port) \ 295 _(ip.reass.estimated_mtu) \ 296 _(ip.reass.fragment_first) \ 297 _(ip.reass.fragment_last) \ 298 _(ip.reass.range_first) \ 299 _(ip.reass.range_last) \ 300 _(ip.reass.next_range_bi) \ 301 _(ip.reass.ip6_frag_hdr_offset) \ 305 _(mpls.save_rewrite_length) \ 306 _(mpls.mpls_hdr_length) \ 307 _(mpls.bier.n_bytes) \ 308 _(l2.feature_bitmap) \ 315 _(l2t.session_index) \ 316 _(l2_classify.table_index) \ 317 _(l2_classify.opaque_index) \ 318 _(l2_classify.hash) \ 321 _(ipsec.protect_index) \ 323 _(map_t.map_domain_index) \ 326 _(map_t.v6.frag_offset) \ 327 _(map_t.v6.l4_offset) \ 328 _(map_t.v6.l4_protocol) \ 329 _(map_t.checksum_offset) \ 332 _(ip_frag.next_index) \ 334 _(cop.current_config_index) \ 335 _(lisp.overlay_afi) \ 336 _(tcp.connection_index) \ 338 _(tcp.next_node_opaque) \ 347 #define foreach_opaque2_metadata_field \ 355 _(pg_replay_timestamp) 361 int verbose = va_arg (*args,
int);
381 s =
format (s,
"\n%v: no data\n", node->
name);
388 if (modifies->
mdata[j])
391 s =
format (s,
"\n%v: no metadata changes\n", node->
name);
402 #define _(n) if (b->n) {s = format (s, "%s ", #n); printed = 1;} 407 s =
format (s,
"no vlib_buffer_t metadata changes");
418 s =
format (s,
" vnet_buffer_t: ");
420 #define _(n) if (o->n) {s = format (s, "%s ", #n); printed = 1;} 425 s =
format (s,
"no changes");
431 s =
format (s,
" vnet_buffer2_t: ");
433 #define _(n) if (o2->n) {s = format (s, "%s ", #n); printed = 1;} 437 s =
format (s,
"no changes");
456 if (
unformat (input,
"verbose %=", &verbose, 1))
481 .path =
"show buffer metadata",
482 .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.
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
#define foreach_opaque_metadata_field
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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)