DPDK  20.05.0
Functions
rte_pause.h File Reference
#include <stdint.h>
#include <assert.h>
#include <rte_common.h>
#include <rte_atomic.h>
#include <rte_compat.h>

Go to the source code of this file.

Functions

static void rte_pause (void)
 
static __rte_experimental __rte_always_inline void rte_wait_until_equal_16 (volatile uint16_t *addr, uint16_t expected, int memorder)
 
static __rte_experimental __rte_always_inline void rte_wait_until_equal_32 (volatile uint32_t *addr, uint32_t expected, int memorder)
 
static __rte_experimental __rte_always_inline void rte_wait_until_equal_64 (volatile uint64_t *addr, uint64_t expected, int memorder)
 

Detailed Description

CPU pause operation.

Definition in file rte_pause.h.

Function Documentation

static void rte_pause ( void  )
inlinestatic

Pause CPU execution for a short while

This call is intended for tight loops which poll a shared resource or wait for an event. A short pause within the loop may reduce the power consumption.

Examples:
examples/distributor/main.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/l2fwd-jobstats/main.c, examples/l3fwd/l3fwd_em.c, examples/l3fwd/l3fwd_lpm.c, examples/performance-thread/l3fwd-thread/main.c, examples/tep_termination/main.c, and examples/vhost/main.c.
static __rte_always_inline void rte_wait_until_equal_16 ( volatile uint16_t *  addr,
uint16_t  expected,
int  memorder 
)
static
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Wait for *addr to be updated with a 16-bit expected value, with a relaxed memory ordering model meaning the loads around this API can be reordered.

Parameters
addrA pointer to the memory location.
expectedA 16-bit expected value to be in the memory location.
memorderTwo different memory orders that can be specified: __ATOMIC_ACQUIRE and __ATOMIC_RELAXED. These map to C++11 memory orders with the same names, see the C++11 standard or the GCC wiki on atomic synchronization for detailed definition.

Definition at line 98 of file rte_pause.h.

static __rte_always_inline void rte_wait_until_equal_32 ( volatile uint32_t *  addr,
uint32_t  expected,
int  memorder 
)
static
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Wait for *addr to be updated with a 32-bit expected value, with a relaxed memory ordering model meaning the loads around this API can be reordered.

Parameters
addrA pointer to the memory location.
expectedA 32-bit expected value to be in the memory location.
memorderTwo different memory orders that can be specified: __ATOMIC_ACQUIRE and __ATOMIC_RELAXED. These map to C++11 memory orders with the same names, see the C++11 standard or the GCC wiki on atomic synchronization for detailed definition.

Definition at line 108 of file rte_pause.h.

static __rte_always_inline void rte_wait_until_equal_64 ( volatile uint64_t *  addr,
uint64_t  expected,
int  memorder 
)
static
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Wait for *addr to be updated with a 64-bit expected value, with a relaxed memory ordering model meaning the loads around this API can be reordered.

Parameters
addrA pointer to the memory location.
expectedA 64-bit expected value to be in the memory location.
memorderTwo different memory orders that can be specified: __ATOMIC_ACQUIRE and __ATOMIC_RELAXED. These map to C++11 memory orders with the same names, see the C++11 standard or the GCC wiki on atomic synchronization for detailed definition.

Definition at line 118 of file rte_pause.h.