suricata
tmqh-packetpool.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2014 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Packetpool queue handlers. Packet pool is implemented as a stack.
24  */
25 
26 #include "suricata.h"
27 #include "packet-queue.h"
28 #include "decode.h"
29 #include "detect.h"
30 #include "detect-uricontent.h"
31 #include "threads.h"
32 #include "threadvars.h"
33 #include "flow.h"
34 #include "flow-util.h"
35 #include "host.h"
36 
37 #include "stream.h"
38 #include "stream-tcp-reassemble.h"
39 
40 #include "tm-queuehandlers.h"
41 #include "tm-threads.h"
42 #include "tm-modules.h"
43 
44 #include "pkt-var.h"
45 
46 #include "tmqh-packetpool.h"
47 
48 #include "util-debug.h"
49 #include "util-error.h"
50 #include "util-profiling.h"
51 #include "util-device.h"
52 
53 /* Number of freed packet to save for one pool before freeing them. */
54 #define MAX_PENDING_RETURN_PACKETS 32
55 static uint32_t max_pending_return_packets = MAX_PENDING_RETURN_PACKETS;
56 
57 thread_local PktPool thread_pkt_pool;
58 
59 static inline PktPool *GetThreadPacketPool(void)
60 {
61  return &thread_pkt_pool;
62 }
63 
64 /**
65  * \brief TmqhPacketpoolRegister
66  * \initonly
67  */
69 {
70  tmqh_table[TMQH_PACKETPOOL].name = "packetpool";
73 }
74 
75 static int PacketPoolIsEmpty(PktPool *pool)
76 {
77  /* Check local stack first. */
78  if (pool->head || pool->return_stack.head)
79  return 0;
80 
81  return 1;
82 }
83 
84 void PacketPoolWait(void)
85 {
86  PktPool *my_pool = GetThreadPacketPool();
87 
88  if (PacketPoolIsEmpty(my_pool)) {
89  SCMutexLock(&my_pool->return_stack.mutex);
90  SC_ATOMIC_ADD(my_pool->return_stack.sync_now, 1);
91  SCCondWait(&my_pool->return_stack.cond, &my_pool->return_stack.mutex);
92  SCMutexUnlock(&my_pool->return_stack.mutex);
93  }
94 
95  while(PacketPoolIsEmpty(my_pool))
96  cc_barrier();
97 }
98 
99 /** \brief Wait until we have the requested amount of packets in the pool
100  *
101  * In some cases waiting for packets is undesirable. Especially when
102  * a wait would happen under a lock of some kind, other parts of the
103  * engine could have to wait.
104  *
105  * This function only returns when at least N packets are in our pool.
106  *
107  * If counting in our pool's main stack didn't give us the number we
108  * are seeking, we check if the return stack is filled and add those
109  * to our main stack. Then we retry.
110  *
111  * \param n number of packets needed
112  */
114 {
115  PktPool *my_pool = GetThreadPacketPool();
116  Packet *p, *pp;
117 
118  while (1) {
119  PacketPoolWait();
120 
121  /* count packets in our stack */
122  int i = 0;
123  pp = p = my_pool->head;
124  while (p != NULL) {
125  if (++i == n)
126  return;
127 
128  pp = p;
129  p = p->next;
130  }
131 
132  /* check return stack, return to our pool and retry counting */
133  if (my_pool->return_stack.head != NULL) {
134  SCMutexLock(&my_pool->return_stack.mutex);
135  /* Move all the packets from the locked return stack to the local stack. */
136  if (pp) {
137  pp->next = my_pool->return_stack.head;
138  } else {
139  my_pool->head = my_pool->return_stack.head;
140  }
141  my_pool->return_stack.head = NULL;
142  SC_ATOMIC_RESET(my_pool->return_stack.sync_now);
143  SCMutexUnlock(&my_pool->return_stack.mutex);
144 
145  /* or signal that we need packets and wait */
146  } else {
147  SCMutexLock(&my_pool->return_stack.mutex);
148  SC_ATOMIC_ADD(my_pool->return_stack.sync_now, 1);
149  SCCondWait(&my_pool->return_stack.cond, &my_pool->return_stack.mutex);
150  SCMutexUnlock(&my_pool->return_stack.mutex);
151  }
152  }
153 }
154 
155 /** \brief a initialized packet
156  *
157  * \warning Use *only* at init, not at packet runtime
158  */
159 static void PacketPoolStorePacket(Packet *p)
160 {
161  /* Clear the PKT_ALLOC flag, since that indicates to push back
162  * onto the ring buffer. */
163  p->flags &= ~PKT_ALLOC;
164  p->pool = GetThreadPacketPool();
167 }
168 
169 static void PacketPoolGetReturnedPackets(PktPool *pool)
170 {
171  SCMutexLock(&pool->return_stack.mutex);
172  /* Move all the packets from the locked return stack to the local stack. */
173  pool->head = pool->return_stack.head;
174  pool->return_stack.head = NULL;
175  SCMutexUnlock(&pool->return_stack.mutex);
176 }
177 
178 /** \brief Get a new packet from the packet pool
179  *
180  * Only allocates from the thread's local stack, or mallocs new packets.
181  * If the local stack is empty, first move all the return stack packets to
182  * the local stack.
183  * \retval Packet pointer, or NULL on failure.
184  */
186 {
187  PktPool *pool = GetThreadPacketPool();
188 #ifdef DEBUG_VALIDATION
189  BUG_ON(pool->initialized == 0);
190  BUG_ON(pool->destroyed == 1);
191 #endif /* DEBUG_VALIDATION */
192  if (pool->head) {
193  /* Stack is not empty. */
194  Packet *p = pool->head;
195  pool->head = p->next;
196  p->pool = pool;
197  PACKET_REINIT(p);
198  return p;
199  }
200 
201  /* Local Stack is empty, so check the return stack, which requires
202  * locking. */
203  PacketPoolGetReturnedPackets(pool);
204 
205  /* Try to allocate again. Need to check for not empty again, since the
206  * return stack might have been empty too.
207  */
208  if (pool->head) {
209  /* Stack is not empty. */
210  Packet *p = pool->head;
211  pool->head = p->next;
212  p->pool = pool;
213  PACKET_REINIT(p);
214  return p;
215  }
216 
217  /* Failed to allocate a packet, so return NULL. */
218  /* Optionally, could allocate a new packet here. */
219  return NULL;
220 }
221 
222 /** \brief Return packet to Packet pool
223  *
224  */
226 {
227  PktPool *my_pool = GetThreadPacketPool();
228 
230 
231  PktPool *pool = p->pool;
232  if (pool == NULL) {
233  PacketFree(p);
234  return;
235  }
236 #ifdef DEBUG_VALIDATION
237  BUG_ON(pool->initialized == 0);
238  BUG_ON(pool->destroyed == 1);
239  BUG_ON(my_pool->initialized == 0);
240  BUG_ON(my_pool->destroyed == 1);
241 #endif /* DEBUG_VALIDATION */
242 
243  if (pool == my_pool) {
244  /* Push back onto this thread's own stack, so no locking. */
245  p->next = my_pool->head;
246  my_pool->head = p;
247  } else {
248  PktPool *pending_pool = my_pool->pending_pool;
249  if (pending_pool == NULL) {
250  /* No pending packet, so store the current packet. */
251  p->next = NULL;
252  my_pool->pending_pool = pool;
253  my_pool->pending_head = p;
254  my_pool->pending_tail = p;
255  my_pool->pending_count = 1;
256  } else if (pending_pool == pool) {
257  /* Another packet for the pending pool list. */
258  p->next = my_pool->pending_head;
259  my_pool->pending_head = p;
260  my_pool->pending_count++;
261  if (SC_ATOMIC_GET(pool->return_stack.sync_now) || my_pool->pending_count > max_pending_return_packets) {
262  /* Return the entire list of pending packets. */
263  SCMutexLock(&pool->return_stack.mutex);
264  my_pool->pending_tail->next = pool->return_stack.head;
265  pool->return_stack.head = my_pool->pending_head;
266  SC_ATOMIC_RESET(pool->return_stack.sync_now);
267  SCMutexUnlock(&pool->return_stack.mutex);
268  SCCondSignal(&pool->return_stack.cond);
269  /* Clear the list of pending packets to return. */
270  my_pool->pending_pool = NULL;
271  my_pool->pending_head = NULL;
272  my_pool->pending_tail = NULL;
273  my_pool->pending_count = 0;
274  }
275  } else {
276  /* Push onto return stack for this pool */
277  SCMutexLock(&pool->return_stack.mutex);
278  p->next = pool->return_stack.head;
279  pool->return_stack.head = p;
280  SC_ATOMIC_RESET(pool->return_stack.sync_now);
281  SCMutexUnlock(&pool->return_stack.mutex);
282  SCCondSignal(&pool->return_stack.cond);
283  }
284  }
285 }
286 
288 {
289  PktPool *my_pool = GetThreadPacketPool();
290 
291 #ifdef DEBUG_VALIDATION
292  BUG_ON(my_pool->initialized);
293  my_pool->initialized = 1;
294  my_pool->destroyed = 0;
295 #endif /* DEBUG_VALIDATION */
296 
297  SCMutexInit(&my_pool->return_stack.mutex, NULL);
298  SCCondInit(&my_pool->return_stack.cond, NULL);
299  SC_ATOMIC_INIT(my_pool->return_stack.sync_now);
300 }
301 
302 void PacketPoolInit(void)
303 {
304  extern intmax_t max_pending_packets;
305 
306  PktPool *my_pool = GetThreadPacketPool();
307 
308 #ifdef DEBUG_VALIDATION
309  BUG_ON(my_pool->initialized);
310  my_pool->initialized = 1;
311  my_pool->destroyed = 0;
312 #endif /* DEBUG_VALIDATION */
313 
314  SCMutexInit(&my_pool->return_stack.mutex, NULL);
315  SCCondInit(&my_pool->return_stack.cond, NULL);
316  SC_ATOMIC_INIT(my_pool->return_stack.sync_now);
317 
318  /* pre allocate packets */
319  SCLogDebug("preallocating packets... packet size %" PRIuMAX "",
320  (uintmax_t)SIZE_OF_PACKET);
321  int i = 0;
322  for (i = 0; i < max_pending_packets; i++) {
323  Packet *p = PacketGetFromAlloc();
324  if (unlikely(p == NULL)) {
326  "Fatal error encountered while allocating a packet. Exiting...");
327  }
328  PacketPoolStorePacket(p);
329  }
330 
331  //SCLogInfo("preallocated %"PRIiMAX" packets. Total memory %"PRIuMAX"",
332  // max_pending_packets, (uintmax_t)(max_pending_packets*SIZE_OF_PACKET));
333 }
334 
336 {
337  Packet *p = NULL;
338  PktPool *my_pool = GetThreadPacketPool();
339 
340 #ifdef DEBUG_VALIDATION
341  BUG_ON(my_pool->destroyed);
342 #endif /* DEBUG_VALIDATION */
343 
344  if (my_pool && my_pool->pending_pool != NULL) {
345  p = my_pool->pending_head;
346  while (p) {
347  Packet *next_p = p->next;
348  PacketFree(p);
349  p = next_p;
350  my_pool->pending_count--;
351  }
352 #ifdef DEBUG_VALIDATION
353  BUG_ON(my_pool->pending_count);
354 #endif /* DEBUG_VALIDATION */
355  my_pool->pending_pool = NULL;
356  my_pool->pending_head = NULL;
357  my_pool->pending_tail = NULL;
358  }
359 
360  while ((p = PacketPoolGetPacket()) != NULL) {
361  PacketFree(p);
362  }
363 
364 #ifdef DEBUG_VALIDATION
365  my_pool->initialized = 0;
366  my_pool->destroyed = 1;
367 #endif /* DEBUG_VALIDATION */
368 }
369 
371 {
372  return PacketPoolGetPacket();
373 }
374 
376 {
377  bool proot = false;
378 
379  SCEnter();
380  SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, p->flags & PKT_ALLOC ? "true" : "false");
381 
382  if (IS_TUNNEL_PKT(p)) {
383  SCLogDebug("Packet %p is a tunnel packet: %s",
384  p,p->root ? "upper layer" : "tunnel root");
385 
386  /* get a lock to access root packet fields */
387  SCMutex *m = p->root ? &p->root->tunnel_mutex : &p->tunnel_mutex;
388  SCMutexLock(m);
389 
390  if (IS_TUNNEL_ROOT_PKT(p)) {
391  SCLogDebug("IS_TUNNEL_ROOT_PKT == TRUE");
392  const uint16_t outstanding = TUNNEL_PKT_TPR(p) - TUNNEL_PKT_RTV(p);
393  SCLogDebug("root pkt: outstanding %u", outstanding);
394  if (outstanding == 0) {
395  SCLogDebug("no tunnel packets outstanding, no more tunnel "
396  "packet(s) depending on this root");
397  /* if this packet is the root and there are no
398  * more tunnel packets to consider
399  *
400  * return it to the pool */
401  } else {
402  SCLogDebug("tunnel root Packet %p: outstanding > 0, so "
403  "packets are still depending on this root, setting "
404  "SET_TUNNEL_PKT_VERDICTED", p);
405  /* if this is the root and there are more tunnel
406  * packets, return this to the pool. It's still referenced
407  * by the tunnel packets, and we will return it
408  * when we handle them */
410 
412  SCMutexUnlock(m);
413  SCReturn;
414  }
415  } else {
416  SCLogDebug("NOT IS_TUNNEL_ROOT_PKT, so tunnel pkt");
417 
419  const uint16_t outstanding = TUNNEL_PKT_TPR(p) - TUNNEL_PKT_RTV(p);
420  SCLogDebug("tunnel pkt: outstanding %u", outstanding);
421  /* all tunnel packets are processed except us. Root already
422  * processed. So return tunnel pkt and root packet to the
423  * pool. */
424  if (outstanding == 0 &&
426  {
427  SCLogDebug("root verdicted == true && no outstanding");
428 
429  /* handle freeing the root as well*/
430  SCLogDebug("setting proot = 1 for root pkt, p->root %p "
431  "(tunnel packet %p)", p->root, p);
432  proot = true;
433 
434  /* fall through */
435 
436  } else {
437  /* root not ready yet, or not the last tunnel packet,
438  * so get rid of the tunnel pkt only */
439 
440  SCLogDebug("NOT IS_TUNNEL_PKT_VERDICTED (%s) || "
441  "outstanding > 0 (%u)",
442  (p->root && IS_TUNNEL_PKT_VERDICTED(p->root)) ? "true" : "false",
443  outstanding);
444 
445  /* fall through */
446  }
447  }
448  SCMutexUnlock(m);
449 
450  SCLogDebug("tunnel stuff done, move on (proot %d)", proot);
451  }
452 
453  /* we're done with the tunnel root now as well */
454  if (proot == true) {
455  SCLogDebug("getting rid of root pkt... alloc'd %s", p->root->flags & PKT_ALLOC ? "true" : "false");
456 
458  p->root->ReleasePacket(p->root);
459  p->root = NULL;
460  }
461 
463 
465  p->ReleasePacket(p);
466 
467  SCReturn;
468 }
469 
470 /**
471  * \brief Release all the packets in the queue back to the packetpool. Mainly
472  * used by threads that have failed, and wants to return the packets back
473  * to the packetpool.
474  *
475  * \param pq Pointer to the packetqueue from which the packets have to be
476  * returned back to the packetpool
477  *
478  * \warning this function assumes that the pq does not use locking
479  */
481 {
482  Packet *p = NULL;
483 
484  if (pq == NULL)
485  return;
486 
487  while ( (p = PacketDequeue(pq)) != NULL)
488  TmqhOutputPacketpool(NULL, p);
489 
490  return;
491 }
492 
493 /** number of packets to keep reserved when calculating the the pending
494  * return packets count. This assumes we need at max 10 packets in one
495  * PacketPoolWaitForN call. The actual number is 9 now, so this has a
496  * bit of margin. */
497 #define RESERVED_PACKETS 10
498 
499 /**
500  * \brief Set the max_pending_return_packets value
501  *
502  * Set it to the max pending packets value, devided by the number
503  * of lister threads. Normally, in autofp these are the stream/detect/log
504  * worker threads.
505  *
506  * The max_pending_return_packets value needs to stay below the packet
507  * pool size of the 'producers' (normally pkt capture threads but also
508  * flow timeout injection ) to avoid a deadlock where all the 'workers'
509  * keep packets in their return pools, while the capture thread can't
510  * continue because its pool is empty.
511  */
513 {
514  extern intmax_t max_pending_packets;
515  intmax_t pending_packets = max_pending_packets;
516  if (pending_packets < RESERVED_PACKETS) {
517  FatalError(SC_ERR_INVALID_ARGUMENT, "'max-pending-packets' setting "
518  "must be at least %d", RESERVED_PACKETS);
519  }
521  if (threads == 0)
522  return;
523 
524  uint32_t packets = (pending_packets / threads) - 1;
525  if (packets < max_pending_return_packets)
526  max_pending_return_packets = packets;
527 
528  /* make sure to have a margin in the return logic */
529  if (max_pending_return_packets >= RESERVED_PACKETS)
530  max_pending_return_packets -= RESERVED_PACKETS;
531 
532  SCLogDebug("detect threads %u, max packets %u, max_pending_return_packets %u",
533  threads, packets, max_pending_return_packets);
534 }
host.h
tm-threads.h
PktPool_::pending_tail
Packet * pending_tail
Definition: tmqh-packetpool.h:52
flow-util.h
SC_ATOMIC_INIT
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
Definition: util-atomic.h:315
PacketPoolReturnPacket
void PacketPoolReturnPacket(Packet *p)
Return packet to Packet pool.
Definition: tmqh-packetpool.c:225
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
PACKET_REINIT
#define PACKET_REINIT(p)
Recycle a packet structure for reuse.
Definition: decode.h:759
PktPool_
Definition: tmqh-packetpool.h:40
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
RESERVED_PACKETS
#define RESERVED_PACKETS
Definition: tmqh-packetpool.c:497
TM_FLAG_DETECT_TM
#define TM_FLAG_DETECT_TM
Definition: tm-modules.h:34
PacketQueue_
simple fifo queue for packets with mutex and cond Calling the mutex or triggering the cond is respons...
Definition: packet-queue.h:47
Packet_::flags
uint32_t flags
Definition: decode.h:449
threads.h
SC_ATOMIC_ADD
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
Definition: util-atomic.h:333
Tmqh_::OutHandler
void(* OutHandler)(ThreadVars *, Packet *)
Definition: tm-queuehandlers.h:40
Packet_::pool
struct PktPool_ * pool
Definition: decode.h:608
SCCondInit
#define SCCondInit
Definition: threads-debug.h:138
IS_TUNNEL_ROOT_PKT
#define IS_TUNNEL_ROOT_PKT(p)
Definition: decode.h:897
packet-queue.h
TmThreadCountThreadsByTmmFlags
uint32_t TmThreadCountThreadsByTmmFlags(uint8_t flags)
returns a count of all the threads that match the flag
Definition: tm-threads.c:1998
SCMutexLock
#define SCMutexLock(mut)
Definition: threads-debug.h:117
tm-modules.h
stream-tcp-reassemble.h
PktPool_::pending_count
uint32_t pending_count
Definition: tmqh-packetpool.h:53
m
SCMutex m
Definition: flow-hash.h:6
PacketPoolPostRunmodes
void PacketPoolPostRunmodes(void)
Set the max_pending_return_packets value.
Definition: tmqh-packetpool.c:512
MAX_PENDING_RETURN_PACKETS
#define MAX_PENDING_RETURN_PACKETS
Definition: tmqh-packetpool.c:54
TmqhOutputPacketpool
void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
Definition: tmqh-packetpool.c:375
tmqh-packetpool.h
thread_pkt_pool
thread_local PktPool thread_pkt_pool
Definition: tmqh-packetpool.c:57
PktPool_::pending_head
Packet * pending_head
Definition: tmqh-packetpool.h:51
PKT_ALLOC
#define PKT_ALLOC
Definition: decode.h:1104
TmqhReleasePacketsToPacketPool
void TmqhReleasePacketsToPacketPool(PacketQueue *pq)
Release all the packets in the queue back to the packetpool. Mainly used by threads that have failed,...
Definition: tmqh-packetpool.c:480
PacketPoolInit
void PacketPoolInit(void)
Definition: tmqh-packetpool.c:302
Tmqh_::InHandler
Packet *(* InHandler)(ThreadVars *)
Definition: tm-queuehandlers.h:38
decode.h
TUNNEL_PKT_TPR
#define TUNNEL_PKT_TPR(p)
Definition: decode.h:892
util-device.h
util-debug.h
util-error.h
SCCondWait
#define SCCondWait
Definition: threads-debug.h:141
SCMutexUnlock
#define SCMutexUnlock(mut)
Definition: threads-debug.h:119
IS_TUNNEL_PKT_VERDICTED
#define IS_TUNNEL_PKT_VERDICTED(p)
Definition: decode.h:899
SCEnter
#define SCEnter(...)
Definition: util-debug.h:300
PacketPoolWaitForN
void PacketPoolWaitForN(int n)
Wait until we have the requested amount of packets in the pool.
Definition: tmqh-packetpool.c:113
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
pkt-var.h
PacketFree
void PacketFree(Packet *p)
Return a malloced packet.
Definition: decode.c:105
TmqhInputPacketpool
Packet * TmqhInputPacketpool(ThreadVars *tv)
Definition: tmqh-packetpool.c:370
SIZE_OF_PACKET
#define SIZE_OF_PACKET
Definition: decode.h:627
SC_ERR_INVALID_ARGUMENT
@ SC_ERR_INVALID_ARGUMENT
Definition: util-error.h:43
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:282
util-profiling.h
PacketPoolWait
void PacketPoolWait(void)
Definition: tmqh-packetpool.c:84
SCReturn
#define SCReturn
Definition: util-debug.h:302
stream.h
Packet_
Definition: decode.h:414
Tmqh_::name
const char * name
Definition: tm-queuehandlers.h:37
IS_TUNNEL_PKT
#define IS_TUNNEL_PKT(p)
Definition: decode.h:894
SET_TUNNEL_PKT_VERDICTED
#define SET_TUNNEL_PKT_VERDICTED(p)
Definition: decode.h:900
SCMutexInit
#define SCMutexInit(mut, mutattrs)
Definition: threads-debug.h:116
PktPool_::return_stack
PktPoolLockedStack return_stack
Definition: tmqh-packetpool.h:67
tm-queuehandlers.h
TmqhPacketpoolRegister
void TmqhPacketpoolRegister(void)
TmqhPacketpoolRegister \initonly.
Definition: tmqh-packetpool.c:68
Packet_::ReleasePacket
void(* ReleasePacket)(struct Packet_ *)
Definition: decode.h:493
SCCondSignal
#define SCCondSignal
Definition: threads-debug.h:139
FatalError
#define FatalError(x,...)
Definition: util-debug.h:532
tmqh_table
Tmqh tmqh_table[TMQH_SIZE]
Definition: tm-queuehandlers.c:37
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
SC_ATOMIC_RESET
#define SC_ATOMIC_RESET(name)
wrapper for reinitializing an atomic variable.
Definition: util-atomic.h:324
PacketDequeue
Packet * PacketDequeue(PacketQueue *q)
Definition: packet-queue.c:212
threadvars.h
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:144
TUNNEL_PKT_RTV
#define TUNNEL_PKT_RTV(p)
Definition: decode.h:891
Packet_::next
struct Packet_ * next
Definition: decode.h:579
TMQH_PACKETPOOL
@ TMQH_PACKETPOOL
Definition: tm-queuehandlers.h:30
Packet_::root
struct Packet_ * root
Definition: decode.h:586
PACKET_RELEASE_REFS
#define PACKET_RELEASE_REFS(p)
Definition: decode.h:750
max_pending_packets
int max_pending_packets
Definition: suricata.c:212
SC_ERR_FATAL
@ SC_ERR_FATAL
Definition: util-error.h:203
TUNNEL_INCR_PKT_RTV_NOLOCK
#define TUNNEL_INCR_PKT_RTV_NOLOCK(p)
Definition: decode.h:881
PACKET_PROFILING_END
#define PACKET_PROFILING_END(p)
Definition: util-profiling.h:105
PacketPoolGetPacket
Packet * PacketPoolGetPacket(void)
Get a new packet from the packet pool.
Definition: tmqh-packetpool.c:185
suricata.h
PacketPoolInitEmpty
void PacketPoolInitEmpty(void)
Definition: tmqh-packetpool.c:287
cc_barrier
#define cc_barrier()
Definition: util-optimize.h:43
detect-uricontent.h
PktPool_::pending_pool
struct PktPool_ * pending_pool
Definition: tmqh-packetpool.h:50
SC_ATOMIC_GET
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
Definition: util-atomic.h:376
PacketPoolDestroy
void PacketPoolDestroy(void)
Definition: tmqh-packetpool.c:335
flow.h
PktPool_::head
Packet * head
Definition: tmqh-packetpool.h:44
SCMutex
#define SCMutex
Definition: threads-debug.h:114
Packet_::tunnel_mutex
SCMutex tunnel_mutex
Definition: decode.h:596