void PacketPoolDestroy(void) { if (ringbuffer == NULL) { return; } Packet *p = NULL; while ((p = PacketPoolGetPacket()) != NULL) { PACKET_CLEANUP(p); SCFree(p); } RingBufferDestroy(ringbuffer); ringbuffer = NULL; }
/** * \brief Get a packet. We try to get a packet from the packetpool first, but * if that is empty we alloc a packet that is free'd again after * processing. * * \retval p packet, NULL on error */ Packet *PacketGetFromQueueOrAlloc(void) { /* try the pool first */ Packet *p = PacketPoolGetPacket(); if (p == NULL) { /* non fatal, we're just not processing a packet then */ p = PacketGetFromAlloc(); } else { PACKET_PROFILING_START(p); } return p; }
static inline Packet *FlowForceReassemblyPseudoPacketGet(int direction, Flow *f, TcpSession *ssn, int dummy) { PacketPoolWait(); Packet *p = PacketPoolGetPacket(); if (p == NULL) { return NULL; } PACKET_PROFILING_START(p); return FlowForceReassemblyPseudoPacketSetup(p, direction, f, ssn, dummy); }
void PacketPoolDestroy(void) { Packet *p = NULL; PktPool *my_pool = GetThreadPacketPool(); #ifdef DEBUG_VALIDATION BUG_ON(my_pool->destroyed); #endif /* DEBUG_VALIDATION */ if (my_pool && my_pool->pending_pool != NULL) { p = my_pool->pending_head; while (p) { Packet *next_p = p->next; PacketFree(p); p = next_p; my_pool->pending_count--; } #ifdef DEBUG_VALIDATION BUG_ON(my_pool->pending_count); #endif /* DEBUG_VALIDATION */ my_pool->pending_pool = NULL; my_pool->pending_head = NULL; my_pool->pending_tail = NULL; } while ((p = PacketPoolGetPacket()) != NULL) { PacketFree(p); } SC_ATOMIC_DESTROY(my_pool->return_stack.sync_now); #ifdef DEBUG_VALIDATION my_pool->initialized = 0; my_pool->destroyed = 1; #endif /* DEBUG_VALIDATION */ }
Packet *TmqhInputPacketpool(ThreadVars *tv) { return PacketPoolGetPacket(); }