199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2010-2014 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson /** 699a2dd95SBruce Richardson * @file 799a2dd95SBruce Richardson * Holds the structures for the eal internal configuration 899a2dd95SBruce Richardson */ 999a2dd95SBruce Richardson 1099a2dd95SBruce Richardson #ifndef EAL_INTERNAL_CFG_H 1199a2dd95SBruce Richardson #define EAL_INTERNAL_CFG_H 1299a2dd95SBruce Richardson 1399a2dd95SBruce Richardson #include <rte_eal.h> 1499a2dd95SBruce Richardson #include <rte_os_shim.h> 1599a2dd95SBruce Richardson #include <rte_pci_dev_feature_defs.h> 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson #include "eal_thread.h" 1899a2dd95SBruce Richardson 1999a2dd95SBruce Richardson #if defined(RTE_ARCH_ARM) 2099a2dd95SBruce Richardson #define MAX_HUGEPAGE_SIZES 4 /**< support up to 4 page sizes */ 2199a2dd95SBruce Richardson #else 2299a2dd95SBruce Richardson #define MAX_HUGEPAGE_SIZES 3 /**< support up to 3 page sizes */ 2399a2dd95SBruce Richardson #endif 2499a2dd95SBruce Richardson 2599a2dd95SBruce Richardson /* 2699a2dd95SBruce Richardson * internal configuration structure for the number, size and 2799a2dd95SBruce Richardson * mount points of hugepages 2899a2dd95SBruce Richardson */ 2999a2dd95SBruce Richardson struct hugepage_info { 3099a2dd95SBruce Richardson uint64_t hugepage_sz; /**< size of a huge page */ 3199a2dd95SBruce Richardson char hugedir[PATH_MAX]; /**< dir where hugetlbfs is mounted */ 3299a2dd95SBruce Richardson uint32_t num_pages[RTE_MAX_NUMA_NODES]; 3399a2dd95SBruce Richardson /**< number of hugepages of that size on each socket */ 3499a2dd95SBruce Richardson int lock_descriptor; /**< file descriptor for hugepage dir */ 3599a2dd95SBruce Richardson }; 3699a2dd95SBruce Richardson 3799a2dd95SBruce Richardson struct simd_bitwidth { 3899a2dd95SBruce Richardson bool forced; 3999a2dd95SBruce Richardson /**< flag indicating if bitwidth is forced and can't be modified */ 4099a2dd95SBruce Richardson uint16_t bitwidth; /**< bitwidth value */ 4199a2dd95SBruce Richardson }; 4299a2dd95SBruce Richardson 4352d7d91eSDmitry Kozlyuk /** Hugepage backing files discipline. */ 4452d7d91eSDmitry Kozlyuk struct hugepage_file_discipline { 4552d7d91eSDmitry Kozlyuk /** Unlink files before mapping them to leave no trace in hugetlbfs. */ 4652d7d91eSDmitry Kozlyuk bool unlink_before_mapping; 4732b4771cSDmitry Kozlyuk /** Unlink existing files at startup, re-create them before mapping. */ 4832b4771cSDmitry Kozlyuk bool unlink_existing; 4952d7d91eSDmitry Kozlyuk }; 5052d7d91eSDmitry Kozlyuk 5199a2dd95SBruce Richardson /** 5299a2dd95SBruce Richardson * internal configuration 5399a2dd95SBruce Richardson */ 5499a2dd95SBruce Richardson struct internal_config { 5599a2dd95SBruce Richardson volatile size_t memory; /**< amount of asked memory */ 5699a2dd95SBruce Richardson volatile unsigned force_nchannel; /**< force number of channels */ 5799a2dd95SBruce Richardson volatile unsigned force_nrank; /**< force number of ranks */ 5899a2dd95SBruce Richardson volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */ 5952d7d91eSDmitry Kozlyuk struct hugepage_file_discipline hugepage_file; 6099a2dd95SBruce Richardson volatile unsigned no_pci; /**< true to disable PCI */ 6199a2dd95SBruce Richardson volatile unsigned no_hpet; /**< true to disable HPET */ 6299a2dd95SBruce Richardson volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping 6399a2dd95SBruce Richardson * instead of native TSC */ 6499a2dd95SBruce Richardson volatile unsigned no_shconf; /**< true if there is no shared config */ 6599a2dd95SBruce Richardson volatile unsigned in_memory; 6699a2dd95SBruce Richardson /**< true if DPDK should operate entirely in-memory and not create any 6799a2dd95SBruce Richardson * shared files or runtime data. 6899a2dd95SBruce Richardson */ 6999a2dd95SBruce Richardson volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */ 7099a2dd95SBruce Richardson volatile enum rte_proc_type_t process_type; /**< multi-process proc type */ 7199a2dd95SBruce Richardson /** true to try allocating memory on specific sockets */ 7299a2dd95SBruce Richardson volatile unsigned force_sockets; 7399a2dd95SBruce Richardson volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */ 7499a2dd95SBruce Richardson volatile unsigned force_socket_limits; 7599a2dd95SBruce Richardson volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */ 7699a2dd95SBruce Richardson uintptr_t base_virtaddr; /**< base address to try and reserve memory from */ 7799a2dd95SBruce Richardson volatile unsigned legacy_mem; 7899a2dd95SBruce Richardson /**< true to enable legacy memory behavior (no dynamic allocation, 7999a2dd95SBruce Richardson * IOVA-contiguous segments). 8099a2dd95SBruce Richardson */ 8199a2dd95SBruce Richardson volatile unsigned match_allocations; 8299a2dd95SBruce Richardson /**< true to free hugepages exactly as allocated */ 8399a2dd95SBruce Richardson volatile unsigned single_file_segments; 8499a2dd95SBruce Richardson /**< true if storing all pages within single files (per-page-size, 8599a2dd95SBruce Richardson * per-node) non-legacy mode only. 8699a2dd95SBruce Richardson */ 8799a2dd95SBruce Richardson /** default interrupt mode for VFIO */ 8899a2dd95SBruce Richardson volatile enum rte_intr_mode vfio_intr_mode; 8999a2dd95SBruce Richardson /** the shared VF token for VFIO-PCI bound PF and VFs devices */ 9099a2dd95SBruce Richardson rte_uuid_t vfio_vf_token; 9199a2dd95SBruce Richardson char *hugefile_prefix; /**< the base filename of hugetlbfs files */ 9299a2dd95SBruce Richardson char *hugepage_dir; /**< specific hugetlbfs directory to use */ 9399a2dd95SBruce Richardson char *user_mbuf_pool_ops_name; 9499a2dd95SBruce Richardson /**< user defined mbuf pool ops name */ 9599a2dd95SBruce Richardson unsigned num_hugepage_sizes; /**< how many sizes on this system */ 9699a2dd95SBruce Richardson struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; 9799a2dd95SBruce Richardson enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */ 9899a2dd95SBruce Richardson rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */ 9999a2dd95SBruce Richardson volatile unsigned int init_complete; 10099a2dd95SBruce Richardson /**< indicates whether EAL has completed initialization */ 10199a2dd95SBruce Richardson unsigned int no_telemetry; /**< true to disable Telemetry */ 10299a2dd95SBruce Richardson struct simd_bitwidth max_simd_bitwidth; 10399a2dd95SBruce Richardson /**< max simd bitwidth path to use */ 104*42fbb8e8SDon Wallwork size_t huge_worker_stack_size; /**< worker thread stack size */ 10599a2dd95SBruce Richardson }; 10699a2dd95SBruce Richardson 10799a2dd95SBruce Richardson void eal_reset_internal_config(struct internal_config *internal_cfg); 10899a2dd95SBruce Richardson 10999a2dd95SBruce Richardson #endif /* EAL_INTERNAL_CFG_H */ 110