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:
parent
17dbcf58c1
commit
5c9d560b5a
@ -235,12 +235,14 @@ struct malloc_disk *create_malloc_disk(uint64_t num_blocks, uint32_t block_size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mdisk = rte_zmalloc(NULL, sizeof(*mdisk), 0);
|
mdisk = rte_malloc(NULL, sizeof(*mdisk), 0);
|
||||||
if (!mdisk) {
|
if (!mdisk) {
|
||||||
perror("mdisk");
|
perror("mdisk");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(mdisk, 0, sizeof(*mdisk));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate the large backend memory buffer using rte_malloc(),
|
* Allocate the large backend memory buffer using rte_malloc(),
|
||||||
* so that we guarantee it is allocated from hugepage memory.
|
* so that we guarantee it is allocated from hugepage memory.
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
#include <rte_config.h>
|
#include <rte_config.h>
|
||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_atomic.h>
|
#include <rte_atomic.h>
|
||||||
@ -39,8 +40,12 @@
|
|||||||
static inline void *
|
static inline void *
|
||||||
ioat_zmalloc(const char *tag, size_t size, unsigned align, uint64_t *phys_addr)
|
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);
|
||||||
*phys_addr = rte_malloc_virt2phy(buf);
|
|
||||||
|
if (buf) {
|
||||||
|
memset(buf, 0, size);
|
||||||
|
*phys_addr = rte_malloc_virt2phy(buf);
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user