DPDK  21.11.8
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.
Examples:
examples/qos_sched/args.c.

Definition at line 30 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 38 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 57 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 78 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 99 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 123 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 149 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 176 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 197 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 218 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 242 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 268 of file rte_bitops.h.