MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_mem

Function check_mem

dpdk/app/test/test_external_mem.c:37–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#define EXTERNAL_MEM_SZ (RTE_PGSIZE_4K << 10) /* 4M of data */
36
37static int
38check_mem(void *addr, rte_iova_t *iova, size_t pgsz, int n_pages)
39{
40 int i;
41
42 /* check that we can get this memory from EAL now */
43 for (i = 0; i < n_pages; i++) {
44 const struct rte_memseg_list *msl;
45 const struct rte_memseg *ms;
46 void *cur = RTE_PTR_ADD(addr, pgsz * i);
47 rte_iova_t expected_iova;
48
49 msl = rte_mem_virt2memseg_list(cur);
50 if (!msl->external) {
51 printf("%s():%i: Memseg list is not marked as external\n",
52 __func__, __LINE__);
53 return -1;
54 }
55
56 ms = rte_mem_virt2memseg(cur, msl);
57 if (ms == NULL) {
58 printf("%s():%i: Failed to retrieve memseg for external mem\n",
59 __func__, __LINE__);
60 return -1;
61 }
62 if (ms->addr != cur) {
63 printf("%s():%i: VA mismatch\n", __func__, __LINE__);
64 return -1;
65 }
66 expected_iova = (iova == NULL) ? RTE_BAD_IOVA : iova[i];
67 if (ms->iova != expected_iova) {
68 printf("%s():%i: IOVA mismatch\n", __func__, __LINE__);
69 return -1;
70 }
71 }
72 return 0;
73}
74
75static int
76test_malloc_invalid_param(void *addr, size_t len, size_t pgsz, rte_iova_t *iova,

Callers 2

test_malloc_basicFunction · 0.70
test_extmem_basicFunction · 0.70

Calls 3

rte_mem_virt2memseg_listFunction · 0.85
rte_mem_virt2memsegFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected