Go to the documentation of this file.
36 #error Cannot enable both HRLOCK_SPIN and HRLOCK_MUTEX
41 #define HRLOCK_TYPE SCSpinlock
42 #define HRLOCK_INIT(fb) SCSpinInit(&(fb)->lock, 0)
43 #define HRLOCK_DESTROY(fb) SCSpinDestroy(&(fb)->lock)
44 #define HRLOCK_LOCK(fb) SCSpinLock(&(fb)->lock)
45 #define HRLOCK_TRYLOCK(fb) SCSpinTrylock(&(fb)->lock)
46 #define HRLOCK_UNLOCK(fb) SCSpinUnlock(&(fb)->lock)
47 #elif defined HRLOCK_MUTEX
48 #define HRLOCK_TYPE SCMutex
49 #define HRLOCK_INIT(fb) SCMutexInit(&(fb)->lock, NULL)
50 #define HRLOCK_DESTROY(fb) SCMutexDestroy(&(fb)->lock)
51 #define HRLOCK_LOCK(fb) SCMutexLock(&(fb)->lock)
52 #define HRLOCK_TRYLOCK(fb) SCMutexTrylock(&(fb)->lock)
53 #define HRLOCK_UNLOCK(fb) SCMutexUnlock(&(fb)->lock)
55 #error Enable HRLOCK_SPIN or HRLOCK_MUTEX
89 #define IPPAIR_VERBOSE 0
90 #define IPPAIR_QUIET 1
106 #define IPPAIR_CHECK_MEMCAP(size) \
107 ((((uint64_t)SC_ATOMIC_GET(ippair_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(ippair_config.memcap)))
109 #define IPPairIncrUsecnt(h) \
110 (void)SC_ATOMIC_ADD((h)->use_cnt, 1)
111 #define IPPairDecrUsecnt(h) \
112 (void)SC_ATOMIC_SUB((h)->use_cnt, 1)
114 #define IPPairReference(dst_h_ptr, h) do { \
116 IPPairIncrUsecnt((h)); \
121 #define IPPairDeReference(src_h_ptr) do { \
122 if (*(src_h_ptr) != NULL) { \
123 IPPairDecrUsecnt(*(src_h_ptr)); \
124 *(src_h_ptr) = NULL; \
int IPPairSetMemcap(uint64_t size)
Update memcap value.
void IPPairMoveToSpare(IPPair *)
struct IPPairHashRow_ __attribute__((aligned(CLS))) IPPairHashRow
uint64_t IPPairGetMemuse(void)
Return memuse value.
IPPairHashRow * ippair_hash
IPPairConfig ippair_config
void IPPairClearMemory(IPPair *)
void IPPairLock(IPPair *)
struct IPPairConfig_ IPPairConfig
void IPPairPrintStats(void)
print some ippair stats
void IPPairFree(IPPair *)
void IPPairRegisterUnittests(void)
void IPPairUnlock(IPPair *)
SC_ATOMIC_DECLARE(uint64_t, memcap)
uint32_t IPPairSpareQueueGetSize(void)
IPPair * IPPairAlloc(void)
void IPPairRelease(IPPair *)
uint64_t IPPairGetMemcap(void)
Return memcap value.
SC_ATOMIC_EXTERN(uint64_t, ippair_memuse)
void IPPairCleanup(void)
Cleanup the ippair engine.
void IPPairInitConfig(bool quiet)
initialize the configuration
SC_ATOMIC_DECLARE(unsigned int, use_cnt)
IPPair * IPPairLookupIPPairFromHash(Address *, Address *)
look up a ippair in the hash
IPPair * IPPairGetIPPairFromHash(Address *, Address *)
void IPPairShutdown(void)
shutdown the flow engine