]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dpdk: treat unknown socket ID as a valid socket ID 9288/head
authorLukas Sismis <lsismis@oisf.net>
Mon, 17 Jul 2023 09:33:18 +0000 (11:33 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 25 Jul 2023 13:10:09 +0000 (15:10 +0200)
Ticket: #6232

src/runmode-dpdk.c
src/source-dpdk.c

index a3caeb5a902a5093a7d9375b7850fffdb95606af..5a934e8b9ed5ffb93147ab3845f099854ae30656 100644 (file)
@@ -1073,7 +1073,7 @@ static void DeviceSetMTU(struct rte_eth_conf *port_conf, uint16_t mtu)
 /**
  * \param port_id - queried port
  * \param socket_id - socket ID of the queried port
- * \return positive number on success, negative on failure (errno)
+ * \return non-negative number on success, negative on failure (errno)
  */
 static int32_t DeviceSetSocketID(uint16_t port_id, int32_t *socket_id)
 {
@@ -1083,6 +1083,9 @@ static int32_t DeviceSetSocketID(uint16_t port_id, int32_t *socket_id)
 
 #if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0) // DPDK API changed since 22.11
     retval = -rte_errno;
+#else
+    if (retval == SOCKET_ID_ANY)
+        retval = 0; // DPDK couldn't determine socket ID of a port
 #endif
 
     return retval;
index 1de89b1c4b49f36bb1b1485463cf3b5b5a1494fd..36a6d222e2c6fbad123ab7a9f18dd46a6d406b8d 100644 (file)
@@ -553,11 +553,10 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
         DevicePostStartPMDSpecificActions(ptv, dev_info.driver_name);
 
         uint16_t inconsistent_numa_cnt = SC_ATOMIC_GET(dpdk_config->inconsitent_numa_cnt);
-        if (inconsistent_numa_cnt > 0) {
+        if (inconsistent_numa_cnt > 0 && ptv->port_socket_id != SOCKET_ID_ANY) {
             SCLogWarning("%s: NIC is on NUMA %d, %u threads on different NUMA node(s)",
-                    dpdk_config->iface, rte_eth_dev_socket_id(ptv->port_id), inconsistent_numa_cnt);
-        }
-        if (ptv->port_socket_id == SOCKET_ID_ANY) {
+                    dpdk_config->iface, ptv->port_socket_id, inconsistent_numa_cnt);
+        } else if (ptv->port_socket_id == SOCKET_ID_ANY) {
             SCLogNotice(
                     "%s: unable to determine NIC's NUMA node, degraded performance can be expected",
                     dpdk_config->iface);