From: Rafal Kozik Date: Thu, 7 Jun 2018 09:43:19 +0000 (+0200) Subject: net/ena: change memory type X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9f32c7e7e6ce58ab772913f54f8328c1c0186a17;p=dpdk.git net/ena: change memory type ENA_MEM_ALLOC_NODE not need to use contiguous physical memory. Also using memset without checking if allocation succeed can cause segmentation fault. To avoid both issue use rte_zmalloc_socket. Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware") Cc: stable@dpdk.org Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index d30153e92b..22d7a9cb13 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -248,15 +248,8 @@ extern uint32_t ena_alloc_cnt; #define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node, dev_node) \ do { \ - const struct rte_memzone *mz; \ - char z_name[RTE_MEMZONE_NAMESIZE]; \ ENA_TOUCH(dmadev); ENA_TOUCH(dev_node); \ - snprintf(z_name, sizeof(z_name), \ - "ena_alloc_%d", ena_alloc_cnt++); \ - mz = rte_memzone_reserve(z_name, size, node, \ - RTE_MEMZONE_IOVA_CONTIG); \ - memset(mz->addr, 0, size); \ - virt = mz->addr; \ + virt = rte_zmalloc_socket(NULL, size, 0, node); \ } while (0) #define ENA_MEM_ALLOC(dmadev, size) rte_zmalloc(NULL, size, 1)