suricata
|
Go to the source code of this file.
Data Structures | |
struct | PktPoolLockedStack_ |
struct | PktPool_ |
Typedefs | |
typedef struct PktPool_ | PktPool |
Functions | |
struct PktPoolLockedStack_ | __attribute__ ((aligned(CLS))) PktPoolLockedStack |
SC_ATOMIC_DECLARE (uint32_t, return_threshold) | |
Packet * | TmqhInputPacketpool (ThreadVars *) |
void | TmqhOutputPacketpool (ThreadVars *, Packet *) |
void | TmqhReleasePacketsToPacketPool (PacketQueue *) |
Release all the packets in the queue back to the packetpool. Mainly used by threads that have failed, and wants to return the packets back to the packetpool. More... | |
void | TmqhPacketpoolRegister (void) |
TmqhPacketpoolRegister \initonly. More... | |
Packet * | PacketPoolGetPacket (void) |
Get a new packet from the packet pool. More... | |
void | PacketPoolWait (void) |
void | PacketPoolReturnPacket (Packet *p) |
Return packet to Packet pool. More... | |
void | PacketPoolInit (void) |
void | PacketPoolDestroy (void) |
void | PacketPoolPostRunmodes (void) |
Set the max_pending_return_packets value. More... | |
Variables | |
SCMutex | mutex |
SCCondT | cond |
uint32_t | cnt |
Packet * | head |
Definition in file tmqh-packetpool.h.
struct PktPoolLockedStack_ __attribute__ | ( | (aligned(CLS)) | ) |
void PacketPoolDestroy | ( | void | ) |
Definition at line 274 of file tmqh-packetpool.c.
Packet* PacketPoolGetPacket | ( | void | ) |
Get a new packet from the packet pool.
Only allocates from the thread's local stack, or mallocs new packets. If the local stack is empty, first move all the return stack packets to the local stack.
Packet | pointer, or NULL on failure. |
Definition at line 127 of file tmqh-packetpool.c.
Referenced by FlowPseudoPacketGet(), PacketGetFromQueueOrAlloc(), and TmqhInputPacketpool().
void PacketPoolInit | ( | void | ) |
Definition at line 244 of file tmqh-packetpool.c.
Referenced by PostRunDeinit().
void PacketPoolPostRunmodes | ( | void | ) |
Set the max_pending_return_packets value.
Set it to the max pending packets value, divided by the number of lister threads. Normally, in autofp these are the stream/detect/log worker threads.
The max_pending_return_packets value needs to stay below the packet pool size of the 'producers' (normally pkt capture threads but also flow timeout injection ) to avoid a deadlock where all the 'workers' keep packets in their return pools, while the capture thread can't continue because its pool is empty.
Definition at line 459 of file tmqh-packetpool.c.
References FatalError, max_pending_packets, RESERVED_PACKETS, TM_FLAG_DETECT_TM, and TmThreadCountThreadsByTmmFlags().
Referenced by SuricataPostInit().
void PacketPoolReturnPacket | ( | Packet * | p | ) |
Return packet to Packet pool.
Definition at line 177 of file tmqh-packetpool.c.
Referenced by PacketFreeOrRelease(), and PacketGetFromQueueOrAlloc().
void PacketPoolWait | ( | void | ) |
Definition at line 80 of file tmqh-packetpool.c.
Referenced by FlowPseudoPacketGet(), and ReceiveErfFileLoop().
__attribute__::SC_ATOMIC_DECLARE | ( | uint32_t | , |
return_threshold | |||
) |
number of packets in needed to trigger a sync during the return to pool logic. Updated by pool owner based on how full the pool is.
Packet* TmqhInputPacketpool | ( | ThreadVars * | ) |
Definition at line 309 of file tmqh-packetpool.c.
References PacketPoolGetPacket().
Referenced by TmqhPacketpoolRegister().
void TmqhOutputPacketpool | ( | ThreadVars * | , |
Packet * | |||
) |
Definition at line 314 of file tmqh-packetpool.c.
References BOOL2STR, Packet_::pool, Packet_::root, SCEnter, and SCLogDebug.
Referenced by TmqhPacketpoolRegister(), and TmqhReleasePacketsToPacketPool().
void TmqhPacketpoolRegister | ( | void | ) |
TmqhPacketpoolRegister \initonly.
Definition at line 55 of file tmqh-packetpool.c.
References Tmqh_::InHandler, Tmqh_::name, Tmqh_::OutHandler, TMQH_PACKETPOOL, tmqh_table, TmqhInputPacketpool(), and TmqhOutputPacketpool().
Referenced by TmqhSetup().
void TmqhReleasePacketsToPacketPool | ( | PacketQueue * | pq | ) |
Release all the packets in the queue back to the packetpool. Mainly used by threads that have failed, and wants to return the packets back to the packetpool.
pq | Pointer to the packetqueue from which the packets have to be returned back to the packetpool |
Definition at line 427 of file tmqh-packetpool.c.
References DEBUG_VALIDATE_BUG_ON, Packet_::flow, PacketDequeue(), and TmqhOutputPacketpool().
uint32_t cnt |
Definition at line 7 of file tmqh-packetpool.h.
Referenced by DefragTimeoutHash(), DetectPortPrintList(), DetectSetFastPatternAndItsId(), HostTimeoutHash(), IPPairTimeoutHash(), LLVMFuzzerTestOneInput(), MpmStorePrepareBuffer(), OutputSetupActiveLoggers(), PrefilterSetupRuleGroup(), SigGroupHeadSetSigCnt(), SigPrepareStage4(), StreamTcpSegmentForEach(), StreamTcpSegmentForSession(), THashExpire(), TmThreadCountThreadsByTmmFlags(), UTHCheckDataAtPosition(), and UTHCheckGapAtPosition().
SCCondT cond |
Definition at line 2 of file tmqh-packetpool.h.
Packet* head |
Definition at line 8 of file tmqh-packetpool.h.
SCMutex mutex |
Definition at line 1 of file tmqh-packetpool.h.