summaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-20 00:11:22 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-01-20 19:24:46 +0000
commit6434430fd593840e463fff0acb8f6b1676fa7bba (patch)
treee4b533efa71fef52b5b30920b5915777f2222b35 /src/vlib/buffer_funcs.h
parentd50e3477635e6cc2592cbf30d4fdcee842053624 (diff)
buffers: don't init metadata, as it is already initialized
Change-Id: Ia083050389853c25b069f0f8286d50d3f4aef527 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer_funcs.h')
-rw-r--r--src/vlib/buffer_funcs.h39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 9095bd3387f..199dad03176 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -967,43 +967,6 @@ vlib_packet_template_free (vlib_main_t * vm, vlib_packet_template_t * t)
vec_free (t->packet_data);
}
-/* Set a buffer quickly into "uninitialized" state. We want this to
- be extremely cheap and arrange for all fields that need to be
- initialized to be in the first 128 bits of the buffer. */
-always_inline void
-vlib_buffer_init_for_free_list (vlib_buffer_t * dst,
- vlib_buffer_free_list_t * fl)
-{
- vlib_buffer_t *src = &fl->buffer_init_template;
-
- /* Make sure vlib_buffer_t is cacheline aligned and sized */
- ASSERT (STRUCT_OFFSET_OF (vlib_buffer_t, cacheline0) == 0);
- ASSERT (STRUCT_OFFSET_OF (vlib_buffer_t, cacheline1) ==
- CLIB_CACHE_LINE_BYTES);
- ASSERT (STRUCT_OFFSET_OF (vlib_buffer_t, cacheline2) ==
- CLIB_CACHE_LINE_BYTES * 2);
-
- /* Make sure buffer template is sane. */
- vlib_buffer_copy_template (dst, src);
-
- /* Not in the first 16 octets. */
- dst->n_add_refs = src->n_add_refs;
-
- /* Make sure it really worked. */
-#define _(f) ASSERT (dst->f == src->f);
- _(current_data);
- _(current_length);
- _(flags);
-#undef _
- /* ASSERT (dst->total_length_not_including_first_buffer == 0); */
- /* total_length_not_including_first_buffer is not in the template anymore
- * so it may actually not zeroed for some buffers. One option is to
- * uncomment the line lower (comes at a cost), the other, is to just not
- * care */
- /* dst->total_length_not_including_first_buffer = 0; */
- ASSERT (dst->n_add_refs == 0);
-}
-
static_always_inline vlib_buffer_pool_t *
vlib_buffer_pool_get (vlib_main_t * vm, u8 buffer_pool_index)
{
@@ -1020,7 +983,7 @@ vlib_buffer_add_to_free_list (vlib_main_t * vm,
vlib_buffer_t *b;
b = vlib_get_buffer (vm, buffer_index);
if (PREDICT_TRUE (do_init))
- vlib_buffer_init_for_free_list (b, f);
+ clib_memset (b, 0, STRUCT_OFFSET_OF (vlib_buffer_t, template_end));
vec_add1_aligned (f->buffers, buffer_index, CLIB_CACHE_LINE_BYTES);
if (vec_len (f->buffers) > 4 * VLIB_FRAME_SIZE)