From f446fbc7ef48ada1bf93baa560b748a708b012ae Mon Sep 17 00:00:00 2001 From: Qizhen Zhang Date: Tue, 12 Dec 2023 03:51:45 +0000 Subject: [PATCH] WIP --- DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c b/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c index cc6f04b..270bc65 100644 --- a/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c +++ b/DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c @@ -44,7 +44,7 @@ static struct NetfeLcoreParam FeParam; static struct LcoreParam CoreParam[RTE_MAX_LCORE]; static int PEPOVerbose = 0; -static volatile int ForceQuitNetworkEngine = 0; +volatile int ForceQuitNetworkEngine = 0; // // Check out the paper below for the mapping between the hash key and TCP header fields @@ -3731,17 +3731,31 @@ PEPOTLDKTCPRun( } // - // Wait for all lcores to finish + // Wait for exit signal and sleep to avoid burning CPUs // // - while (!ForceQuitNetworkEngine) { sleep(1); } + + // + // Wait for all network lcores to exit + // + // + fprintf(stdout, "Waiting for all network lcores to exit...\n"); - fprintf(stdout, "Waiting for all lcores to exit...\n"); - rte_eal_mp_wait_lcore(); - fprintf(stdout, "All lcores have exited\n"); + RTE_LCORE_FOREACH_WORKER(i) { +#ifdef DDS_VERBOSE + printf("Waiting for worker %d\n", i); +#endif + if (CoreParam[i].Be.Lc != NULL || CoreParam[i].Fe.MaxStreams != 0) { + result = rte_eal_wait_lcore(i); + if (result != 0) { + RTE_LOG(ERR, USER1, "rte_eal_wait_lcore returns %d, lcore = %u\n", result, i); + } + } + } + fprintf(stdout, "All network lcores have exited\n"); return 0; }