summaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-23 16:52:10 +0100
committerDave Barach <openvpp@barachs.net>2019-01-23 19:57:42 +0000
commit9a8a12a06e9e67c4ef339d3002cdc5151341826d (patch)
tree402d9e7a255a4ebe6ab2494262c43d0c17fb4c6c /src/vlib/buffer_funcs.h
parent4222347a87994cc109499ebe67498792c0e705f8 (diff)
buffers: wrap vlib_buffer_t to union and expose vector types
Change-Id: I1c12e2941cae198ededbb65eb5be51a4eabe2c1b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer_funcs.h')
-rw-r--r--src/vlib/buffer_funcs.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 60eb8cde09a..c2241476094 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -70,10 +70,21 @@ vlib_buffer_copy_indices (u32 * dst, u32 * src, u32 n_indices)
clib_memcpy_fast (dst, src, n_indices * sizeof (u32));
}
+STATIC_ASSERT_OFFSET_OF (vlib_buffer_t, template_end, 64);
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));
+#if defined CLIB_HAVE_VEC256
+ b->as_u8x32[0] = bt->as_u8x32[0];
+ b->as_u8x32[1] = bt->as_u8x32[1];
+#elif defined (CLIB_HAVE_VEC128)
+ b->as_u8x16[0] = bt->as_u8x16[0];
+ b->as_u8x16[1] = bt->as_u8x16[1];
+ b->as_u8x16[2] = bt->as_u8x16[2];
+ b->as_u8x16[3] = bt->as_u8x16[3];
+#else
+ clib_memcpy_fast (b, bt, 64);
+#endif
}
/** \brief Translate array of buffer indices into buffer pointers with offset