summaryrefslogtreecommitdiffstats
path: root/src/vlib/trace.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-12-04 17:19:12 -0500
committerFlorin Coras <florin.coras@gmail.com>2019-12-05 15:31:57 +0000
commit87d24db65facb89ca524c951b8379ca2ec4dbc7a (patch)
treebfc7ca3b5abe0b55277e6447cd23f1d779d92b1c /src/vlib/trace.c
parent17478e4eb81d384f171ca27c9110a051cd434f16 (diff)
classify: vpp packet tracer support
Configure n-tuple classifier filters which apply to the vpp packet tracer. Update the documentation to reflect the new feature. Add a test vector. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iefa911716c670fc12e4825b937b62044433fec36
Diffstat (limited to 'src/vlib/trace.c')
-rw-r--r--src/vlib/trace.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/vlib/trace.c b/src/vlib/trace.c
index 530598d349d..7ee1b63f07e 100644
--- a/src/vlib/trace.c
+++ b/src/vlib/trace.c
@@ -351,6 +351,13 @@ VLIB_CLI_COMMAND (show_trace_cli,static) = {
};
/* *INDENT-ON* */
+int vlib_enable_disable_pkt_trace_filter (int enable) __attribute__ ((weak));
+int
+vlib_enable_disable_pkt_trace_filter (int enable)
+{
+ return 0;
+}
+
static clib_error_t *
cli_add_trace_buffer (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -361,6 +368,7 @@ cli_add_trace_buffer (vlib_main_t * vm,
vlib_trace_node_t *tn;
u32 node_index, add;
u8 verbose = 0;
+ int filter = 0;
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
@@ -376,6 +384,8 @@ cli_add_trace_buffer (vlib_main_t * vm,
;
else if (unformat (line_input, "verbose"))
verbose = 1;
+ else if (unformat (line_input, "filter"))
+ filter = 1;
else
{
error = clib_error_create ("expected NODE COUNT, got `%U'",
@@ -395,6 +405,15 @@ cli_add_trace_buffer (vlib_main_t * vm,
goto done;
}
+ if (filter)
+ {
+ if (vlib_enable_disable_pkt_trace_filter (1 /* enable */ ))
+ {
+ error = clib_error_create ("No packet trace filter configured...");
+ goto done;
+ }
+ }
+
/* *INDENT-OFF* */
foreach_vlib_main ((
{
@@ -421,7 +440,6 @@ VLIB_CLI_COMMAND (add_trace_cli,static) = {
};
/* *INDENT-ON* */
-
/*
* Configure a filter for packet traces.
*
@@ -523,6 +541,7 @@ static clib_error_t *
cli_clear_trace_buffer (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ vlib_enable_disable_pkt_trace_filter (0 /* enable */ );
clear_trace_buffer ();
return 0;
}
@@ -541,6 +560,18 @@ vlib_trace_cli_reference (void)
{
}
+int
+vnet_is_packet_traced (vlib_buffer_t * b,
+ u32 classify_table_index, int func)
+__attribute__ ((weak));
+
+int
+vnet_is_packet_traced (vlib_buffer_t * b, u32 classify_table_index, int func)
+{
+ clib_warning ("BUG: STUB called");
+ return 1;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*