memset(p, 0, SIZE_OF_PACKET);
PacketInit(p);
p->ReleasePacket = PacketFree;
- p->flags |= PKT_ALLOC;
SCLogDebug("allocated a new packet only using alloc...");
*/
void PacketFreeOrRelease(Packet *p)
{
- if (p->flags & PKT_ALLOC)
- PacketFree(p);
- else {
+ if (likely(p->pool != NULL)) {
p->ReleasePacket = PacketPoolReturnPacket;
PacketPoolReturnPacket(p);
+ } else {
+ PacketFree(p);
}
}
/** Flag to indicate that packet contents should not be inspected */
#define PKT_NOPAYLOAD_INSPECTION BIT_U32(2)
-/** Packet was alloc'd this run, needs to be freed */
-#define PKT_ALLOC BIT_U32(3)
+// vacancy
+
/** Packet has matched a tag */
#define PKT_HAS_TAG BIT_U32(4)
/** Packet payload was added to reassembled stream */
p->proto = 0;
p->recursion_level = 0;
PACKET_FREE_EXTDATA(p);
- p->flags = p->flags & PKT_ALLOC;
+ p->flags = 0;
p->flowflags = 0;
p->pkt_src = 0;
p->vlan_id[0] = 0;
*/
static void PacketPoolStorePacket(Packet *p)
{
- /* Clear the PKT_ALLOC flag, since that indicates to push back
- * onto the ring buffer. */
- p->flags &= ~PKT_ALLOC;
p->pool = GetThreadPacketPool();
p->ReleasePacket = PacketPoolReturnPacket;
PacketPoolReturnPacket(p);
bool proot = false;
SCEnter();
- SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, p->flags & PKT_ALLOC ? "true" : "false");
+ SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, BOOL2STR(p->pool == NULL));
if (IS_TUNNEL_PKT(p)) {
SCLogDebug("Packet %p is a tunnel packet: %s",
/* we're done with the tunnel root now as well */
if (proot == true) {
- SCLogDebug("getting rid of root pkt... alloc'd %s", p->root->flags & PKT_ALLOC ? "true" : "false");
+ SCLogDebug("getting rid of root pkt... alloc'd %s", BOOL2STR(p->root->pool == NULL));
PacketReleaseRefs(p->root);
p->root->ReleasePacket(p->root);
void TmqhOutputSimple(ThreadVars *t, Packet *p)
{
- SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, p->flags & PKT_ALLOC ? "true":"false");
+ SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, BOOL2STR(p->pool == NULL));
PacketQueue *q = t->outq->pq;