aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/node.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-16 11:32:09 +0100
committerDave Barach <openvpp@barachs.net>2017-03-16 13:06:27 +0000
commite9f929b52ddb741ec1e4cb2d92c6be1e798933a0 (patch)
tree1843d4798292dbd17d27ad3fab3c833388eaaf62 /src/vlib/node.h
parent3cc4971882235a539bc6177e8e4b4d92129b3a12 (diff)
vlib: make runtime_data thread-local
Change-Id: I4aa3e7e42fb81211de1aed07dc7befee87a1e18b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/node.h')
-rw-r--r--src/vlib/node.h81
1 files changed, 42 insertions, 39 deletions
diff --git a/src/vlib/node.h b/src/vlib/node.h
index b624e9d636d..2a532cc3988 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -411,65 +411,68 @@ typedef struct
typedef struct vlib_node_runtime_t
{
- CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- /* Node function to call. */
- vlib_node_function_t *function;
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); /**< cacheline mark */
- /* Vector of errors for this node. */
- vlib_error_t *errors;
+ vlib_node_function_t *function; /**< Node function to call. */
- /* Number of clock cycles. */
- u32 clocks_since_last_overflow;
+ vlib_error_t *errors; /**< Vector of errors for this node. */
- /* Maximum clock cycle for an invocation. */
- u32 max_clock;
+ u32 clocks_since_last_overflow; /**< Number of clock cycles. */
- /* Number of vectors in the recorded max_clock. */
- u32 max_clock_n;
+ u32 max_clock; /**< Maximum clock cycle for an
+ invocation. */
- /* Number of calls. */
- u32 calls_since_last_overflow;
+ u32 max_clock_n; /**< Number of vectors in the recorded
+ max_clock. */
- /* Number of vector elements processed by this node. */
- u32 vectors_since_last_overflow;
+ u32 calls_since_last_overflow; /**< Number of calls. */
- /* Start of next frames for this node. */
- u32 next_frame_index;
+ u32 vectors_since_last_overflow; /**< Number of vector elements
+ processed by this node. */
- /* Node index. */
- u32 node_index;
+ u32 next_frame_index; /**< Start of next frames for this
+ node. */
- /* For input nodes: decremented on each main loop interation until it reaches zero
- and function is called. Allows some input nodes to be called
- more than others. */
- u32 input_main_loops_per_call;
+ u32 node_index; /**< Node index. */
- /* Saved main loop counter of last dispatch of this node. */
- u32 main_loop_count_last_dispatch;
+ u32 input_main_loops_per_call; /**< For input nodes: decremented
+ on each main loop interation until
+ it reaches zero and function is
+ called. Allows some input nodes to
+ be called more than others. */
+
+ u32 main_loop_count_last_dispatch; /**< Saved main loop counter of last
+ dispatch of this node. */
u32 main_loop_vector_stats[2];
- /* Copy of main node flags. */
- u16 flags;
+ u16 flags; /**< Copy of main node flags. */
- /* Input node state. */
- u16 state;
+ u16 state; /**< Input node state. */
u16 n_next_nodes;
- /* Next frame index that vector arguments were last enqueued to
- last time this node ran. Set to zero before first run
- of this node. */
- u16 cached_next_index;
-
- /* CPU this node runs on */
- u16 cpu_index;
-
- /* Function dependent node-runtime. */
- u8 runtime_data[0];
+ u16 cached_next_index; /**< Next frame index that vector
+ arguments were last enqueued to
+ last time this node ran. Set to
+ zero before first run of this
+ node. */
+
+ u16 cpu_index; /**< CPU this node runs on */
+
+ u8 runtime_data[0]; /**< Function dependent
+ node-runtime data. This data is
+ thread local, and it is not
+ cloned from main thread. It needs
+ to be initialized for each thread
+ before it is used unless
+ runtime_data template exists in
+ vlib_node_t. */
}
vlib_node_runtime_t;
+#define VLIB_NODE_RUNTIME_DATA_SIZE (sizeof (vlib_node_runtime_t) - STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data))
+
typedef struct
{
/* Number of allocated frames for this scalar/vector size. */