New upstream version 18.08
[deb_dpdk.git] / lib / librte_eal / common / eal_hugepages.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef EAL_HUGEPAGES_H
6 #define EAL_HUGEPAGES_H
7
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <limits.h>
11
12 #define MAX_HUGEPAGE_PATH PATH_MAX
13
14 /**
15  * Structure used to store informations about hugepages that we mapped
16  * through the files in hugetlbfs.
17  */
18 struct hugepage_file {
19         void *orig_va;      /**< virtual addr of first mmap() */
20         void *final_va;     /**< virtual addr of 2nd mmap() */
21         uint64_t physaddr;  /**< physical addr */
22         size_t size;        /**< the page size */
23         int socket_id;      /**< NUMA socket ID */
24         int file_id;        /**< the '%d' in HUGEFILE_FMT */
25         char filepath[MAX_HUGEPAGE_PATH]; /**< path to backing file on filesystem */
26 };
27
28 /**
29  * Read the information on what hugepages are available for the EAL to use,
30  * clearing out any unused ones.
31  */
32 int eal_hugepage_info_init(void);
33
34 /**
35  * Read whatever information primary process has shared about hugepages into
36  * secondary process.
37  */
38 int eal_hugepage_info_read(void);
39
40 #endif /* EAL_HUGEPAGES_H */