Skip to content

build(dpdk): guard rte_timer_meta_init() for unmodified upstream DPDK - #1104

Open
code-agree wants to merge 1 commit into
F-Stack:devfrom
code-agree:fix/upstream-dpdk-timer-meta-init
Open

code-agree wants to merge 1 commit into
F-Stack:devfrom
code-agree:fix/upstream-dpdk-timer-meta-init

Conversation

@code-agree

@code-agree code-agree commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

Auto-detect whether the linked DPDK headers declare F-Stack's private `rte_timer_meta_init()` extension so builds against unmodified upstream DPDK do not fail with `-Werror=implicit-function-declaration`, while keeping the bundled
DPDK path 100% unchanged.

### Scope Note
This PR does **not** ask F-Stack to officially support external/upstream DPDK versions — the bundled DPDK remains the only officially supported path. It simply avoids a hard compile failure when `rte_timer_meta_init()` is absent
and fails fast if features requiring bundled DPDK (`RTE_PROC_SECONDARY` or `graceful_reload`) are enabled.

### Changes
- **`lib/Makefile`**: Probe `<rte_timer.h>` with `$(CC) -fsyntax-only` (skipped on `make clean`) and define `-DHAVE_RTE_TIMER_META_INIT` when present. Bundled DPDK builds get `HAVE_RTE_TIMER_META_INIT=1` automatically with zero
extra flags.
- **`lib/ff_dpdk_if.c`**:
  - Check `rte_timer_subsystem_init()` return value (`0` or `-EALREADY`).
  - Guard `rte_timer_meta_init()` under `#ifdef HAVE_RTE_TIMER_META_INIT`.
  - Under `#else`, fail fast via `rte_exit()` if `rte_eal_process_type() != RTE_PROC_PRIMARY` or `graceful_reload` is enabled.

### Verification
- Built `libfstack.a` cleanly with GCC 15.1.0 (`-Wall -Wextra -Werror`) against unmodified upstream DPDK 26.07.0 (`HAVE_RTE_TIMER_META_INIT=0`) and verified live runtime startup/teardown on AWS ENA.
- Verified the compiler probe evaluates to `1` when `rte_timer_meta_init(void)` is declared in `rte_timer.h`, and is skipped on `make clean`.

F-Stack bundled DPDK provides a private rte_timer_meta_init() extension
for secondary processes and graceful_reload, which does not exist in
unmodified upstream DPDK releases.

Auto-detect rte_timer_meta_init() availability in lib/Makefile so the
bundled DPDK build remains unchanged. When building against unmodified
upstream DPDK, validate rte_timer_subsystem_init() and fail fast if
secondary process or graceful_reload mode is requested.
@code-agree
code-agree force-pushed the fix/upstream-dpdk-timer-meta-init branch from d6fa6e8 to 217f881 Compare November 24, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant