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;
162 (&
vlib_mains[i]->vlib_node_runtime_perf_callbacks,
175 int enable_disable = 1;
219 .path =
"buffer metadata tracking",
220 .short_help =
"buffer metadata tracking [on][off]",
229 vl_api_mdata_enable_disable_reply_t *rmp;
239 #include <mdata/mdata.api.c> 261 .version = VPP_BUILD_VER,
262 .description =
"Buffer metadata change tracker." 267 #define foreach_primary_metadata_field \ 273 _(buffer_pool_index) \ 276 _(current_config_index) \ 279 #define foreach_opaque_metadata_field \ 285 _(feature_arc_index) \ 289 _(ip.save_protocol) \ 294 _(ip.reass.next_index) \ 295 _(ip.reass.error_next_index) \ 296 _(ip.reass.owner_thread_index) \ 297 _(ip.reass.ip_proto) \ 298 _(ip.reass.l4_src_port) \ 299 _(ip.reass.l4_dst_port) \ 300 _(ip.reass.estimated_mtu) \ 301 _(ip.reass.fragment_first) \ 302 _(ip.reass.fragment_last) \ 303 _(ip.reass.range_first) \ 304 _(ip.reass.range_last) \ 305 _(ip.reass.next_range_bi) \ 306 _(ip.reass.ip6_frag_hdr_offset) \ 310 _(mpls.save_rewrite_length) \ 311 _(mpls.mpls_hdr_length) \ 312 _(mpls.bier.n_bytes) \ 313 _(l2.feature_bitmap) \ 320 _(l2t.session_index) \ 321 _(l2_classify.table_index) \ 322 _(l2_classify.opaque_index) \ 323 _(l2_classify.hash) \ 326 _(ipsec.protect_index) \ 328 _(map_t.map_domain_index) \ 331 _(map_t.v6.frag_offset) \ 332 _(map_t.v6.l4_offset) \ 333 _(map_t.v6.l4_protocol) \ 334 _(map_t.checksum_offset) \ 337 _(ip_frag.next_index) \ 339 _(cop.current_config_index) \ 340 _(lisp.overlay_afi) \ 341 _(tcp.connection_index) \ 343 _(tcp.next_node_opaque) \ 352 #define foreach_opaque2_metadata_field \ 360 _(pg_replay_timestamp) 366 int verbose = va_arg (*args,
int);
386 s =
format (s,
"\n%v: no data\n", node->
name);
393 if (modifies->
mdata[j])
396 s =
format (s,
"\n%v: no metadata changes\n", node->
name);
407 #define _(n) if (b->n) {s = format (s, "%s ", #n); printed = 1;} 412 s =
format (s,
"no vlib_buffer_t metadata changes");
423 s =
format (s,
" vnet_buffer_t: ");
425 #define _(n) if (o->n) {s = format (s, "%s ", #n); printed = 1;} 430 s =
format (s,
"no changes");
436 s =
format (s,
" vnet_buffer2_t: ");
438 #define _(n) if (o2->n) {s = format (s, "%s ", #n); printed = 1;} 442 s =
format (s,
"no changes");
461 if (
unformat (input,
"verbose %=", &verbose, 1))
486 .path =
"show buffer metadata",
487 .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.
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)
#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)
#define clib_callback_data_enable_disable(set_, fp_, ena_)
Enable/Disable the specified callback.
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
Callback multiplex scheme.
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 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_main_t vlib_node_runtime_t vlib_frame_t * frame
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.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
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