]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/test/test/test_memory.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
9 #include <rte_eal_memconfig.h>
10 #include <rte_memory.h>
11 #include <rte_common.h>
12 #include <rte_memzone.h>
20 * - Dump the mapped memory. The python-expect script checks that at
21 * least one line is dumped.
23 * - Check that memory size is different than 0.
25 * - Try to read all memory; it should not segfault.
29 check_mem(const struct rte_memseg_list
*msl __rte_unused
,
30 const struct rte_memseg
*ms
, void *arg __rte_unused
)
32 volatile uint8_t *mem
= (volatile uint8_t *) ms
->addr
;
33 size_t i
, max
= ms
->len
;
35 for (i
= 0; i
< max
; i
++, mem
++)
46 * dump the mapped memory: the python-expect script checks
47 * that at least one line is dumped
49 printf("Dump memory layout\n");
50 rte_dump_physmem_layout(stdout
);
52 /* check that memory size is != 0 */
53 s
= rte_eal_get_physmem_size();
55 printf("No memory detected\n");
59 /* try to read memory (should not segfault) */
60 rte_memseg_walk(check_mem
, NULL
);
65 REGISTER_TEST_COMMAND(memory_autotest
, test_memory
);