[PATCH 1/1] eal: add API to get CPU socket ID
Stephen Hemminger
stephen at networkplumber.org
Mon Sep 14 23:19:56 CEST 2026
On Mon, 14 Sep 2026 15:28:14 -0400
Randy L Tice <rtice at cisco.com> wrote:
> Add rte_cpu_socket_id() so applications can map an OS logical CPU
> ID to its NUMA socket without requiring an EAL lcore ID.
>
> Existing public socket APIs depend on EAL lcore configuration or the
> calling thread's EAL state. They do not cover code that needs to look
> up topology by OS CPU ID, such as building socket memory policy.
>
> Reuse the existing per-OS EAL CPU socket lookup internally, while
> keeping the eal_cpu_socket_id() helper private to EAL.
>
> Signed-off-by: Randy L Tice <rtice at cisco.com>
> ---
New API's should be marked as experimental, so there is no ABI contract.
The return value of eal_cpu_socket_id() has no way with that signature
to return error. If given a bogus cpu, that code returns 0.
New functions in DPDK need to have a matching test. Somewhere in
the existing dpdk-test would be good.
There was a bigger patch series to give a full topology API to
deal with more complex chip arch; but it seems to have stalled.
More information about the dev
mailing list