DPDK  2.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions
rte_eal.h File Reference
#include <stdint.h>
#include <sched.h>
#include <rte_per_lcore.h>

Data Structures

struct  rte_config

Macros

#define RTE_MAGIC   19820526
#define RTE_EAL_TAILQ_RWLOCK   (&rte_eal_get_configuration()->mem_config->qlock)
#define RTE_EAL_MEMPOOL_RWLOCK   (&rte_eal_get_configuration()->mem_config->mplock)

Typedefs

typedef void(* rte_usage_hook_t )(const char *prgname)

Enumerations

enum  rte_lcore_role_t
enum  rte_proc_type_t

Functions

struct rte_configrte_eal_get_configuration (void)
enum rte_lcore_role_t rte_eal_lcore_role (unsigned lcore_id)
enum rte_proc_type_t rte_eal_process_type (void)
int rte_eal_iopl_init (void)
int rte_eal_init (int argc, char **argv)
rte_usage_hook_t rte_set_application_usage_hook (rte_usage_hook_t usage_func)
int rte_eal_has_hugepages (void)
int rte_sys_gettid (void)
static int rte_gettid (void)

Detailed Description

EAL Configuration API

Macro Definition Documentation

#define RTE_EAL_MEMPOOL_RWLOCK   (&rte_eal_get_configuration()->mem_config->mplock)

macro to get the multiple lock of mempool shared by mutiple-instance

#define RTE_EAL_TAILQ_RWLOCK   (&rte_eal_get_configuration()->mem_config->qlock)

macro to get the lock of tailq in mem_config

#define RTE_MAGIC   19820526

Magic number written by the main partition when ready.

Typedef Documentation

typedef void(* rte_usage_hook_t)(const char *prgname)

Usage function typedef used by the application usage function.

Use this function typedef to define and call rte_set_applcation_usage_hook() routine.

Enumeration Type Documentation

The lcore role (used in RTE or not).

The type of process in a linuxapp, multi-process setup

Function Documentation

struct rte_config* rte_eal_get_configuration ( void  )
read

Get the global configuration structure.

Returns
A pointer to the global configuration structure.
int rte_eal_has_hugepages ( void  )

Whether EAL is using huge pages (disabled by –no-huge option). The no-huge mode cannot be used with UIO poll-mode drivers like igb/ixgbe. It is useful for NIC drivers (e.g. librte_pmd_mlx4, librte_pmd_vmxnet3) or crypto drivers (e.g. librte_crypto_nitrox) provided by third-parties such as 6WIND.

Returns
Nonzero if hugepages are enabled.
int rte_eal_init ( int  argc,
char **  argv 
)

Initialize the Environment Abstraction Layer (EAL).

This function is to be executed on the MASTER lcore only, as soon as possible in the application's main() function.

The function finishes the initialization process before main() is called. It puts the SLAVE lcores in the WAIT state.

When the multi-partition feature is supported, depending on the configuration (if CONFIG_RTE_EAL_MAIN_PARTITION is disabled), this function waits to ensure that the magic number is set before returning. See also the rte_eal_get_configuration() function. Note: This behavior may change in the future.

Parameters
argcThe argc argument that was given to the main() function.
argvThe argv argument that was given to the main() function.
Returns
  • On success, the number of parsed arguments, which is greater or equal to zero. After the call to rte_eal_init(), all arguments argv[x] with x < ret may be modified and should not be accessed by the application.
  • On failure, a negative error value.
int rte_eal_iopl_init ( void  )

Request iopl privilege for all RPL.

This function should be called by pmds which need access to ioports.

Returns
  • On success, returns 0.
  • On failure, returns -1.
enum rte_lcore_role_t rte_eal_lcore_role ( unsigned  lcore_id)

Get a lcore's role.

Parameters
lcore_idThe identifier of the lcore.
Returns
The role of the lcore.
enum rte_proc_type_t rte_eal_process_type ( void  )

Get the process type in a multi-process setup

Returns
The process type
static int rte_gettid ( void  )
inlinestatic

Get system unique thread id.

Returns
On success, returns the thread ID of calling process. It is always successful.
rte_usage_hook_t rte_set_application_usage_hook ( rte_usage_hook_t  usage_func)

Add application usage routine callout from the eal_usage() routine.

This function allows the application to include its usage message in the EAL system usage message. The routine rte_set_application_usage_hook() needs to be called before the rte_eal_init() routine in the application.

This routine is optional for the application and will behave as if the set routine was never called as the default behavior.

Parameters
funcThe func argument is a function pointer to the application usage routine. Called function is defined using rte_usage_hook_t typedef, which is of the form void rte_usage_func(const char * prgname).

Calling this routine with a NULL value will reset the usage hook routine and return the current value, which could be NULL.

Returns
  • Returns the current value of the rte_application_usage pointer to allow the caller to daisy chain the usage routines if needing more then one.
int rte_sys_gettid ( void  )

A wrap API for syscall gettid.

Returns
On success, returns the thread ID of calling process. It is always successful.