diff options
author | Dave Barach <dave@barachs.net> | 2019-12-04 17:19:12 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-12-05 15:31:57 +0000 |
commit | 87d24db65facb89ca524c951b8379ca2ec4dbc7a (patch) | |
tree | bfc7ca3b5abe0b55277e6447cd23f1d779d92b1c /src/vlib/trace_funcs.h | |
parent | 17478e4eb81d384f171ca27c9110a051cd434f16 (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_funcs.h')
-rw-r--r-- | src/vlib/trace_funcs.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vlib/trace_funcs.h b/src/vlib/trace_funcs.h index 257c3a3a4ff..4261f675aec 100644 --- a/src/vlib/trace_funcs.h +++ b/src/vlib/trace_funcs.h @@ -61,6 +61,9 @@ vlib_add_trace (vlib_main_t * vm, ASSERT (vnet_trace_dummy); + if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_IS_TRACED) == 0)) + return vnet_trace_dummy; + if (PREDICT_FALSE (tm->add_trace_callback != 0)) { return tm->add_trace_callback ((struct vlib_main_t *) vm, @@ -118,6 +121,9 @@ vlib_trace_next_frame (vlib_main_t * vm, } void trace_apply_filter (vlib_main_t * vm); +int vnet_is_packet_traced (vlib_buffer_t * b, + u32 classify_table_index, int func); + /* Mark buffer as traced and allocate trace buffer. */ always_inline void @@ -131,6 +137,16 @@ vlib_trace_buffer (vlib_main_t * vm, if (PREDICT_FALSE (tm->trace_enable == 0)) return; + /* Classifier filter in use? */ + if (PREDICT_FALSE (vlib_global_main.trace_filter.trace_filter_enable)) + { + /* See if we're supposed to trace this packet... */ + if (vnet_is_packet_traced + (b, vlib_global_main.trace_filter.trace_classify_table_index, + 0 /* full classify */ ) != 1) + return; + } + /* * Apply filter to existing traces to keep number of allocated traces low. * Performed each time around the main loop. |