]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dpdk: add hugepage hint on low number of hugepages
authorLukas Sismis <lsismis@oisf.net>
Wed, 23 Aug 2023 05:57:50 +0000 (07:57 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 16 Oct 2023 19:16:36 +0000 (21:16 +0200)
If a user doesn't allocate/allocates too little hugepages,
Suricata fails to start and outputs a hint to increase
number of hugepages (if enabled).

Ticket: #5966

src/runmode-dpdk.c

index feba401b4130b2eea18f48f67a384abe5e8ac8a1..2cdf5cb32505b58a7cff1d53e9490057281adb56 100644 (file)
@@ -1522,11 +1522,17 @@ static void *ParseDpdkConfigAndConfigureDevice(const char *iface)
 
     if (retval < 0) { // handles both configure attempts
         iconf->DerefFunc(iconf);
-        retval = rte_eal_cleanup();
-        if (retval != 0)
+        if (rte_eal_cleanup() != 0)
             FatalError("EAL cleanup failed: %s", strerror(-retval));
 
-        FatalError("%s: failed to configure", iface);
+        if (retval == -ENOMEM) {
+            FatalError("%s: memory allocation failed - consider"
+                       "%s freeing up some memory.",
+                    iface,
+                    rte_eal_has_hugepages() != 0 ? " increasing the number of hugepages or" : "");
+        } else {
+            FatalError("%s: failed to configure", iface);
+        }
     }
 
     SC_ATOMIC_RESET(iconf->ref);