Commit 5c9d560b authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 17dbcf58
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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.
+7 −2
Original line number Diff line number Diff line
@@ -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);
	void *buf = rte_malloc(tag, size, align);

	if (buf) {
		memset(buf, 0, size);
		*phys_addr = rte_malloc_virt2phy(buf);
	}
	return buf;
}