summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-09-24 18:10:49 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-03 08:42:13 +0000
commit29dc11bde26a38025f6f77d534ea7bd58cbce0d6 (patch)
tree2893c949b29a75510aff8ca1f972f675086a0c1b /src/vlib
parentc0552134ed3008481713ad55968f6fcd9c84afbc (diff)
vlib: add flag to explicitelly mark nodes which can init per-node packet trace
Type: feature Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 7ca5aaac10e95306f74ea4afd52110dd46aa0381)
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/handoff_trace.c1
-rw-r--r--src/vlib/node.h1
-rw-r--r--src/vlib/trace.c12
3 files changed, 14 insertions, 0 deletions
diff --git a/src/vlib/handoff_trace.c b/src/vlib/handoff_trace.c
index 7a6743885da..fcb514bd837 100644
--- a/src/vlib/handoff_trace.c
+++ b/src/vlib/handoff_trace.c
@@ -79,6 +79,7 @@ typedef enum
VLIB_REGISTER_NODE (handoff_trace_node, static) =
{
.name = "handoff_trace",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.function = handoff_trace_node_fn,
.vector_size = sizeof (u32),
.format_trace = format_handoff_trace,
diff --git a/src/vlib/node.h b/src/vlib/node.h
index 2db31c68d7f..9f324f79fa4 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -303,6 +303,7 @@ typedef struct vlib_node_t
#define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
#define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
+#define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8)
/* State for input nodes. */
u8 state;
diff --git a/src/vlib/trace.c b/src/vlib/trace.c
index 70621135c68..530598d349d 100644
--- a/src/vlib/trace.c
+++ b/src/vlib/trace.c
@@ -357,6 +357,7 @@ cli_add_trace_buffer (vlib_main_t * vm,
{
unformat_input_t _line_input, *line_input = &_line_input;
vlib_trace_main_t *tm;
+ vlib_node_t *node;
vlib_trace_node_t *tn;
u32 node_index, add;
u8 verbose = 0;
@@ -383,6 +384,17 @@ cli_add_trace_buffer (vlib_main_t * vm,
}
}
+ node = vlib_get_node (vm, node_index);
+
+ if ((node->flags & VLIB_NODE_FLAG_TRACE_SUPPORTED) == 0)
+ {
+ error = clib_error_create ("node '%U' doesn't support per-node "
+ "tracing. There may be another way to "
+ "initiate trace on this node.",
+ format_vlib_node_name, vm, node_index);
+ goto done;
+ }
+
/* *INDENT-OFF* */
foreach_vlib_main ((
{