nvme: replace rte_zmalloc() with rte_malloc() + memset

rte_zmalloc() is broken and does not actually return zeroed memory on at
least DPDK 16.07 on FreeBSD, so do it ourselves.

Change-Id: If8da93ead0b3911c8bca24aa27ed90dc00b8a9a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-10 16:12:59 -07:00
parent fcc97846fa
commit dd2e6164c9

View File

@ -49,6 +49,7 @@
#include "spdk/pci.h"
#include "spdk/nvme_spec.h"
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <rte_config.h>
#include <rte_cycles.h>
@ -85,8 +86,11 @@
static inline void *
nvme_malloc(const char *tag, size_t size, unsigned align, uint64_t *phys_addr)
{
void *buf = rte_zmalloc(tag, size, align);
*phys_addr = rte_malloc_virt2phy(buf);
void *buf = rte_malloc(tag, size, align);
if (buf) {
memset(buf, 0, size);
*phys_addr = rte_malloc_virt2phy(buf);
}
return buf;
}