Work around DPDK 16.07 FreeBSD rte_zmalloc() bug

Replace other critical rte_zmalloc() sites that actually depend on the
memory being zeroed.

Change-Id: If6856ad44a4c50869811d3ce9411c993ce88018d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-11 17:47:00 -07:00
parent 17dbcf58c1
commit 5c9d560b5a
2 changed files with 10 additions and 3 deletions

View File

@ -235,12 +235,14 @@ struct malloc_disk *create_malloc_disk(uint64_t num_blocks, uint32_t block_size)
return NULL;
}
mdisk = rte_zmalloc(NULL, sizeof(*mdisk), 0);
mdisk = rte_malloc(NULL, sizeof(*mdisk), 0);
if (!mdisk) {
perror("mdisk");
return NULL;
}
memset(mdisk, 0, sizeof(*mdisk));
/*
* Allocate the large backend memory buffer using rte_malloc(),
* so that we guarantee it is allocated from hugepage memory.

View File

@ -5,6 +5,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <rte_config.h>
#include <rte_malloc.h>
#include <rte_atomic.h>
@ -39,8 +40,12 @@
static inline void *
ioat_zmalloc(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;
}