]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dpdk: auto threads assign one too many threads 13565/head
authorLukas Sismis <lsismis@oisf.net>
Tue, 1 Jul 2025 19:43:19 +0000 (21:43 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 2 Jul 2025 06:41:42 +0000 (08:41 +0200)
Configuration option `threads: auto` in DPDK's interface node
overassigns available threads to the interface.
Commit 4dfd44d3 changed the signedness of the remaining threads counter,
which caused surpass of the counter initialization.
The if-clause is switched to first initialize and then use the counter.

Ticket: 7798

src/runmode-dpdk.c

index 496d830a283748d8211b07d3be5f2805b9ab3c11..d0bbab5c078f28e33ce45133f543d58ea1320131 100644 (file)
@@ -447,16 +447,16 @@ static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
             SCReturnInt(-ERANGE);
         }
 
-        if (remaining_auto_cpus > 0) {
-            iconf->threads++;
-            remaining_auto_cpus--;
-        } else if (remaining_auto_cpus == UINT16_MAX) {
+        if (remaining_auto_cpus == UINT16_MAX) {
             // first time auto-assignment
             remaining_auto_cpus = sched_cpus % live_dev_count;
             if (remaining_auto_cpus > 0) {
                 iconf->threads++;
                 remaining_auto_cpus--;
             }
+        } else if (remaining_auto_cpus > 0) {
+            iconf->threads++;
+            remaining_auto_cpus--;
         }
         SCLogConfig("%s: auto-assigned %u threads", iconf->iface, iconf->threads);
         SCReturnInt(0);