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
7 changes: 7 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ HOST_CFLAGS+= -DFF_KNI
endif

HOST_CFLAGS+= ${DPDK_CFLAGS}

ifneq ($(MAKECMDGOALS),clean)
HAVE_RTE_TIMER_META_INIT := $(shell printf '#include <rte_timer.h>\nvoid (*fn)(void) = rte_timer_meta_init;\n' | $(CC) -x c $(shell $(PKGCONF) --cflags libdpdk) -fsyntax-only - >/dev/null 2>&1 && echo 1 || echo 0)
ifeq ($(HAVE_RTE_TIMER_META_INIT),1)
HOST_CFLAGS+= -DHAVE_RTE_TIMER_META_INIT
endif
endif
HOST_CFLAGS+= ${CONF_CFLAGS}

ifdef FF_FDIR
Expand Down
16 changes: 15 additions & 1 deletion lib/ff_dpdk_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1547,8 +1547,22 @@ init_clock(void)
return 0;
}

rte_timer_subsystem_init();
int timer_rc = rte_timer_subsystem_init();
if (timer_rc != 0 && timer_rc != -EALREADY) {
rte_exit(EXIT_FAILURE, "timer subsystem initialization failed: %d\n",
timer_rc);
}
#ifdef HAVE_RTE_TIMER_META_INIT
rte_timer_meta_init();
#else
/* Unmodified upstream DPDK does not provide F-Stack's rte_timer_meta_init().
* Fail fast if secondary process or graceful_reload is requested. */
if (rte_eal_process_type() != RTE_PROC_PRIMARY ||
ff_global_cfg.dpdk.graceful_reload) {
rte_exit(EXIT_FAILURE,
"secondary process and graceful_reload require F-Stack bundled DPDK\n");
}
#endif
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 Down