From 62f1c34df9ee471aa71035686aaa102509577dd9 Mon Sep 17 00:00:00 2001 From: jinliu777 Date: Fri, 16 Jan 2026 17:41:18 +0800 Subject: [PATCH 1/3] Fix infinite loop when restarting DPDK secondary process --- dpdk/lib/timer/rte_timer.c | 14 ++++++++++++++ dpdk/lib/timer/rte_timer.h | 9 +++++++++ lib/ff_dpdk_if.c | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/dpdk/lib/timer/rte_timer.c b/dpdk/lib/timer/rte_timer.c index 53ed22199..44298a886 100644 --- a/dpdk/lib/timer/rte_timer.c +++ b/dpdk/lib/timer/rte_timer.c @@ -213,6 +213,20 @@ rte_timer_init(struct rte_timer *tim) rte_atomic_store_explicit(&tim->status.u32, status.u32, rte_memory_order_relaxed); } +int +rte_timer_meta_init(void) +{ + struct rte_timer_data *timer_data; + struct priv_timer *pt; + unsigned lcore_id = rte_lcore_id(); + + TIMER_DATA_VALID_GET_OR_ERR_RET(default_data_id, timer_data, -EINVAL); + pt = &timer_data->priv_timer[lcore_id]; + memset(pt, 0, sizeof(*pt)); + pt->prev_lcore = lcore_id; + return 0; +} + /* * if timer is pending or stopped (or running on the same core than * us), mark timer as configuring, and on success return the previous diff --git a/dpdk/lib/timer/rte_timer.h b/dpdk/lib/timer/rte_timer.h index 3c7d236c2..882bc4660 100644 --- a/dpdk/lib/timer/rte_timer.h +++ b/dpdk/lib/timer/rte_timer.h @@ -190,6 +190,15 @@ void rte_timer_subsystem_finalize(void); */ void rte_timer_init(struct rte_timer *tim); +/** + * Initialize the timer metadata. + * For f-stack internal use only. + * @return + * - 0: Success + * - -EINVAL: invalid timer data instance identifier + */ +int rte_timer_meta_init(void); + /** * Reset and start the timer associated with the timer handle. * diff --git a/lib/ff_dpdk_if.c b/lib/ff_dpdk_if.c index 2dd76b1e0..5b53c54a6 100644 --- a/lib/ff_dpdk_if.c +++ b/lib/ff_dpdk_if.c @@ -884,6 +884,7 @@ static int init_clock(void) { rte_timer_subsystem_init(); + rte_timer_meta_init(); uint64_t hz = rte_get_timer_hz(); uint64_t intrs = US_PER_S / ff_global_cfg.freebsd.hz; uint64_t tsc = (hz + US_PER_S - 1) / US_PER_S * intrs; @@ -897,6 +898,12 @@ init_clock(void) return 0; } +static int +stop_clock(void) { + rte_timer_stop_sync(&freebsd_clock); + return 0; +} + #if defined(FF_FLOW_ISOLATE) || defined(FF_FDIR) /** Print a message out of a flow error. */ static int @@ -2436,6 +2443,7 @@ ff_dpdk_run(loop_func_t loop, void *arg) { lr->arg = arg; rte_eal_mp_remote_launch(main_loop, lr, CALL_MAIN); rte_eal_mp_wait_lcore(); + stop_clock(); rte_free(lr); /* FIXME: Cleanup ff_config, freebsd etc. */ From fd8431da6ab731e6fab0029248e260650e9202e3 Mon Sep 17 00:00:00 2001 From: jinliu777 Date: Fri, 16 Jan 2026 21:41:13 +0800 Subject: [PATCH 2/3] Fix CI: use the project's bundled DPDK --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e538bac1c..3a2fec395 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,8 @@ jobs: run: | apt-get -qq update apt-get -qq install -y libssl-dev ninja-build - # using pre-built dpdk inside the container - cp -r /root/dpdk/build dpdk/build cd dpdk + meson -Denable_kmods=true build ninja -C build install - name: Compile f-stack run: | From ccbc9f1db096851ff54b799f0b27ae4e76339ce1 Mon Sep 17 00:00:00 2001 From: jinliu777 Date: Fri, 16 Jan 2026 22:44:45 +0800 Subject: [PATCH 3/3] CI: set kernel_dir for meson setup --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a2fec395..6d6006419 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: apt-get -qq update apt-get -qq install -y libssl-dev ninja-build cd dpdk - meson -Denable_kmods=true build + meson setup build -Dkernel_dir=/lib/modules/6.8.0-64-generic/build ninja -C build install - name: Compile f-stack run: |