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

Function rte_malloc_heap_get_socket

dpdk/lib/eal/common/rte_malloc.c:265–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265int
266rte_malloc_heap_get_socket(const char *name)
267{
268 struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
269 struct malloc_heap *heap = NULL;
270 unsigned int idx;
271 int ret;
272
273 if (name == NULL ||
274 strnlen(name, RTE_HEAP_NAME_MAX_LEN) == 0 ||
275 strnlen(name, RTE_HEAP_NAME_MAX_LEN) ==
276 RTE_HEAP_NAME_MAX_LEN) {
277 rte_errno = EINVAL;
278 return -1;
279 }
280 rte_mcfg_mem_read_lock();
281 for (idx = 0; idx < RTE_MAX_HEAPS; idx++) {
282 struct malloc_heap *tmp = &mcfg->malloc_heaps[idx];
283
284 if (!strncmp(name, tmp->name, RTE_HEAP_NAME_MAX_LEN)) {
285 heap = tmp;
286 break;
287 }
288 }
289
290 if (heap != NULL) {
291 ret = heap->socket_id;
292 } else {
293 rte_errno = ENOENT;
294 ret = -1;
295 }
296 rte_mcfg_mem_read_unlock();
297
298 return ret;
299}
300
301int
302rte_malloc_heap_socket_is_external(int socket_id)

Callers 6

test_malloc_basicFunction · 0.85
test_reallocFunction · 0.85
setup_extmemFunction · 0.85
mbuf_pool_createFunction · 0.85

Calls 5

strnlenFunction · 0.85
rte_mcfg_mem_read_lockFunction · 0.85
strncmpFunction · 0.85
rte_mcfg_mem_read_unlockFunction · 0.85

Tested by 6

test_malloc_basicFunction · 0.68
test_reallocFunction · 0.68
setup_extmemFunction · 0.68
mbuf_pool_createFunction · 0.68