NDN-DPDK
High-Speed Named Data Networking Forwarder
Loading...
Searching...
No Matches
common.h File Reference
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <memory.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <rte_config.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <urcu/list.h>
#include <rte_bitops.h>
#include <rte_byteorder.h>
#include <rte_cycles.h>
#include <rte_debug.h>
#include <rte_errno.h>
#include <rte_lcore_var.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <spdk/util.h>

Go to the source code of this file.

Macros

#define ALLOW_EXPERIMENTAL_API
#define NDNDPDK_ASSERT(x)
#define LCORE_VAR_SAFE(handle)
 RTE_LCORE_VAR but returns valid pointer when called from non-lcore thread.
#define STATIC_ASSERT_FUNC_TYPE(typ, func)
#define NULLize(x)
 Set x to NULL to expose memory access bugs.
#define POISON_2_(x, size)
#define POISON_1_(x)
#define POISON_Arg3_(a1, a2, a3, ...)
#define POISON_Choose_(...)
#define POISON(...)
 Write junk to memory region to expose memory access bugs.
#define CLAMP(x, lo, hi)

Macro Definition Documentation

◆ ALLOW_EXPERIMENTAL_API

#define ALLOW_EXPERIMENTAL_API

◆ CLAMP

#define CLAMP ( x,
lo,
hi )
Value:
RTE_MAX((lo), RTE_MIN((hi), (x)))

◆ LCORE_VAR_SAFE

#define LCORE_VAR_SAFE ( handle)
Value:
__extension__({ \
unsigned lc = rte_lcore_id(); \
RTE_LCORE_VAR_LCORE(lc == LCORE_ID_ANY ? RTE_MAX_LCORE - 1 : lc, handle); \
})

RTE_LCORE_VAR but returns valid pointer when called from non-lcore thread.

◆ NDNDPDK_ASSERT

#define NDNDPDK_ASSERT ( x)
Value:
RTE_VERIFY((x))

◆ NULLize

#define NULLize ( x)
Value:
do { \
(x) = NULL; \
} while (false)

Set x to NULL to expose memory access bugs.

◆ POISON

#define POISON ( ...)
Value:
POISON_Choose_(__VA_ARGS__)(__VA_ARGS__)
#define POISON_Choose_(...)
Definition common.h:96

Write junk to memory region to expose memory access bugs.

POISON(&var);
POISON(&var, sizeof(var));
#define POISON(...)
Write junk to memory region to expose memory access bugs.
Definition common.h:104

◆ POISON_1_

#define POISON_1_ ( x)
Value:
POISON_2_((x), sizeof(*(x)))
#define POISON_2_(x, size)
Definition common.h:88

◆ POISON_2_

#define POISON_2_ ( x,
size )
Value:
do { \
RTE_SET_USED(x); \
RTE_SET_USED(size); \
} while (false)

◆ POISON_Arg3_

#define POISON_Arg3_ ( a1,
a2,
a3,
... )
Value:
a3

◆ POISON_Choose_

#define POISON_Choose_ ( ...)
Value:
#define POISON_1_(x)
Definition common.h:94
#define POISON_Arg3_(a1, a2, a3,...)
Definition common.h:95

◆ STATIC_ASSERT_FUNC_TYPE

#define STATIC_ASSERT_FUNC_TYPE ( typ,
func )
Value:
static_assert(__builtin_types_compatible_p(typ, typeof(&func)), "")