From: Victor Julien Date: Sat, 22 Oct 2022 12:33:05 +0000 (+0200) Subject: threading: improve/add thread queues explanations X-Git-Tag: suricata-7.0.0-beta1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b07c7ad14c438026f52fc34fe25d6a89dfb5ec2c;p=thirdparty%2Fsuricata.git threading: improve/add thread queues explanations --- diff --git a/src/flow-worker.c b/src/flow-worker.c index a14b4c3523..9ddb34773b 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -78,7 +78,8 @@ typedef struct FlowWorkerThreadData_ { uint16_t local_bypass_bytes; uint16_t both_bypass_pkts; uint16_t both_bypass_bytes; - + /** Queue to put pseudo packets that have been created by the stream (RST response) and by the + * flush logic following a protocol change. */ PacketQueueNoLock pq; FlowLookupStruct fls; @@ -401,7 +402,7 @@ static inline void FlowWorkerStreamTCPUpdate(ThreadVars *tv, FlowWorkerThreadDat if (timeout) { PacketPoolReturnPacket(x); } else { - /* put these packets in the preq queue so that they are + /* put these packets in the decode queue so that they are processed * by the other thread modules before packet 'p'. */ PacketEnqueueNoLock(&tv->decode_pq, x); } diff --git a/src/threadvars.h b/src/threadvars.h index 3827a73fe7..1d866073c9 100644 --- a/src/threadvars.h +++ b/src/threadvars.h @@ -104,8 +104,10 @@ typedef struct ThreadVars_ { void *outctx; void (*tmqh_out)(struct ThreadVars_ *, struct Packet_ *); - /** queue for decoders to temporarily store extra packets they - * generate. */ + /** Queue for decoders to temporarily store extra packets they + * generate. These packets are generated as part of the tunnel + * handling, and are processed directly after the "real" packet + * from the current position in the pipeline. */ PacketQueueNoLock decode_pq; /** Stream packet queue for flow time out injection. Either a pointer to the diff --git a/src/tm-threads.c b/src/tm-threads.c index 7bd6cfa8bc..4ae4aade2b 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -125,7 +125,7 @@ TmEcode TmThreadsSlotVarRun(ThreadVars *tv, Packet *p, TmSlot *slot) return TM_ECODE_FAILED; } - /* handle new packets */ + /* handle new pseudo packets immediately */ while (tv->decode_pq.top != NULL) { Packet *extra_p = PacketDequeueNoLock(&tv->decode_pq); if (unlikely(extra_p == NULL))