From ceef3987aa2febaae9204ce3ef0718a78f95e849 Mon Sep 17 00:00:00 2001 From: Jeff Shaw Date: Fri, 16 May 2025 11:28:09 -0700 Subject: [PATCH] dpdk: set lcores parameter for high lcore id DPDK is most often compiled with RTE_MAX_LCORE=128. On systems which have more than 128 cores, its necessary to remap the active cores onto the available 128 cores, using the --lcores parameter. Since VPP does not use RTE threads, there's no reason DPDK needs to know anything about VPPs threads. However, DPDK does attempt to pin the thread calling rte_eal_init() to the current cpu, which can fail if the lcore ID exceeds RTE_MAX_LCORE. This commit implements a simple workaround, which is to map VPP's main lcore to DPDK lcore 0 whenever VPP's main_lcore exceeds RTE_MAX_LCORE. Type: fix Change-Id: I3cba5f5f26aed7ec62c70a50bac4c80d78d9d944 Signed-off-by: Jeff Shaw --- src/plugins/dpdk/device/init.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 83c2614e97e..06f5c556a1f 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1386,6 +1386,15 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) tmp = format (0, "vpp%c", 0); vec_add1 (conf->eal_init_args, tmp); } + + /* Remap main lcore onto DPDK lcore 0 if it exceeds the max lcore index */ + if (tm->main_lcore >= RTE_MAX_LCORE) + { + tmp = format (0, "--lcores%c", 0); + vec_add1 (conf->eal_init_args, tmp); + tmp = format (0, "0@%u%c", tm->main_lcore, 0); + vec_add1 (conf->eal_init_args, tmp); + } #endif if (no_pci == 0 && geteuid () == 0) -- 2.16.6