Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 setup build -Dkernel_dir=/lib/modules/6.8.0-64-generic/build
ninja -C build install
- name: Compile f-stack
run: |
Expand Down
14 changes: 14 additions & 0 deletions dpdk/lib/timer/rte_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions dpdk/lib/timer/rte_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
8 changes: 8 additions & 0 deletions lib/ff_dpdk_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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. */
Expand Down