Go to the documentation of this file.
24 #ifndef __DEFRAG_HASH_H__
25 #define __DEFRAG_HASH_H__
37 #error Cannot enable both DRLOCK_SPIN and DRLOCK_MUTEX
42 #define DRLOCK_TYPE SCSpinlock
43 #define DRLOCK_INIT(fb) SCSpinInit(&(fb)->lock, 0)
44 #define DRLOCK_DESTROY(fb) SCSpinDestroy(&(fb)->lock)
45 #define DRLOCK_LOCK(fb) SCSpinLock(&(fb)->lock)
46 #define DRLOCK_TRYLOCK(fb) SCSpinTrylock(&(fb)->lock)
47 #define DRLOCK_UNLOCK(fb) SCSpinUnlock(&(fb)->lock)
48 #elif defined DRLOCK_MUTEX
49 #define DRLOCK_TYPE SCMutex
50 #define DRLOCK_INIT(fb) SCMutexInit(&(fb)->lock, NULL)
51 #define DRLOCK_DESTROY(fb) SCMutexDestroy(&(fb)->lock)
52 #define DRLOCK_LOCK(fb) SCMutexLock(&(fb)->lock)
53 #define DRLOCK_TRYLOCK(fb) SCMutexTrylock(&(fb)->lock)
54 #define DRLOCK_UNLOCK(fb) SCMutexUnlock(&(fb)->lock)
56 #error Enable DRLOCK_SPIN or DRLOCK_MUTEX
83 #define DEFRAG_CHECK_MEMCAP(size) \
84 ((((uint64_t)SC_ATOMIC_GET(defrag_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(defrag_config.memcap)))
DefragTracker * DefragGetTrackerFromHash(Packet *)
DefragTracker * DefragLookupTrackerFromHash(Packet *)
look up a tracker in the hash
struct DefragConfig_ DefragConfig
void DefragHashShutdown(void)
shutdown the flow engine
void DefragTrackerRelease(DefragTracker *)
uint32_t DefragTrackerSpareQueueGetSize(void)
void DefragTrackerMoveToSpare(DefragTracker *)
struct DefragTrackerHashRow_ DefragTrackerHashRow
DefragConfig defrag_config
uint64_t DefragTrackerGetMemuse(void)
Return memuse value.
void DefragInitConfig(bool quiet)
initialize the configuration
uint64_t DefragTrackerGetMemcap(void)
Return memcap value.
int DefragTrackerSetMemcap(uint64_t)
Update memcap value.
enum ExceptionPolicy memcap_policy
void DefragTrackerClearMemory(DefragTracker *)
DefragTrackerHashRow * defragtracker_hash
SC_ATOMIC_EXTERN(uint64_t, defrag_memuse)
SC_ATOMIC_DECLARE(uint64_t, memcap)