Skip to content

Commit 62f1c34

Browse files
committed
Fix infinite loop when restarting DPDK secondary process
1 parent 023cd4b commit 62f1c34

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

dpdk/lib/timer/rte_timer.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,20 @@ rte_timer_init(struct rte_timer *tim)
213213
rte_atomic_store_explicit(&tim->status.u32, status.u32, rte_memory_order_relaxed);
214214
}
215215

216+
int
217+
rte_timer_meta_init(void)
218+
{
219+
struct rte_timer_data *timer_data;
220+
struct priv_timer *pt;
221+
unsigned lcore_id = rte_lcore_id();
222+
223+
TIMER_DATA_VALID_GET_OR_ERR_RET(default_data_id, timer_data, -EINVAL);
224+
pt = &timer_data->priv_timer[lcore_id];
225+
memset(pt, 0, sizeof(*pt));
226+
pt->prev_lcore = lcore_id;
227+
return 0;
228+
}
229+
216230
/*
217231
* if timer is pending or stopped (or running on the same core than
218232
* us), mark timer as configuring, and on success return the previous

dpdk/lib/timer/rte_timer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ void rte_timer_subsystem_finalize(void);
190190
*/
191191
void rte_timer_init(struct rte_timer *tim);
192192

193+
/**
194+
* Initialize the timer metadata.
195+
* For f-stack internal use only.
196+
* @return
197+
* - 0: Success
198+
* - -EINVAL: invalid timer data instance identifier
199+
*/
200+
int rte_timer_meta_init(void);
201+
193202
/**
194203
* Reset and start the timer associated with the timer handle.
195204
*

lib/ff_dpdk_if.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ static int
884884
init_clock(void)
885885
{
886886
rte_timer_subsystem_init();
887+
rte_timer_meta_init();
887888
uint64_t hz = rte_get_timer_hz();
888889
uint64_t intrs = US_PER_S / ff_global_cfg.freebsd.hz;
889890
uint64_t tsc = (hz + US_PER_S - 1) / US_PER_S * intrs;
@@ -897,6 +898,12 @@ init_clock(void)
897898
return 0;
898899
}
899900

901+
static int
902+
stop_clock(void) {
903+
rte_timer_stop_sync(&freebsd_clock);
904+
return 0;
905+
}
906+
900907
#if defined(FF_FLOW_ISOLATE) || defined(FF_FDIR)
901908
/** Print a message out of a flow error. */
902909
static int
@@ -2436,6 +2443,7 @@ ff_dpdk_run(loop_func_t loop, void *arg) {
24362443
lr->arg = arg;
24372444
rte_eal_mp_remote_launch(main_loop, lr, CALL_MAIN);
24382445
rte_eal_mp_wait_lcore();
2446+
stop_clock();
24392447
rte_free(lr);
24402448

24412449
/* FIXME: Cleanup ff_config, freebsd etc. */

0 commit comments

Comments
 (0)