aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-18 19:56:09 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-01-18 22:00:27 +0000
commite58041f242bf4bd120ecc9619b88348d80b94c17 (patch)
treef163418c56ef3e76074685900b00b044cc1b49bd /src/vlib
parent865872ebdb2bbaf3f157e2a9889405b84114d2eb (diff)
deprecate clib_memcpy64_x4
Storing buffer in local template seems to be better option.... Change-Id: I1a2fdd68cb956f99a5b36d2cd810fc623e089bcf Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer.h10
-rw-r--r--src/vlib/buffer_funcs.h13
2 files changed, 14 insertions, 9 deletions
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 2c8d5a046a7..68d6c5eb32b 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -104,7 +104,6 @@ enum
typedef struct
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- STRUCT_MARK (template_start);
/* Offset within data[] that we are currently processing.
If negative current header points into predata area. */
i16 current_data; /**< signed offset in data[], pre_data[]
@@ -131,8 +130,6 @@ typedef struct
Only valid if VLIB_BUFFER_NEXT_PRESENT flag is set.
*/
- STRUCT_MARK (template_end);
-
u32 current_config_index; /**< Used by feature subgraph arcs to
visit enabled feature nodes
*/
@@ -146,6 +143,13 @@ typedef struct
u32 opaque[10]; /**< Opaque data used by sub-graphs for their own purposes.
See .../vnet/vnet/buffer.h
*/
+
+ STRUCT_MARK (template_end); /**< part of buffer metadata which is
+ initialized on alloc ends here. It may be
+ different than cacheline on systems with
+ buffer cacheline size */
+
+ /***** end of first cache line */
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
u32 trace_index; /**< Specifies index into trace buffer
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index b561a91c394..8fbb58d68b3 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -64,6 +64,12 @@ vlib_get_buffer (vlib_main_t * vm, u32 buffer_index)
return uword_to_pointer (bm->buffer_mem_start + offset, void *);
}
+static_always_inline void
+vlib_buffer_copy_template (vlib_buffer_t * b, vlib_buffer_t * bt)
+{
+ clib_memcpy_fast (b, bt, STRUCT_OFFSET_OF (vlib_buffer_t, template_end));
+}
+
/** \brief Translate array of buffer indices into buffer pointers with offset
@param vm - (vlib_main_t *) vlib main data structure pointer
@@ -1011,12 +1017,7 @@ vlib_buffer_init_for_free_list (vlib_buffer_t * dst,
CLIB_CACHE_LINE_BYTES * 2);
/* Make sure buffer template is sane. */
- ASSERT (fl->index == vlib_buffer_get_free_list_index (src));
-
- clib_memcpy_fast (STRUCT_MARK_PTR (dst, template_start),
- STRUCT_MARK_PTR (src, template_start),
- STRUCT_OFFSET_OF (vlib_buffer_t, template_end) -
- STRUCT_OFFSET_OF (vlib_buffer_t, template_start));
+ vlib_buffer_copy_template (dst, src);
/* Not in the first 16 octets. */
dst->n_add_refs = src->n_add_refs;