DPDK  20.05.0-rc0
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 <sched.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_bus.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
31 /* Maximum thread_name length. */
32 #define RTE_MAX_THREAD_NAME_LEN 16
33 
38  ROLE_RTE,
39  ROLE_OFF,
40  ROLE_SERVICE,
41 };
42 
47  RTE_PROC_AUTO = -1, /* allow auto-detection of primary/secondary */
48  RTE_PROC_PRIMARY = 0, /* set to zero, so primary is the default */
49  RTE_PROC_SECONDARY,
50 
51  RTE_PROC_INVALID
52 };
53 
61 
71 int rte_eal_iopl_init(void);
72 
131 int rte_eal_init(int argc, char **argv);
132 
144 int rte_eal_cleanup(void);
145 
161 int rte_eal_primary_proc_alive(const char *config_file_path);
162 
163 #define RTE_MP_MAX_FD_NUM 8 /* The max amount of fds */
164 #define RTE_MP_MAX_NAME_LEN 64 /* The max length of action name */
165 #define RTE_MP_MAX_PARAM_LEN 256 /* The max length of param */
166 struct rte_mp_msg {
167  char name[RTE_MP_MAX_NAME_LEN];
168  int len_param;
169  int num_fds;
170  uint8_t param[RTE_MP_MAX_PARAM_LEN];
171  int fds[RTE_MP_MAX_FD_NUM];
172 };
173 
174 struct rte_mp_reply {
175  int nb_sent;
176  int nb_received;
177  struct rte_mp_msg *msgs; /* caller to free */
178 };
179 
193 typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
194 
209 typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
210  const struct rte_mp_reply *reply);
211 
235 __rte_experimental
236 int
237 rte_mp_action_register(const char *name, rte_mp_t action);
238 
256 __rte_experimental
257 void
258 rte_mp_action_unregister(const char *name);
259 
276 __rte_experimental
277 int
278 rte_mp_sendmsg(struct rte_mp_msg *msg);
279 
311 __rte_experimental
312 int
313 rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
314  const struct timespec *ts);
315 
341 __rte_experimental
342 int
343 rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
345 
370 __rte_experimental
371 int
372 rte_mp_reply(struct rte_mp_msg *msg, const char *peer);
373 
380 typedef void (*rte_usage_hook_t)(const char * prgname);
381 
405 
413 int rte_eal_has_hugepages(void);
414 
422 int rte_eal_has_pci(void);
423 
430 int rte_eal_create_uio_dev(void);
431 
439 enum rte_intr_mode rte_eal_vfio_intr_mode(void);
440 
448 int rte_sys_gettid(void);
449 
457 static inline int rte_gettid(void)
458 {
459  static RTE_DEFINE_PER_LCORE(int, _thread_id) = -1;
460  if (RTE_PER_LCORE(_thread_id) == -1)
461  RTE_PER_LCORE(_thread_id) = rte_sys_gettid();
462  return RTE_PER_LCORE(_thread_id);
463 }
464 
472 
479 const char *
481 
488 const char *
490 
491 #ifdef __cplusplus
492 }
493 #endif
494 
495 #endif /* _RTE_EAL_H_ */
__rte_experimental int rte_mp_action_register(const char *name, rte_mp_t action)
int rte_sys_gettid(void)
enum rte_iova_mode rte_eal_iova_mode(void)
__rte_experimental void rte_mp_action_unregister(const char *name)
rte_lcore_role_t
Definition: rte_eal.h:37
int(* rte_mp_async_reply_t)(const struct rte_mp_msg *request, const struct rte_mp_reply *reply)
Definition: rte_eal.h:209
int rte_eal_create_uio_dev(void)
int rte_eal_has_hugepages(void)
rte_iova_mode
Definition: rte_bus.h:39
__rte_experimental int rte_mp_sendmsg(struct rte_mp_msg *msg)
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)
#define RTE_DEFINE_PER_LCORE(type, name)
Definition: rte_per_lcore.h:32
__rte_experimental int rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, const struct timespec *ts)
int rte_eal_cleanup(void)
void(* rte_usage_hook_t)(const char *prgname)
Definition: rte_eal.h:380
int rte_eal_primary_proc_alive(const char *config_file_path)
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:44
rte_proc_type_t
Definition: rte_eal.h:46
__rte_experimental int rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
__rte_experimental int rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, rte_mp_async_reply_t clb)
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:193
int rte_eal_has_pci(void)
static int rte_gettid(void)
Definition: rte_eal.h:457
int rte_eal_iopl_init(void)