DPDK  24.03.0
rte_eal.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2018 Intel Corporation
3  */
4 
5 #ifndef _RTE_EAL_H_
6 #define _RTE_EAL_H_
7 
14 #include <stdint.h>
15 #include <time.h>
16 
17 #include <rte_config.h>
18 #include <rte_compat.h>
19 #include <rte_per_lcore.h>
20 #include <rte_uuid.h>
21 
22 #include <rte_pci_dev_feature_defs.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define RTE_MAGIC 19820526
33 enum rte_proc_type_t {
34  RTE_PROC_AUTO = -1, /* allow auto-detection of primary/secondary */
35  RTE_PROC_PRIMARY = 0, /* set to zero, so primary is the default */
36  RTE_PROC_SECONDARY,
37 
38  RTE_PROC_INVALID
39 };
40 
48 
58 int rte_eal_iopl_init(void);
59 
112 int rte_eal_init(int argc, char **argv);
113 
126 int rte_eal_cleanup(void);
127 
143 int rte_eal_primary_proc_alive(const char *config_file_path);
144 
156 bool rte_mp_disable(void);
157 
158 #define RTE_MP_MAX_FD_NUM 8 /* The max amount of fds */
159 #define RTE_MP_MAX_NAME_LEN 64 /* The max length of action name */
160 #define RTE_MP_MAX_PARAM_LEN 256 /* The max length of param */
161 struct rte_mp_msg {
162  char name[RTE_MP_MAX_NAME_LEN];
163  int len_param;
164  int num_fds;
165  uint8_t param[RTE_MP_MAX_PARAM_LEN];
166  int fds[RTE_MP_MAX_FD_NUM];
167 };
168 
169 struct rte_mp_reply {
170  int nb_sent;
171  int nb_received;
172  struct rte_mp_msg *msgs; /* caller to free */
173 };
174 
188 typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
189 
204 typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
205  const struct rte_mp_reply *reply);
206 
227 int
228 rte_mp_action_register(const char *name, rte_mp_t action);
229 
243 void
244 rte_mp_action_unregister(const char *name);
245 
259 int
260 rte_mp_sendmsg(struct rte_mp_msg *msg);
261 
290 int
291 rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
292  const struct timespec *ts);
293 
316 int
317 rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
319 
341 int
342 rte_mp_reply(struct rte_mp_msg *msg, const char *peer);
343 
350 typedef void (*rte_usage_hook_t)(const char * prgname);
351 
375 
383 int rte_eal_has_hugepages(void);
384 
392 int rte_eal_has_pci(void);
393 
400 int rte_eal_create_uio_dev(void);
401 
409 enum rte_intr_mode rte_eal_vfio_intr_mode(void);
410 
419 
427 int rte_sys_gettid(void);
428 
429 RTE_DECLARE_PER_LCORE(int, _thread_id);
430 
438 static inline int rte_gettid(void)
439 {
440  if (RTE_PER_LCORE(_thread_id) == -1)
441  RTE_PER_LCORE(_thread_id) = rte_sys_gettid();
442  return RTE_PER_LCORE(_thread_id);
443 }
444 
451 __rte_internal
452 uint64_t rte_eal_get_baseaddr(void);
453 
462  RTE_IOVA_DC = 0, /* Don't care mode */
463  RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
464  RTE_IOVA_VA = (1 << 1) /* DMA using virtual address */
465 };
466 
474 
481 const char *
483 
490 const char *
492 
509 __rte_internal
510 int
511 rte_eal_parse_coremask(const char *coremask, int *cores);
512 
513 #ifdef __cplusplus
514 }
515 #endif
516 
517 #endif /* _RTE_EAL_H_ */
#define RTE_DECLARE_PER_LCORE(type, name)
Definition: rte_per_lcore.h:43
int rte_sys_gettid(void)
enum rte_iova_mode rte_eal_iova_mode(void)
int(* rte_mp_async_reply_t)(const struct rte_mp_msg *request, const struct rte_mp_reply *reply)
Definition: rte_eal.h:204
int rte_eal_create_uio_dev(void)
int rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
int rte_eal_has_hugepages(void)
enum rte_intr_mode rte_eal_vfio_intr_mode(void)
const char * rte_eal_mbuf_user_pool_ops(void)
const char * rte_eal_get_runtime_dir(void)
enum rte_proc_type_t rte_eal_process_type(void)
__rte_internal int rte_eal_parse_coremask(const char *coremask, int *cores)
unsigned char rte_uuid_t[16]
Definition: rte_uuid.h:24
int rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, const struct timespec *ts)
int rte_eal_cleanup(void)
int rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, rte_mp_async_reply_t clb)
void(* rte_usage_hook_t)(const char *prgname)
Definition: rte_eal.h:350
rte_iova_mode
Definition: rte_eal.h:461
int rte_eal_primary_proc_alive(const char *config_file_path)
int rte_mp_action_register(const char *name, rte_mp_t action)
int rte_mp_sendmsg(struct rte_mp_msg *msg)
void rte_mp_action_unregister(const char *name)
rte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func)
#define RTE_PER_LCORE(name)
Definition: rte_per_lcore.h:50
rte_proc_type_t
Definition: rte_eal.h:33
void rte_eal_vfio_get_vf_token(rte_uuid_t vf_token)
int rte_eal_init(int argc, char **argv)
int(* rte_mp_t)(const struct rte_mp_msg *msg, const void *peer)
Definition: rte_eal.h:188
int rte_eal_has_pci(void)
static int rte_gettid(void)
Definition: rte_eal.h:438
__rte_internal uint64_t rte_eal_get_baseaddr(void)
int rte_eal_iopl_init(void)
bool rte_mp_disable(void)