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

Go to the source code of this file.

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)
 
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)
 
int rte_eal_has_hugepages (void)
 
int rte_sys_gettid (void)
 
static int rte_gettid (void)
 

Detailed Description

EAL Configuration API

Definition in file rte_eal.h.

Macro Definition Documentation

#define RTE_MAGIC   19820526

Magic number written by the main partition when ready.

Definition at line 53 of file rte_eal.h.

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

macro to get the lock of tailq in mem_config

Definition at line 213 of file rte_eal.h.

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

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

Definition at line 218 of file rte_eal.h.

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.

Definition at line 184 of file rte_eal.h.

Enumeration Type Documentation

The lcore role (used in RTE or not).

Definition at line 61 of file rte_eal.h.

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

Definition at line 69 of file rte_eal.h.

Function Documentation

struct rte_config* rte_eal_get_configuration ( void  )

Get the global configuration structure.

Returns
A pointer to the global configuration structure.
Examples:
multi_process/l2fwd_fork/flib.c, multi_process/symmetric_mp/main.c, and qos_sched/args.c.
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
Examples:
multi_process/simple_mp/main.c, and multi_process/symmetric_mp/main.c.
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.
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.
Examples:
bond/main.c, cmdline/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, exception_path/main.c, helloworld/main.c, ip_fragmentation/main.c, ip_pipeline/init.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/main.c, multi_process/client_server_mp/mp_client/client.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/simple_mp/main.c, multi_process/symmetric_mp/main.c, netmap_compat/bridge/bridge.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, performance-thread/pthread_shim/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/args.c, quota_watermark/qw/main.c, quota_watermark/qwctl/qwctl.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/main.c, timer/main.c, vhost/main.c, vhost_xen/main.c, vm_power_manager/guest_cli/main.c, vm_power_manager/main.c, vmdq/main.c, and vmdq_dcb/main.c.
int rte_eal_primary_proc_alive ( const char *  config_file_path)

Check if a primary process is currently alive

This function returns true when a primary process is currently active.

Parameters
config_file_pathThe config_file_path argument provided should point at the location that the primary process will create its config file. If NULL, the default config file path is used.
Returns
  • If alive, returns 1.
  • If dead, returns 0.
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
usage_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_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_sys_gettid ( void  )

A wrap API for syscall gettid.

Returns
On success, returns the thread ID of calling process. It is always successful.
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.

Definition at line 248 of file rte_eal.h.