octeon: enable ethernet pause frame support
[vpp.git] / src / vnet / ethernet / p2p_ethernet_input.c
index 2cae97d..3d81e99 100644 (file)
 #include <vppinfra/error.h>
 #include <vppinfra/elog.h>
 
-vlib_node_registration_t p2p_ethernet_input_node;
+extern vlib_node_registration_t p2p_ethernet_input_node;
 
 /* packet trace format function */
-u8 *
+static u8 *
 format_p2p_ethernet_trace (u8 * s, va_list * args)
 {
   CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -59,9 +59,9 @@ static char *p2p_ethernet_error_strings[] = {
 #undef _
 };
 
-static uword
-p2p_ethernet_input_node_fn (vlib_main_t * vm,
-                           vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (p2p_ethernet_input_node) (vlib_main_t * vm,
+                                       vlib_node_runtime_t * node,
+                                       vlib_frame_t * frame)
 {
   u32 thread_index = vm->thread_index;
   u32 n_trace = vlib_get_trace_count (vm, node);
@@ -119,11 +119,12 @@ p2p_ethernet_input_node_fn (vlib_main_t * vm,
              vnet_buffer (b0)->sw_if_index[VLIB_RX] = rx0;
              n_p2p_ethernet_packets += 1;
 
-             if (PREDICT_FALSE (n_trace > 0))
+             if (PREDICT_FALSE
+                 (n_trace > 0
+                  && vlib_trace_buffer (vm, node, next_index, b0,
+                                        1 /* follow_chain */ )))
                {
                  p2p_ethernet_trace_t *t0;
-                 vlib_trace_buffer (vm, node, next_index, b0,
-                                    1 /* follow_chain */ );
                  vlib_set_trace_count (vm, node, --n_trace);
                  t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
                  t0->sw_if_index = sw_if_index0;
@@ -140,11 +141,12 @@ p2p_ethernet_input_node_fn (vlib_main_t * vm,
              vnet_buffer (b1)->sw_if_index[VLIB_RX] = rx1;
              n_p2p_ethernet_packets += 1;
 
-             if (PREDICT_FALSE (n_trace > 0))
+             if (PREDICT_FALSE
+                 (n_trace > 0
+                  && vlib_trace_buffer (vm, node, next_index, b1,
+                                        1 /* follow_chain */ )))
                {
                  p2p_ethernet_trace_t *t1;
-                 vlib_trace_buffer (vm, node, next_index, b1,
-                                    1 /* follow_chain */ );
                  vlib_set_trace_count (vm, node, --n_trace);
                  t1 = vlib_add_trace (vm, node, b1, sizeof (*t1));
                  t1->sw_if_index = sw_if_index1;
@@ -195,11 +197,12 @@ p2p_ethernet_input_node_fn (vlib_main_t * vm,
              vnet_buffer (b0)->sw_if_index[VLIB_RX] = rx0;
              n_p2p_ethernet_packets += 1;
 
-             if (PREDICT_FALSE (n_trace > 0))
+             if (PREDICT_FALSE
+                 (n_trace > 0
+                  && vlib_trace_buffer (vm, node, next_index, b0,
+                                        1 /* follow_chain */ )))
                {
                  p2p_ethernet_trace_t *t0;
-                 vlib_trace_buffer (vm, node, next_index, b0,
-                                    1 /* follow_chain */ );
                  vlib_set_trace_count (vm, node, --n_trace);
                  t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
                  t0->sw_if_index = sw_if_index0;
@@ -228,16 +231,16 @@ p2p_ethernet_input_node_fn (vlib_main_t * vm,
 
   vlib_node_increment_counter (vm, p2p_ethernet_input_node.index,
                               P2PE_ERROR_HITS, n_p2p_ethernet_packets);
+
   return frame->n_vectors;
 }
 
-/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (p2p_ethernet_input_node) = {
-  .function = p2p_ethernet_input_node_fn,
   .name = "p2p-ethernet-input",
   .vector_size = sizeof (u32),
   .format_trace = format_p2p_ethernet_trace,
   .type = VLIB_NODE_TYPE_INTERNAL,
+  .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
 
   .n_errors = ARRAY_LEN(p2p_ethernet_error_strings),
   .error_strings = p2p_ethernet_error_strings,
@@ -249,10 +252,7 @@ VLIB_REGISTER_NODE (p2p_ethernet_input_node) = {
     [0] = "error-drop",
   },
 };
-/* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (p2p_ethernet_input_node,
-                             p2p_ethernet_input_node_fn)
 /*
  * fd.io coding-style-patch-verification: ON
  *