diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2018-08-14 18:52:30 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2018-08-14 18:53:17 +0100 |
commit | b63264c8342e6a1b6971c79550d2af2024b6a4de (patch) | |
tree | 83114aac64286fe616506c0b3dfaec2ab86ef835 /test/test/test_memory.c | |
parent | ca33590b6af032bff57d9cc70455660466a654b2 (diff) |
New upstream version 18.08upstream/18.08
Change-Id: I32fdf5e5016556d9c0a6d88ddaf1fc468961790a
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'test/test/test_memory.c')
-rw-r--r-- | test/test/test_memory.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/test/test/test_memory.c b/test/test/test_memory.c index 972321f1..b96bca77 100644 --- a/test/test/test_memory.c +++ b/test/test/test_memory.c @@ -5,8 +5,11 @@ #include <stdio.h> #include <stdint.h> +#include <rte_eal.h> +#include <rte_eal_memconfig.h> #include <rte_memory.h> #include <rte_common.h> +#include <rte_memzone.h> #include "test.h" @@ -23,12 +26,21 @@ */ static int +check_mem(const struct rte_memseg_list *msl __rte_unused, + const struct rte_memseg *ms, void *arg __rte_unused) +{ + volatile uint8_t *mem = (volatile uint8_t *) ms->addr; + size_t i, max = ms->len; + + for (i = 0; i < max; i++, mem++) + *mem; + return 0; +} + +static int test_memory(void) { uint64_t s; - unsigned i; - size_t j; - const struct rte_memseg *mem; /* * dump the mapped memory: the python-expect script checks @@ -45,14 +57,7 @@ test_memory(void) } /* try to read memory (should not segfault) */ - mem = rte_eal_get_physmem_layout(); - for (i = 0; i < RTE_MAX_MEMSEG && mem[i].addr != NULL ; i++) { - - /* check memory */ - for (j = 0; j<mem[i].len; j++) { - *((volatile uint8_t *) mem[i].addr + j); - } - } + rte_memseg_walk(check_mem, NULL); return 0; } |