NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rte_config.h>
#include <rte_bitops.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <float.h>
#include <math.h>
#include <urcu/list.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)   RTE_VERIFY((x))
 
#define LCORE_VAR_SAFE(handle)
 RTE_LCORE_VAR but returns valid pointer when called from non-lcore thread. More...
 
#define STATIC_ASSERT_FUNC_TYPE(typ, func)    static_assert(__builtin_types_compatible_p(typ, typeof(&func)), "")
 
#define NULLize(x)
 Set x to NULL to expose memory access bugs. More...
 
#define POISON_2_(x, size)
 
#define POISON_1_(x)   POISON_2_((x), sizeof(*(x)))
 
#define POISON_Arg3_(a1, a2, a3, ...)   a3
 
#define POISON_Choose_(...)   POISON_Arg3_(__VA_ARGS__, POISON_2_, POISON_1_)
 
#define POISON(...)   POISON_Choose_(__VA_ARGS__)(__VA_ARGS__)
 Write junk to memory region to expose memory access bugs. More...
 
#define CLAMP(x, lo, hi)   RTE_MAX((lo), RTE_MIN((hi), (x)))
 

Macro Definition Documentation

◆ ALLOW_EXPERIMENTAL_API

#define ALLOW_EXPERIMENTAL_API

◆ CLAMP

#define CLAMP (   x,
  lo,
  hi 
)    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)    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 (   ...)    POISON_Choose_(__VA_ARGS__)(__VA_ARGS__)

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)    POISON_2_((x), sizeof(*(x)))

◆ 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,
  ... 
)    a3

◆ POISON_Choose_

#define POISON_Choose_ (   ...)    POISON_Arg3_(__VA_ARGS__, POISON_2_, POISON_1_)

◆ STATIC_ASSERT_FUNC_TYPE

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