1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
14 /* Memory will be allocated dpends on sys_mem_en. */
15 MLX5_MEM_SYS = 1 << 0,
16 /* Memory should be allocated from system. */
17 MLX5_MEM_RTE = 1 << 1,
18 /* Memory should be allocated from rte hugepage. */
19 MLX5_MEM_ZERO = 1 << 2,
20 /* Memory should be cleared to zero. */
24 * Select the PMD memory allocate preference.
26 * Once sys_mem_en is set, the default memory allocate will from
27 * system only if an explicitly flag is set to order the memory
28 * from rte hugepage memory.
31 * Use system memory or not.
34 void mlx5_malloc_mem_select(uint32_t sys_mem_en);
37 * Dump the PMD memory usage statistic.
40 void mlx5_memory_stat_dump(void);
43 * Memory allocate function.
46 * The bits as enum mlx5_mem_flags defined.
48 * Memory size to be allocated.
52 * The socket memory should allocated.
53 * Valid only when allocate the memory from rte hugepage.
56 * Pointer of the allocated memory, NULL otherwise.
59 void *mlx5_malloc(uint32_t flags, size_t size, unsigned int align, int socket);
62 * Memory reallocate function.
67 * The memory to be reallocated.
69 * The bits as enum mlx5_mem_flags defined.
71 * Memory size to be allocated.
75 * The socket memory should allocated.
76 * Valid only when allocate the memory from rte hugepage.
79 * Pointer of the allocated memory, NULL otherwise.
83 void *mlx5_realloc(void *addr, uint32_t flags, size_t size, unsigned int align,
87 * Memory free function.
90 * The memory address to be freed..
93 void mlx5_free(void *addr);