git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/thunderx: remove libm dependency
[dpdk.git]
/
lib
/
librte_eal
/
common
/
rte_malloc.c
diff --git
a/lib/librte_eal/common/rte_malloc.c
b/lib/librte_eal/common/rte_malloc.c
index
c313a57
..
5c0627b
100644
(file)
--- a/
lib/librte_eal/common/rte_malloc.c
+++ b/
lib/librte_eal/common/rte_malloc.c
@@
-39,7
+39,6
@@
#include <rte_memcpy.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
-#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_branch_prediction.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_branch_prediction.h>
@@
-77,6
+76,9
@@
rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)
if (size == 0 || (align && !rte_is_power_of_2(align)))
return NULL;
if (size == 0 || (align && !rte_is_power_of_2(align)))
return NULL;
+ if (!rte_eal_has_hugepages())
+ socket_arg = SOCKET_ID_ANY;
+
if (socket_arg == SOCKET_ID_ANY)
socket = malloc_get_numa_socket();
else
if (socket_arg == SOCKET_ID_ANY)
socket = malloc_get_numa_socket();
else
@@
-87,7
+89,7
@@
rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)
return NULL;
ret = malloc_heap_alloc(&mcfg->malloc_heaps[socket], type,
return NULL;
ret = malloc_heap_alloc(&mcfg->malloc_heaps[socket], type,
- size,
align == 0 ? 1 : align
);
+ size,
0, align == 0 ? 1 : align, 0
);
if (ret != NULL || socket_arg != SOCKET_ID_ANY)
return ret;
if (ret != NULL || socket_arg != SOCKET_ID_ANY)
return ret;
@@
-98,7
+100,7
@@
rte_malloc_socket(const char *type, size_t size, unsigned align, int socket_arg)
continue;
ret = malloc_heap_alloc(&mcfg->malloc_heaps[i], type,
continue;
ret = malloc_heap_alloc(&mcfg->malloc_heaps[i], type,
- size,
align == 0 ? 1 : align
);
+ size,
0, align == 0 ? 1 : align, 0
);
if (ret != NULL)
return ret;
}
if (ret != NULL)
return ret;
}
@@
-121,11
+123,7
@@
rte_malloc(const char *type, size_t size, unsigned align)
void *
rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
{
void *
rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket)
{
- void *ptr = rte_malloc_socket(type, size, align, socket);
-
- if (ptr != NULL)
- memset(ptr, 0, size);
- return ptr;
+ return rte_malloc_socket(type, size, align, socket);
}
/*
}
/*
@@
-255,6
+253,8
@@
rte_malloc_virt2phy(const void *addr)
{
const struct malloc_elem *elem = malloc_elem_from_data(addr);
if (elem == NULL)
{
const struct malloc_elem *elem = malloc_elem_from_data(addr);
if (elem == NULL)
- return 0;
- return elem->mz->phys_addr + ((uintptr_t)addr - (uintptr_t)elem->mz->addr);
+ return RTE_BAD_PHYS_ADDR;
+ if (elem->ms->phys_addr == RTE_BAD_PHYS_ADDR)
+ return RTE_BAD_PHYS_ADDR;
+ return elem->ms->phys_addr + ((uintptr_t)addr - (uintptr_t)elem->ms->addr);
}
}