# How to bind DPDK threads to correct NUMA node when using 2 NUMA nodes with 1 NIC on each node

**URL:** <https://forum.suricata.io/t/how-to-bind-dpdk-threads-to-correct-numa-node-when-using-2-numa-nodes-with-1-nic-on-each-node/5002>\
**Category:** Help\
**Tags:** community, suricata, dpdk\
**Created:** [November 8, 2024, 10:48pm UTC](https://forum.suricata.io/t/how-to-bind-dpdk-threads-to-correct-numa-node-when-using-2-numa-nodes-with-1-nic-on-each-node/5002 "2024-11-08T22:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ailury](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/ailury/32/3246_2.png) [@Ailury](https://forum.suricata.io/u/Ailury)\
**Post date:** [November 8, 2024, 10:48pm UTC](https://forum.suricata.io/t/how-to-bind-dpdk-threads-to-correct-numa-node-when-using-2-numa-nodes-with-1-nic-on-each-node/5002/1 "2024-11-08T22:48:35Z")

</div>

Hi,

System information:

> - 7.0.7
> - Ubuntu: 22.04
> - Built from source with DPDK

I have been wanting to configure DPDK with 2 NUMA nodes and 1 NIC on each NUMA node. However each and every time we configure DPDK, it ends up putting half the threads on the wrong NUMA node. This is probably due to DPDK assigning threads sequentially from 0-56.

Example setup:

Numa0: 0-13,27-41  
Numa1: 14-26,42-55

CPU affinity setup:

```auto
threading:
  set-cpu-affinity: yes
  cpu-affinity:
    - management-cpu-set:
        cpu: [0]
    - receive-cpu-set:
        cpu: [0] 
    - worker-cpu-set:
        cpu: ["0-13", "27-41", "14-26", "42-55"]
        mode: "exclusive"
        prio:
          low: [0]
          medium: ["1-2"]
          high: ["0-13", "27-41", "14-26", "42-55"]
          default: "high"

```

DPDK configuration:

```auto
dpdk:
  eal-params:
    proc-type: primary

    - interface: 0000:3b:00.0 # PCIe address of the NIC port
      threads: 28
      ....
    - interface: 0000:80:00.0 # PCIe address of the NIC port
      threads: 28

```

I would expect the configuration to work like this:  
0000:3b:00.0: “0-13”, “27-41”  
0000:80:00.0: “14-26”, “42-55”

However it seems like DPDK binds the first 28 threads (“0-13”, “14-26”) to 0000:3b:00.0. This causes 14 of the threads to be on the wrong NUMA node.

Is there any way to work around this with DPDK eal params?

I would prefer not running two different suricata processes if possible.

Thanks in advance

EDIT: forgot to remove some comments and the fact that cpu-affinity is set to true

---

<div class="post-metadata">

**Author:** ![lukashino](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/lukashino/32/1150_2.png) [@lukashino](https://forum.suricata.io/u/lukashino)\
**Post date:** [November 12, 2024, 10:13am UTC](https://forum.suricata.io/t/how-to-bind-dpdk-threads-to-correct-numa-node-when-using-2-numa-nodes-with-1-nic-on-each-node/5002/2 "2024-11-12T10:13:07Z")

</div>

Hi,  
so far Suri doesn’t have support for that but if you could check this PR:

> <https://github.com/OISF/suricata/pull/11706>
>
> Followup of https://github.com/OISF/suricata/pull/11521
> 
> Redmine ticket:
> http…s://redmine.openinfosecfoundation.org/issues/7036
> 
> This work allows more precise thread assignment and it is done either
> \- automatically - by picking assigned cores of the same NUMA locality as the interface from the worker-cpu-list 
> \- manually - you can specify per-iface settings in the threading section
> 
> This works with AF-PACKET and DPDK (and should with other capture modes as well). Primary target is workers runmode.
> 
> Dependency - hwloc - for the automatic core assignment.
> 
> At this point I am not sure why pkg-config doesn't find hwloc in github ci - it works on my machines - in case it fails on yours add LIBS="$LIBS -lhwloc" to your configure.ac

that satisfies what you are looking for - check suricata.yaml.in how it can be configured.

I would appreciate feedback if the suggested solution is user-friendly enough and I can proceed with it.  
Thanks.
