DPDK  19.11.14
Macros
rte_per_lcore.h File Reference
#include <pthread.h>

Go to the source code of this file.

Macros

#define RTE_DEFINE_PER_LCORE(type, name)   __thread __typeof__(type) per_lcore_##name
 
#define RTE_DECLARE_PER_LCORE(type, name)   extern __thread __typeof__(type) per_lcore_##name
 
#define RTE_PER_LCORE(name)   (per_lcore_##name)
 

Detailed Description

Per-lcore variables in RTE

This file defines an API for instantiating per-lcore "global variables" that are environment-specific. Note that in all environments, a "shared variable" is the default when you use a global variable.

Parts of this are execution environment specific.

Definition in file rte_per_lcore.h.

Macro Definition Documentation

◆ RTE_DEFINE_PER_LCORE

#define RTE_DEFINE_PER_LCORE (   type,
  name 
)    __thread __typeof__(type) per_lcore_##name

Macro to define a per lcore variable "var" of type "type", don't use keywords like "static" or "volatile" in type, just prefix the whole macro.

Examples:
examples/performance-thread/common/lthread_sched.c, and examples/performance-thread/l3fwd-thread/main.c.

Definition at line 32 of file rte_per_lcore.h.

◆ RTE_DECLARE_PER_LCORE

#define RTE_DECLARE_PER_LCORE (   type,
  name 
)    extern __thread __typeof__(type) per_lcore_##name

Macro to declare an extern per lcore variable "var" of type "type"

Definition at line 38 of file rte_per_lcore.h.

◆ RTE_PER_LCORE

#define RTE_PER_LCORE (   name)    (per_lcore_##name)

Read/write the per-lcore variable value

Examples:
examples/performance-thread/l3fwd-thread/main.c.

Definition at line 44 of file rte_per_lcore.h.