buffers: add compile-time option to set buffer alignment
Type: improvement Change-Id: I88c4c45bed0bdd8686e17e4f77a7d32a08c995aa Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
5840c66bbc
commit
038dad7ef2
@ -1,3 +1,4 @@
|
||||
|
||||
set(VPP_PLATFORM_CACHE_LINE_SIZE 64)
|
||||
set(VPP_PLATFORM_MARCH_FLAGS -march=armv8.3-a+crypto+sve2-bitperm)
|
||||
set(VPP_PLATFORM_BUFFER_ALIGN 128)
|
||||
|
@ -22,6 +22,12 @@ else()
|
||||
set(BUFFER_ALLOC_FAULT_INJECTOR 0 CACHE STRING "fault injector off")
|
||||
endif()
|
||||
|
||||
if(VPP_PLATFORM_BUFFER_ALIGN)
|
||||
set(VLIB_BUFFER_ALIGN ${VPP_PLATFORM_BUFFER_ALIGN})
|
||||
else()
|
||||
set(VLIB_BUFFER_ALIGN ${VPP_CACHE_LINE_SIZE})
|
||||
endif()
|
||||
|
||||
set(PRE_DATA_SIZE 128 CACHE STRING "Buffer headroom size.")
|
||||
|
||||
if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
|
||||
|
@ -471,11 +471,7 @@ static uword
|
||||
vlib_buffer_alloc_size (uword ext_hdr_size, uword data_size)
|
||||
{
|
||||
uword alloc_size = ext_hdr_size + sizeof (vlib_buffer_t) + data_size;
|
||||
alloc_size = CLIB_CACHE_LINE_ROUND (alloc_size);
|
||||
|
||||
/* in case when we have even number of cachelines, we add one more for
|
||||
* better cache occupancy */
|
||||
alloc_size |= CLIB_CACHE_LINE_BYTES;
|
||||
alloc_size = round_pow2 (alloc_size, VLIB_BUFFER_ALIGN);
|
||||
|
||||
return alloc_size;
|
||||
}
|
||||
|
@ -47,8 +47,7 @@
|
||||
#include <vppinfra/lock.h>
|
||||
#include <vlib/error.h> /* for vlib_error_t */
|
||||
|
||||
#include <vlib/config.h> /* for __PRE_DATA_SIZE */
|
||||
#define VLIB_BUFFER_PRE_DATA_SIZE __PRE_DATA_SIZE
|
||||
#include <vlib/config.h> /* for VLIB_BUFFER_PRE_DATA_SIZE */
|
||||
|
||||
#define VLIB_BUFFER_DEFAULT_DATA_SIZE (2048)
|
||||
|
||||
|
@ -16,7 +16,8 @@
|
||||
#ifndef included_vlib_config_h
|
||||
#define included_vlib_config_h
|
||||
|
||||
#define __PRE_DATA_SIZE @PRE_DATA_SIZE@
|
||||
#define VLIB_BUFFER_PRE_DATA_SIZE @PRE_DATA_SIZE@
|
||||
#define VLIB_BUFFER_ALIGN @VLIB_BUFFER_ALIGN@
|
||||
#define VLIB_BUFFER_ALLOC_FAULT_INJECTOR @BUFFER_ALLOC_FAULT_INJECTOR@
|
||||
#define VLIB_PROCESS_LOG2_STACK_SIZE @VLIB_PROCESS_LOG2_STACK_SIZE@
|
||||
|
||||
|
Reference in New Issue
Block a user