d66cd03134be3777c891fae8a992d7c0ec9b906d
[dpdk.git] / lib / librte_eal / common / eal_internal_cfg.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 /**
6  * @file
7  * Holds the structures for the eal internal configuration
8  */
9
10 #ifndef EAL_INTERNAL_CFG_H
11 #define EAL_INTERNAL_CFG_H
12
13 #include <rte_eal.h>
14 #include <rte_pci_dev_feature_defs.h>
15
16 #define MAX_HUGEPAGE_SIZES 3  /**< support up to 3 page sizes */
17
18 /*
19  * internal configuration structure for the number, size and
20  * mount points of hugepages
21  */
22 struct hugepage_info {
23         uint64_t hugepage_sz;   /**< size of a huge page */
24         char hugedir[PATH_MAX];    /**< dir where hugetlbfs is mounted */
25         uint32_t num_pages[RTE_MAX_NUMA_NODES];
26         /**< number of hugepages of that size on each socket */
27         int lock_descriptor;    /**< file descriptor for hugepage dir */
28 };
29
30 /**
31  * internal configuration
32  */
33 struct internal_config {
34         volatile size_t memory;           /**< amount of asked memory */
35         volatile unsigned force_nchannel; /**< force number of channels */
36         volatile unsigned force_nrank;    /**< force number of ranks */
37         volatile unsigned no_hugetlbfs;   /**< true to disable hugetlbfs */
38         unsigned hugepage_unlink;         /**< true to unlink backing files */
39         volatile unsigned no_pci;         /**< true to disable PCI */
40         volatile unsigned no_hpet;        /**< true to disable HPET */
41         volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
42                                                                                 * instead of native TSC */
43         volatile unsigned no_shconf;      /**< true if there is no shared config */
44         volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */
45         volatile enum rte_proc_type_t process_type; /**< multi-process proc type */
46         /** true to try allocating memory on specific sockets */
47         volatile unsigned force_sockets;
48         volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */
49         volatile unsigned force_socket_limits;
50         volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */
51         uintptr_t base_virtaddr;          /**< base address to try and reserve memory from */
52         volatile unsigned legacy_mem;
53         /**< true to enable legacy memory behavior (no dynamic allocation,
54          * IOVA-contiguous segments).
55          */
56         volatile unsigned single_file_segments;
57         /**< true if storing all pages within single files (per-page-size,
58          * per-node) non-legacy mode only.
59          */
60         volatile int syslog_facility;     /**< facility passed to openlog() */
61         /** default interrupt mode for VFIO */
62         volatile enum rte_intr_mode vfio_intr_mode;
63         const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
64         const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
65         const char *user_mbuf_pool_ops_name;
66                         /**< user defined mbuf pool ops name */
67         unsigned num_hugepage_sizes;      /**< how many sizes on this system */
68         struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
69         volatile unsigned int init_complete;
70         /**< indicates whether EAL has completed initialization */
71 };
72 extern struct internal_config internal_config; /**< Global EAL configuration. */
73
74 void eal_reset_internal_config(struct internal_config *internal_cfg);
75
76 #endif /* EAL_INTERNAL_CFG_H */