]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
packet recycle: do most clean up on packet reuse
authorVictor Julien <victor@inliniac.net>
Wed, 9 Jul 2014 06:51:29 +0000 (08:51 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 13 Aug 2014 08:49:10 +0000 (10:49 +0200)
Call PACKET_RELEASE_REFS from PacketPoolGetPacket() so that
we only access the large packet structure just before actually
using it. Should give better cache behaviour.

src/tmqh-packetpool.c

index 9b84f55b4550dde4887ff4b44148e063ed6a105b..b26d6b09d9afe9121cad667b70ee5dab478340a8 100644 (file)
@@ -187,6 +187,7 @@ Packet *PacketPoolGetPacket(void)
         Packet *p = pool->head;
         pool->head = p->next;
         p->pool = pool;
+        PACKET_REINIT(p);
         return p;
     }
 
@@ -202,6 +203,7 @@ Packet *PacketPoolGetPacket(void)
         Packet *p = pool->head;
         pool->head = p->next;
         p->pool = pool;
+        PACKET_REINIT(p);
         return p;
     }
 
@@ -217,14 +219,14 @@ void PacketPoolReturnPacket(Packet *p)
 {
     PktPool *my_pool = GetThreadPacketPool();
 
+    PACKET_RELEASE_REFS(p);
+
     PktPool *pool = p->pool;
     if (pool == NULL) {
         free(p);
         return;
     }
 
-    PACKET_RECYCLE(p);
-
     if (pool == my_pool) {
         /* Push back onto this thread's own stack, so no locking. */
         p->next = my_pool->head;