diff options
author | Benoît Ganne <bganne@cisco.com> | 2020-10-21 11:13:24 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-11-12 12:33:15 +0000 |
commit | b2a92ff3b97c6ae5f84b48e3a77400afaeb43d29 (patch) | |
tree | dd5842fe07cf8d55429c30777f196574018ad0b7 /src | |
parent | 19b477f977b73e67166ec0fc66cc9fb950e30799 (diff) |
svm: fix fifo unit test
- fix fifo initialization overflowing chunk size
- stick to the default base virtual address to initialize fifo. ASAN
can be picky about address space
Type: fix
Change-Id: If9a29138d2c207859d72845e928290c808c4a982
Signed-off-by: Benoît Ganne <bganne@cisco.com>
(cherry picked from commit 07b94558087facbb16c0fa82a79fcbbd9b44c485)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/unittest/svm_fifo_test.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c index f5d4818bfe0..a3f88d35b9c 100644 --- a/src/plugins/unittest/svm_fifo_test.c +++ b/src/plugins/unittest/svm_fifo_test.c @@ -190,11 +190,13 @@ static svm_fifo_t * fifo_prepare (fifo_segment_t * fs, u32 fifo_size) { svm_fifo_t *f; + svm_fifo_chunk_t *c; f = fifo_segment_alloc_fifo (fs, fifo_size, FIFO_SEGMENT_RX_FIFO); - /* Paint fifo data vector with -1's */ - clib_memset (svm_fifo_head_chunk (f)->data, 0xFF, fifo_size); + /* Paint 1st fifo chunk with -1's */ + c = svm_fifo_head_chunk (f); + clib_memset (c->data, 0xFF, c->length); svm_fifo_init_ooo_lookup (f, 1 /* deq ooo */ ); return f; @@ -2726,8 +2728,8 @@ svm_fifo_test (vlib_main_t * vm, unformat_input_t * input, int res = 0; char *str; - clib_warning ("high mem %lu", HIGH_SEGMENT_BASEVA << 1); - fifo_segment_main_init (&segment_main, HIGH_SEGMENT_BASEVA << 1, 5); + clib_warning ("high mem %lu", HIGH_SEGMENT_BASEVA); + fifo_segment_main_init (&segment_main, HIGH_SEGMENT_BASEVA, 5); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "fifo1")) |