dpdk: set lcores parameter for high lcore id 77/42977/2
authorJeff Shaw <[email protected]>
Fri, 16 May 2025 18:28:09 +0000 (11:28 -0700)
committerDave Wallace <[email protected]>
Tue, 20 May 2025 15:15:41 +0000 (15:15 +0000)
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 <[email protected]>
src/plugins/dpdk/device/init.c

index 83c2614..06f5c55 100644 (file)
@@ -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)