DPDK  21.08.0
Macros | Functions
rte_bitops.h File Reference
#include <stdint.h>
#include <rte_debug.h>
#include <rte_compat.h>

Go to the source code of this file.

Macros

#define RTE_BIT64(nr)   (UINT64_C(1) << (nr))
 
#define RTE_BIT32(nr)   (UINT32_C(1) << (nr))
 

Functions

static __rte_experimental uint32_t rte_bit_relaxed_get32 (unsigned int nr, volatile uint32_t *addr)
 
static __rte_experimental void rte_bit_relaxed_set32 (unsigned int nr, volatile uint32_t *addr)
 
static __rte_experimental void rte_bit_relaxed_clear32 (unsigned int nr, volatile uint32_t *addr)
 
static __rte_experimental uint32_t rte_bit_relaxed_test_and_set32 (unsigned int nr, volatile uint32_t *addr)
 
static __rte_experimental uint32_t rte_bit_relaxed_test_and_clear32 (unsigned int nr, volatile uint32_t *addr)
 
static __rte_experimental uint64_t rte_bit_relaxed_get64 (unsigned int nr, volatile uint64_t *addr)
 
static __rte_experimental void rte_bit_relaxed_set64 (unsigned int nr, volatile uint64_t *addr)
 
static __rte_experimental void rte_bit_relaxed_clear64 (unsigned int nr, volatile uint64_t *addr)
 
static __rte_experimental uint64_t rte_bit_relaxed_test_and_set64 (unsigned int nr, volatile uint64_t *addr)
 
static __rte_experimental uint64_t rte_bit_relaxed_test_and_clear64 (unsigned int nr, volatile uint64_t *addr)
 

Detailed Description

Bit Operations

This file defines a family of APIs for bit operations without enforcing memory ordering.

Definition in file rte_bitops.h.

Macro Definition Documentation

◆ RTE_BIT64

#define RTE_BIT64 (   nr)    (UINT64_C(1) << (nr))

Get the uint64_t value for a specified bit set.

Parameters
nrThe bit number in range of 0 to 63.

Definition at line 26 of file rte_bitops.h.

◆ RTE_BIT32

#define RTE_BIT32 (   nr)    (UINT32_C(1) << (nr))

Get the uint32_t value for a specified bit set.

Parameters
nrThe bit number in range of 0 to 31.

Definition at line 34 of file rte_bitops.h.

Function Documentation

◆ rte_bit_relaxed_get32()

static __rte_experimental uint32_t rte_bit_relaxed_get32 ( unsigned int  nr,
volatile uint32_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Get the target bit from a 32-bit value without memory ordering.

Parameters
nrThe target bit to get.
addrThe address holding the bit.
Returns
The target bit.

Definition at line 53 of file rte_bitops.h.

◆ rte_bit_relaxed_set32()

static __rte_experimental void rte_bit_relaxed_set32 ( unsigned int  nr,
volatile uint32_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Set the target bit in a 32-bit value to 1 without memory ordering.

Parameters
nrThe target bit to set.
addrThe address holding the bit.

Definition at line 74 of file rte_bitops.h.

◆ rte_bit_relaxed_clear32()

static __rte_experimental void rte_bit_relaxed_clear32 ( unsigned int  nr,
volatile uint32_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Clear the target bit in a 32-bit value to 0 without memory ordering.

Parameters
nrThe target bit to clear.
addrThe address holding the bit.

Definition at line 95 of file rte_bitops.h.

◆ rte_bit_relaxed_test_and_set32()

static __rte_experimental uint32_t rte_bit_relaxed_test_and_set32 ( unsigned int  nr,
volatile uint32_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Return the original bit from a 32-bit value, then set it to 1 without memory ordering.

Parameters
nrThe target bit to get and set.
addrThe address holding the bit.
Returns
The original bit.

Definition at line 119 of file rte_bitops.h.

◆ rte_bit_relaxed_test_and_clear32()

static __rte_experimental uint32_t rte_bit_relaxed_test_and_clear32 ( unsigned int  nr,
volatile uint32_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Return the original bit from a 32-bit value, then clear it to 0 without memory ordering.

Parameters
nrThe target bit to get and clear.
addrThe address holding the bit.
Returns
The original bit.

Definition at line 145 of file rte_bitops.h.

◆ rte_bit_relaxed_get64()

static __rte_experimental uint64_t rte_bit_relaxed_get64 ( unsigned int  nr,
volatile uint64_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Get the target bit from a 64-bit value without memory ordering.

Parameters
nrThe target bit to get.
addrThe address holding the bit.
Returns
The target bit.

Definition at line 172 of file rte_bitops.h.

◆ rte_bit_relaxed_set64()

static __rte_experimental void rte_bit_relaxed_set64 ( unsigned int  nr,
volatile uint64_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Set the target bit in a 64-bit value to 1 without memory ordering.

Parameters
nrThe target bit to set.
addrThe address holding the bit.

Definition at line 193 of file rte_bitops.h.

◆ rte_bit_relaxed_clear64()

static __rte_experimental void rte_bit_relaxed_clear64 ( unsigned int  nr,
volatile uint64_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Clear the target bit in a 64-bit value to 0 without memory ordering.

Parameters
nrThe target bit to clear.
addrThe address holding the bit.

Definition at line 214 of file rte_bitops.h.

◆ rte_bit_relaxed_test_and_set64()

static __rte_experimental uint64_t rte_bit_relaxed_test_and_set64 ( unsigned int  nr,
volatile uint64_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Return the original bit from a 64-bit value, then set it to 1 without memory ordering.

Parameters
nrThe target bit to get and set.
addrThe address holding the bit.
Returns
The original bit.

Definition at line 238 of file rte_bitops.h.

◆ rte_bit_relaxed_test_and_clear64()

static __rte_experimental uint64_t rte_bit_relaxed_test_and_clear64 ( unsigned int  nr,
volatile uint64_t *  addr 
)
inlinestatic
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Return the original bit from a 64-bit value, then clear it to 0 without memory ordering.

Parameters
nrThe target bit to get and clear.
addrThe address holding the bit.
Returns
The original bit.

Definition at line 264 of file rte_bitops.h.