vlib: fix trace number accounting
[vpp.git] / src / vnet / unix / tuntap.c
index 9d6f899..6834ee8 100644 (file)
@@ -378,11 +378,9 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 
     vlib_set_next_frame_buffer (vm, node, next_index, bi);
 
-    if (n_trace > 0)
-      {
-       vlib_trace_buffer (vm, node, next_index, b, /* follow_chain */ 1);
-       vlib_set_trace_count (vm, node, n_trace - 1);
-      }
+    if (PREDICT_FALSE (n_trace > 0 && vlib_trace_buffer (vm, node, next_index, b,      /* follow_chain */
+                                                        1)))
+      vlib_set_trace_count (vm, node, n_trace - 1);
   }
 
   return 1;
@@ -398,6 +396,7 @@ static char *tuntap_rx_error_strings[] = {
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (tuntap_rx_node,static) = {
   .function = tuntap_rx,
+  .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
   .name = "tuntap-rx",
   .sibling_of = "device-input",
   .type = VLIB_NODE_TYPE_INPUT,