[PATCH v2 02/61] kvargs: add a socket ID handler

fengchengwen fengchengwen at huawei.com
Wed Sep 30 03:01:14 CEST 2026


Acked-by: Chengwen Feng <fengchengwen at huawei.com>

On 9/30/2026 12:36 AM, Stephen Hemminger wrote:
> Device arguments naming a NUMA socket are common, and every driver that
> takes one open codes the same range check against RTE_MAX_NUMA_NODES.
> They do not agree on what the range is: dlb2 accepts RTE_MAX_NUMA_NODES
> itself, and turbo_sw and bbdev_null check only the upper bound, so a
> negative socket id is taken as valid.
> 
> Add a handler for these:
> 
>     rte_kvargs_handle_socket_id
> 
> It stores through an int and accepts -1, which is SOCKET_ID_ANY, through
> RTE_MAX_NUMA_NODES - 1.
> 
> The bound is the compile time maximum rather than the sockets present on
> the running system, which is what the open coded checks used. Validating
> against rte_socket_count() would also make kvargs depend on EAL, which
> depends on kvargs in turn.
> 
> SOCKET_ID_ANY is spelled as a literal -1 rather than included from
> rte_memory.h for the same reason. The value is part of the ABI.
> 
> No handler is added for lcore ids. There is no caller for one: the
> drivers that take a core argument either parse a list, as crypto/scheduler
> does with its coremask, or dispatch many keys through one shared handler,
> as mlx5 does with service_core. One can be added when a user appears.
> 
> Nor is one added for queue ids or queue counts. Those look similar but
> are not: some drivers count from one and others from zero, and the useful
> bound is nearly always a hardware limit well below
> RTE_MAX_QUEUES_PER_PORT, which rte_kvargs_to_uint() already covers.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>



More information about the dev mailing list