Loading include/spdk/env.h +7 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,13 @@ extern "C" { struct spdk_pci_device; /** * Allocate a pinned, physically contiguous memory buffer with the * given size and alignment. */ void * spdk_malloc(size_t size, size_t align, uint64_t *phys_addr); /** * Allocate a pinned, physically contiguous memory buffer with the * given size and alignment. The buffer will be zeroed. Loading lib/env/env.c +11 −4 Original line number Diff line number Diff line Loading @@ -43,14 +43,21 @@ #include <rte_version.h> void * spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) spdk_malloc(size_t size, size_t align, uint64_t *phys_addr) { void *buf = rte_malloc(NULL, size, align); if (buf) { memset(buf, 0, size); if (phys_addr) { if (buf && phys_addr) { *phys_addr = rte_malloc_virt2phy(buf); } return buf; } void * spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) { void *buf = spdk_malloc(size, align, phys_addr); if (buf) { memset(buf, 0, size); } return buf; } Loading Loading
include/spdk/env.h +7 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,13 @@ extern "C" { struct spdk_pci_device; /** * Allocate a pinned, physically contiguous memory buffer with the * given size and alignment. */ void * spdk_malloc(size_t size, size_t align, uint64_t *phys_addr); /** * Allocate a pinned, physically contiguous memory buffer with the * given size and alignment. The buffer will be zeroed. Loading
lib/env/env.c +11 −4 Original line number Diff line number Diff line Loading @@ -43,14 +43,21 @@ #include <rte_version.h> void * spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) spdk_malloc(size_t size, size_t align, uint64_t *phys_addr) { void *buf = rte_malloc(NULL, size, align); if (buf) { memset(buf, 0, size); if (phys_addr) { if (buf && phys_addr) { *phys_addr = rte_malloc_virt2phy(buf); } return buf; } void * spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) { void *buf = spdk_malloc(size, align, phys_addr); if (buf) { memset(buf, 0, size); } return buf; } Loading