diff options
-rw-r--r-- | vlib/vlib/node.c | 5 | ||||
-rw-r--r-- | vlib/vlib/node.h | 7 | ||||
-rw-r--r-- | vlib/vlib/node_funcs.h | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c index 69bb07f6e41..fccc37ab7b9 100644 --- a/vlib/vlib/node.c +++ b/vlib/vlib/node.c @@ -433,7 +433,10 @@ register_node (vlib_main_t * vm, vlib_node_registration_t * r) for (i = 0; i < vec_len (rt->errors); i++) rt->errors[i] = vlib_error_set (n->index, i); - ASSERT (vec_len (n->runtime_data) <= sizeof (rt->runtime_data)); + ASSERT (sizeof (vlib_node_runtime_t) == 2 * CLIB_CACHE_LINE_BYTES); + ASSERT (vec_len (n->runtime_data) <= sizeof (vlib_node_runtime_t) - + STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data)); + if (vec_len (n->runtime_data) > 0) clib_memcpy (rt->runtime_data, n->runtime_data, vec_len (n->runtime_data)); diff --git a/vlib/vlib/node.h b/vlib/vlib/node.h index 795856e6d7f..b624e9d636d 100644 --- a/vlib/vlib/node.h +++ b/vlib/vlib/node.h @@ -411,6 +411,7 @@ typedef struct typedef struct vlib_node_runtime_t { + CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); /* Node function to call. */ vlib_node_function_t *function; @@ -465,11 +466,7 @@ typedef struct vlib_node_runtime_t u16 cpu_index; /* Function dependent node-runtime. */ - uword runtime_data[(128 - - 1 * sizeof (vlib_node_function_t *) - - 1 * sizeof (vlib_error_t *) - - 11 * sizeof (u32) - - 5 * sizeof (u16)) / sizeof (uword)]; + u8 runtime_data[0]; } vlib_node_runtime_t; diff --git a/vlib/vlib/node_funcs.h b/vlib/vlib/node_funcs.h index bd199fa52f4..2116739602e 100644 --- a/vlib/vlib/node_funcs.h +++ b/vlib/vlib/node_funcs.h @@ -130,7 +130,9 @@ vlib_node_set_runtime_data (vlib_main_t * vm, u32 node_index, vec_free (n->runtime_data); vec_add (n->runtime_data, runtime_data, n_runtime_data_bytes); - ASSERT (vec_len (n->runtime_data) <= sizeof (r->runtime_data)); + ASSERT (vec_len (n->runtime_data) <= sizeof (vlib_node_runtime_t) - + STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data)); + if (vec_len (n->runtime_data) > 0) clib_memcpy (r->runtime_data, n->runtime_data, vec_len (n->runtime_data)); } |