From c74b43c80789f5e437dfe4cc491157b45a7f222e Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Thu, 9 Apr 2020 17:24:07 -0400 Subject: buffers: configurable buffer fault injector When configured at compile time via the cmake VPP_BUFFER_FAULT_INJECTOR option, the buffer allocator will appear to fail a certain fraction of the time. By default, the allocator succeeds 80% of the time. Detailed command line configuration options are available, but only when the image has been compiled with cmake option described above: vlib { buffer-alloc-success-rate [0.0 ... 1.0] buffer-alloc-success-seed } Modify vlib_buffer_pool_create(...) so 0 is always an invalid buffer index. Debug images: add checks for bad buffer index enqueues, and also verify that f->n_vectors doesn't accidentally map one or more instances of the frame poison pattern 0xfefefefe. Type: improvement Signed-off-by: Dave Barach Change-Id: Iab939858014463d1e664682805013d334d6fcbe5 --- src/vlib/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/vlib/CMakeLists.txt') diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt index c2a0d63f4d8..67d1f6d05c7 100644 --- a/src/vlib/CMakeLists.txt +++ b/src/vlib/CMakeLists.txt @@ -11,9 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +option(VPP_BUFFER_FAULT_INJECTOR "Include the buffer fault injector" OFF) + ############################################################################## # Generate vlib/config.h ############################################################################## +if(VPP_BUFFER_FAULT_INJECTOR) + set(BUFFER_ALLOC_FAULT_INJECTOR 1 CACHE STRING "fault injector on") +else() + set(BUFFER_ALLOC_FAULT_INJECTOR 0 CACHE STRING "fault injector off") +endif() + set(PRE_DATA_SIZE 128 CACHE STRING "Buffer headroom size.") configure_file( ${CMAKE_SOURCE_DIR}/vlib/config.h.in -- cgit 1.2.3-korg