DPDK  25.11.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 <stdalign.h>
15 #include <stdint.h>
16 #include <time.h>
17 
18 #include <rte_config.h>
19 #include <rte_compat.h>
20 #include <rte_per_lcore.h>
21 #include <rte_uuid.h>
22 
23 #include <rte_pci_dev_feature_defs.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define RTE_MAGIC 19820526
35  RTE_PROC_AUTO = -1, /* allow auto-detection of primary/secondary */
36  RTE_PROC_PRIMARY = 0, /* set to zero, so primary is the default */
37  RTE_PROC_SECONDARY,
38 
39  RTE_PROC_INVALID
40 };
41 
49 
60 
113 int rte_eal_init(int argc, char **argv);
114 
127 int rte_eal_cleanup(void);
128 
144 int rte_eal_primary_proc_alive(const char *config_file_path);
145 
157 bool rte_mp_disable(void);
158 
159 #define RTE_MP_MAX_FD_NUM 253 /* The max amount of fds (see SCM_MAX_FD) */
160 #define RTE_MP_MAX_NAME_LEN 64 /* The max length of action name */
161 #define RTE_MP_MAX_PARAM_LEN 256 /* The max length of param */
162 struct rte_mp_msg {
163  char name[RTE_MP_MAX_NAME_LEN];
164  int len_param;
165  int num_fds;
166  alignas(8) uint8_t param[RTE_MP_MAX_PARAM_LEN];
167  int fds[RTE_MP_MAX_FD_NUM];
168 };
169 
170 struct rte_mp_reply {
171  int nb_sent;
172  int nb_received;
173  struct rte_mp_msg *msgs; /* caller to free */
174 };
175 
189 typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
190 
205 typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
206  const struct rte_mp_reply *reply);
207 
228 int
229 rte_mp_action_register(const char *name, rte_mp_t action);
230 
244 void
245 rte_mp_action_unregister(const char *name);
246 
260 int
261 rte_mp_sendmsg(struct rte_mp_msg *msg);
262 
291 int
292 rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
293  const struct timespec *ts);
294 
317 int
318 rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
320 
342 int
343 rte_mp_reply(struct rte_mp_msg *msg, const char *peer);
344 
351 typedef void (*rte_usage_hook_t)(const char * prgname);
352 
376 
385 
393 int rte_eal_has_pci(void);
394 
402 
410 enum rte_intr_mode rte_eal_vfio_intr_mode(void);
411 
420 
428 int rte_sys_gettid(void);
429 
430 RTE_DECLARE_PER_LCORE(int, _thread_id);
431 
439 static inline int rte_gettid(void)
440 {
441  if (RTE_PER_LCORE(_thread_id) == -1)
442  RTE_PER_LCORE(_thread_id) = rte_sys_gettid();
443  return RTE_PER_LCORE(_thread_id);
444 }
445 
452 __rte_internal
453 uint64_t rte_eal_get_baseaddr(void);
454 
463  RTE_IOVA_DC = 0, /* Don't care mode */
464  RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
465  RTE_IOVA_VA = (1 << 1) /* DMA using virtual address */
466 };
467 
475 
482 const char *
484 
491 const char *
493 
494 #ifdef __cplusplus
495 }
496 #endif
497 
498 #endif /* _RTE_EAL_H_ */
enum rte_proc_type_t rte_eal_process_type(void)
enum rte_intr_mode rte_eal_vfio_intr_mode(void)
rte_proc_type_t
Definition: rte_eal.h:34
enum rte_iova_mode rte_eal_iova_mode(void)
bool rte_mp_disable(void)
int rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, const struct timespec *ts)
rte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func)
int rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
int rte_mp_sendmsg(struct rte_mp_msg *msg)
int rte_eal_has_pci(void)
int rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, rte_mp_async_reply_t clb)
__rte_internal uint64_t rte_eal_get_baseaddr(void)
rte_iova_mode
Definition: rte_eal.h:462
static int rte_gettid(void)
Definition: rte_eal.h:439
int(* rte_mp_async_reply_t)(const struct rte_mp_msg *request, const struct rte_mp_reply *reply)
Definition: rte_eal.h:205
int(* rte_mp_t)(const struct rte_mp_msg *msg, const void *peer)
Definition: rte_eal.h:189
int rte_eal_init(int argc, char **argv)
const char * rte_eal_mbuf_user_pool_ops(void)
int rte_eal_cleanup(void)
int rte_eal_create_uio_dev(void)
const char * rte_eal_get_runtime_dir(void)
void(* rte_usage_hook_t)(const char *prgname)
Definition: rte_eal.h:351
int rte_eal_primary_proc_alive(const char *config_file_path)
int rte_eal_iopl_init(void)
void rte_eal_vfio_get_vf_token(rte_uuid_t vf_token)
int rte_eal_has_hugepages(void)
int rte_sys_gettid(void)
void rte_mp_action_unregister(const char *name)
int rte_mp_action_register(const char *name, rte_mp_t action)
#define RTE_PER_LCORE(name)
Definition: rte_per_lcore.h:46
#define RTE_DECLARE_PER_LCORE(type, name)
Definition: rte_per_lcore.h:39
unsigned char rte_uuid_t[16]
Definition: rte_uuid.h:24