aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-03-05 03:46:40 -0800
committerDamjan Marion <dmarion@me.com>2019-03-06 11:39:16 +0000
commita79271fad186e806060e73131d9128bd9d7ea6a4 (patch)
treea35a4c7eb79203b0f5794088e1667aff3a1dea0a
parent55333d76c6501e78ed234a81301e844edc1863b2 (diff)
span: migrate old MULTIARCH macros to VLIB_NODE_FN
Change-Id: I5c671d8af8d528eae625001d4755db8ef61f00b2 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--src/vnet/CMakeLists.txt4
-rw-r--r--src/vnet/span/node.c43
2 files changed, 17 insertions, 30 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 949749228b9..54e8c8ddcb4 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -948,6 +948,10 @@ list(APPEND VNET_SOURCES
span/node.c
)
+list(APPEND VNET_MULTIARCH_SOURCES
+ span/node.c
+)
+
list(APPEND VNET_HEADERS
span/span.h
)
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c
index 67f1d6e42bb..a70dac769c8 100644
--- a/src/vnet/span/node.c
+++ b/src/vnet/span/node.c
@@ -25,10 +25,8 @@
#include <vppinfra/error.h>
#include <vppinfra/elog.h>
-vlib_node_registration_t span_node;
-
/* packet trace format function */
-u8 *
+static u8 *
format_span_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -136,7 +134,6 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
span_main_t *sm = &span_main;
vnet_main_t *vnm = &vnet_main;
u32 n_left_from, *from, *to_next;
- u32 n_span_packets = 0;
u32 next_index;
u32 sw_if_index;
static __thread vlib_frame_t **mirror_frames = 0;
@@ -267,36 +264,32 @@ span_node_inline_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_put_frame_to_sw_interface (vnm, sw_if_index, f);
mirror_frames[sw_if_index] = 0;
}
- vlib_node_increment_counter (vm, span_node.index, SPAN_ERROR_HITS,
- n_span_packets);
return frame->n_vectors;
}
-static uword
-span_device_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_RX, SPAN_FEAT_DEVICE);
}
-static uword
-span_device_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_output_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_TX, SPAN_FEAT_DEVICE);
}
-static uword
-span_l2_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_l2_input_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_RX, SPAN_FEAT_L2);
}
-static uword
-span_l2_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (span_l2_output_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return span_node_inline_fn (vm, node, frame, VLIB_TX, SPAN_FEAT_L2);
}
@@ -315,36 +308,25 @@ span_l2_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (span_input_node) = {
span_node_defs,
- .function = span_device_input_node_fn,
.name = "span-input",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_input_node, span_device_input_node_fn)
-
VLIB_REGISTER_NODE (span_output_node) = {
span_node_defs,
- .function = span_device_output_node_fn,
.name = "span-output",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_output_node, span_device_output_node_fn)
-
VLIB_REGISTER_NODE (span_l2_input_node) = {
span_node_defs,
- .function = span_l2_input_node_fn,
.name = "span-l2-input",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_l2_input_node, span_l2_input_node_fn)
-
VLIB_REGISTER_NODE (span_l2_output_node) = {
span_node_defs,
- .function = span_l2_output_node_fn,
.name = "span-l2-output",
};
-VLIB_NODE_FUNCTION_MULTIARCH (span_l2_output_node, span_l2_output_node_fn)
-
+#ifndef CLIB_MARCH_VARIANT
clib_error_t *span_init (vlib_main_t * vm)
{
span_main_t *sm = &span_main;
@@ -369,6 +351,7 @@ clib_error_t *span_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (span_init);
/* *INDENT-ON* */
+#endif /* CLIB_MARCH_VARIANT */
#undef span_node_defs
/*
le.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * trace.h: VLIB trace buffer.
 *
 * Copyright (c) 2008 Eliot Dresselhaus
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef included_vlib_trace_h
#define included_vlib_trace_h

#include <vppinfra/pool.h>

typedef struct
{
  /* CPU time stamp trace was made. */
  u64 time;

  /* Node which generated this trace. */
  u32 node_index;

  /* Number of data words in this trace. */
  u32 n_data;

  /* Trace data follows. */
  u8 data[0];
} vlib_trace_header_t;

typedef struct
{
  /* Current number of traces in buffer. */
  u32 count;

  /* Max. number of traces to be added to buffer. */
  u32 limit;
} vlib_trace_node_t;

typedef struct
{
  /* Pool of trace buffers. */
  vlib_trace_header_t **trace_buffer_pool;

  u32 last_main_loop_count;
  u32 filter_node_index;
  u32 filter_flag;
#define FILTER_FLAG_NONE    0
#define FILTER_FLAG_INCLUDE 1
#define FILTER_FLAG_EXCLUDE 2
  u32 filter_count;

  /* set on trace add, cleared on clear trace */
  u32 trace_active_hint;

  /* Per node trace counts. */
  vlib_trace_node_t *nodes;

  /* verbosity */
  int verbose;
} vlib_trace_main_t;

#endif /* included_vlib_trace_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */