1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2021 Intel Corporation
8 #include <rte_common.h>
9 #include <rte_malloc.h>
10 #include <rte_memzone.h>
12 #include "iavf_type.h"
13 #include "iavf_prototype.h"
16 iavf_allocate_dma_mem_d(__rte_unused struct iavf_hw *hw,
17 struct iavf_dma_mem *mem,
21 static uint64_t iavf_dma_memzone_id;
22 const struct rte_memzone *mz = NULL;
23 char z_name[RTE_MEMZONE_NAMESIZE];
26 return IAVF_ERR_PARAM;
28 snprintf(z_name, sizeof(z_name), "iavf_dma_%" PRIu64,
29 __atomic_fetch_add(&iavf_dma_memzone_id, 1, __ATOMIC_RELAXED));
30 mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY,
31 RTE_MEMZONE_IOVA_CONTIG, alignment,
34 return IAVF_ERR_NO_MEMORY;
39 mem->zone = (const void *)mz;
45 iavf_free_dma_mem_d(__rte_unused struct iavf_hw *hw,
46 struct iavf_dma_mem *mem)
49 return IAVF_ERR_PARAM;
51 rte_memzone_free((const struct rte_memzone *)mem->zone);
60 iavf_allocate_virt_mem_d(__rte_unused struct iavf_hw *hw,
61 struct iavf_virt_mem *mem,
65 return IAVF_ERR_PARAM;
68 mem->va = rte_zmalloc("iavf", size, 0);
73 return IAVF_ERR_NO_MEMORY;
77 iavf_free_virt_mem_d(__rte_unused struct iavf_hw *hw,
78 struct iavf_virt_mem *mem)
81 return IAVF_ERR_PARAM;
89 RTE_LOG_REGISTER_DEFAULT(iavf_common_logger, NOTICE);