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_os_shim.h> 15 #include <rte_pci_dev_feature_defs.h> 16 17 #include "eal_thread.h" 18 19 #if defined(RTE_ARCH_ARM) 20 #define MAX_HUGEPAGE_SIZES 4 /**< support up to 4 page sizes */ 21 #else 22 #define MAX_HUGEPAGE_SIZES 3 /**< support up to 3 page sizes */ 23 #endif 24 25 /* 26 * internal configuration structure for the number, size and 27 * mount points of hugepages 28 */ 29 struct hugepage_info { 30 uint64_t hugepage_sz; /**< size of a huge page */ 31 char hugedir[PATH_MAX]; /**< dir where hugetlbfs is mounted */ 32 uint32_t num_pages[RTE_MAX_NUMA_NODES]; 33 /**< number of hugepages of that size on each socket */ 34 int lock_descriptor; /**< file descriptor for hugepage dir */ 35 }; 36 37 struct simd_bitwidth { 38 bool forced; 39 /**< flag indicating if bitwidth is forced and can't be modified */ 40 uint16_t bitwidth; /**< bitwidth value */ 41 }; 42 43 /** Hugepage backing files discipline. */ 44 struct hugepage_file_discipline { 45 /** Unlink files before mapping them to leave no trace in hugetlbfs. */ 46 bool unlink_before_mapping; 47 /** Unlink existing files at startup, re-create them before mapping. */ 48 bool unlink_existing; 49 }; 50 51 /** 52 * internal configuration 53 */ 54 struct internal_config { 55 volatile size_t memory; /**< amount of asked memory */ 56 volatile unsigned force_nchannel; /**< force number of channels */ 57 volatile unsigned force_nrank; /**< force number of ranks */ 58 volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */ 59 struct hugepage_file_discipline hugepage_file; 60 volatile unsigned no_pci; /**< true to disable PCI */ 61 volatile unsigned no_hpet; /**< true to disable HPET */ 62 volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping 63 * instead of native TSC */ 64 volatile unsigned no_shconf; /**< true if there is no shared config */ 65 volatile unsigned in_memory; 66 /**< true if DPDK should operate entirely in-memory and not create any 67 * shared files or runtime data. 68 */ 69 volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */ 70 volatile enum rte_proc_type_t process_type; /**< multi-process proc type */ 71 /** true to try allocating memory on specific sockets */ 72 volatile unsigned force_sockets; 73 volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */ 74 volatile unsigned force_socket_limits; 75 volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */ 76 uintptr_t base_virtaddr; /**< base address to try and reserve memory from */ 77 volatile unsigned legacy_mem; 78 /**< true to enable legacy memory behavior (no dynamic allocation, 79 * IOVA-contiguous segments). 80 */ 81 volatile unsigned match_allocations; 82 /**< true to free hugepages exactly as allocated */ 83 volatile unsigned single_file_segments; 84 /**< true if storing all pages within single files (per-page-size, 85 * per-node) non-legacy mode only. 86 */ 87 /** default interrupt mode for VFIO */ 88 volatile enum rte_intr_mode vfio_intr_mode; 89 /** the shared VF token for VFIO-PCI bound PF and VFs devices */ 90 rte_uuid_t vfio_vf_token; 91 char *hugefile_prefix; /**< the base filename of hugetlbfs files */ 92 char *hugepage_dir; /**< specific hugetlbfs directory to use */ 93 char *user_mbuf_pool_ops_name; 94 /**< user defined mbuf pool ops name */ 95 unsigned num_hugepage_sizes; /**< how many sizes on this system */ 96 struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; 97 enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */ 98 rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */ 99 volatile unsigned int init_complete; 100 /**< indicates whether EAL has completed initialization */ 101 unsigned int no_telemetry; /**< true to disable Telemetry */ 102 struct simd_bitwidth max_simd_bitwidth; 103 /**< max simd bitwidth path to use */ 104 size_t huge_worker_stack_size; /**< worker thread stack size */ 105 }; 106 107 void eal_reset_internal_config(struct internal_config *internal_cfg); 108 109 #endif /* EAL_INTERNAL_CFG_H */ 110