1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #ifndef _EAL_PRIVATE_H_
6 #define _EAL_PRIVATE_H_
15 * Initialize the memzone subsystem (private to eal).
21 int rte_eal_memzone_init(void);
24 * Common log initialization function (private to eal). Determines
25 * where log data is written when no call to rte_openlog_stream is
29 * The default log stream to be used.
34 void eal_log_set_default(FILE *default_log);
37 * Fill configuration with number of physical and logical processors
39 * This function is private to EAL.
41 * Parse /proc/cpuinfo to get the number of physical and logical
42 * processors on the machine.
45 * 0 on success, negative on error
47 int rte_eal_cpu_init(void);
52 * This function is private to EAL.
54 * Fill configuration structure with these infos, and return 0 on success.
57 * 0 on success, negative on error
59 int rte_eal_memory_init(void);
64 * This function is private to EAL.
66 * Mmap memory areas used by HPET (high precision event timer) that will
67 * provide our time reference, and configure the TSC frequency also for it
68 * to be used as a reference.
71 * 0 on success, negative on error
73 int rte_eal_timer_init(void);
76 * Init the default log stream
78 * This function is private to EAL.
81 * 0 on success, negative on error
83 int rte_eal_log_init(const char *id, int facility);
86 * Save the log regexp for later
88 int rte_log_save_regexp(const char *type, int priority);
91 * Init tail queues for non-EAL library structures. This is to allow
92 * the rings, mempools, etc. lists to be shared among multiple processes
94 * This function is private to EAL
97 * 0 on success, negative on error
99 int rte_eal_tailqs_init(void);
102 * Init interrupt handling.
104 * This function is private to EAL.
107 * 0 on success, negative on error
109 int rte_eal_intr_init(void);
112 * Init alarm mechanism. This is to allow a callback be called after
115 * This function is private to EAL.
118 * 0 on success, negative on error
120 int rte_eal_alarm_init(void);
123 * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
127 * The module's name which need to be checked
130 * -1 means some error happens(NULL pointer or open failure)
131 * 0 means the module not loaded
132 * 1 means the module loaded
134 int rte_eal_check_module(const char *module_name);
137 * Get virtual area of specified size from the OS.
139 * This function is private to the EAL.
141 * @param requested_addr
142 * Address where to request address space.
144 * Size of requested area.
146 * Page size on which to align requested virtual area.
148 * EAL_VIRTUAL_AREA_* flags.
150 * Extra flags passed directly to mmap().
153 * Virtual area address if successful.
154 * NULL if unsuccessful.
157 #define EAL_VIRTUAL_AREA_ADDR_IS_HINT (1 << 0)
158 /**< don't fail if cannot get exact requested address. */
159 #define EAL_VIRTUAL_AREA_ALLOW_SHRINK (1 << 1)
160 /**< try getting smaller sized (decrement by page size) virtual areas if cannot
161 * get area of requested size.
163 #define EAL_VIRTUAL_AREA_UNMAP (1 << 2)
164 /**< immediately unmap reserved virtual area. */
166 eal_get_virtual_area(void *requested_addr, size_t *size,
167 size_t page_sz, int flags, int mmap_flags);
172 * This function is private to the EAL.
174 unsigned eal_cpu_core_id(unsigned lcore_id);
177 * Check if cpu is present.
179 * This function is private to the EAL.
181 int eal_cpu_detected(unsigned lcore_id);
184 * Set TSC frequency from precise value or estimation
186 * This function is private to the EAL.
188 void set_tsc_freq(void);
191 * Get precise TSC frequency from system
193 * This function is private to the EAL.
195 uint64_t get_tsc_freq(void);
198 * Get TSC frequency if the architecture supports.
200 * This function is private to the EAL.
203 * The number of TSC cycles in one second.
204 * Returns zero if the architecture support is not available.
206 uint64_t get_tsc_freq_arch(void);
209 * Prepare physical memory mapping
210 * i.e. hugepages on Linux and
213 * This function is private to the EAL.
215 int rte_eal_hugepage_init(void);
218 * Creates memory mapping in secondary process
219 * i.e. hugepages on Linux and
222 * This function is private to the EAL.
224 int rte_eal_hugepage_attach(void);
227 * Find a bus capable of identifying a device.
230 * A device identifier (PCI address, virtual PMD name, ...).
233 * A valid bus handle if found.
234 * NULL if no bus is able to parse this device.
236 struct rte_bus *rte_bus_find_by_device_name(const char *str);
239 * Create the unix channel for primary/secondary communication.
246 int rte_mp_channel_init(void);
249 * Internal Executes all the user application registered callbacks for
250 * the specific device. It is for DPDK internal user only. User
251 * application should not call it directly.
256 * the device event type.
258 void dev_callback_process(char *device_name, enum rte_dev_event_type event);
260 #endif /* _EAL_PRIVATE_H_ */