Skip to content

Let the F-Stack tools find a vdev / file_prefix stack by itself (#419) - #1097

Merged
jfb8856606 merged 1 commit into
F-Stack:devfrom
alberthaolihai:fix-container-preifx
Oct 14, 2026
Merged

jfb8856606 merged 1 commit into
F-Stack:devfrom
alberthaolihai:fix-container-preifx

Conversation

@alberthaolihai

Copy link
Copy Markdown

Problem

Fixes the tools side of #419. With a [vdevN] config (e.g. F-Stack on top of OVS-DPDK vhost-user) the stack runs with --file-prefix=container, and with [dpdk] file_prefix=<v> with --file-prefix=container-<v>. Unless graceful_reload=1, the tools (ifconfig, sysctl, netstat, top, ...) attach as a DPDK secondary under the default prefix rte, so they fail with:

EAL: failed to send to (/var/run/dpdk/rte/mp_socket) due to Connection refused
VDEV_BUS: vdev_scan(): Failed to request vdev from primary

or, when another DPDK primary (such as OVS) owns rte, attach to that process instead. The only way round it was to know the naming rule and set FF_FILE_PREFIX by hand.

Change

  • lib/ff_dpdk_if.c: after rte_eal_init(), a primary writes /var/run/ff_primary.conf (pid, start_time, runtime_dir), in the same format as the resident slim primary's record. Written through a tmp file + rename(); best effort, a failure never stops the stack.
  • tools/compat/ff_ipc.c: the prefix lookup is now FF_FILE_PREFIX > /var/run/ff_slim_primary.conf > /var/run/ff_primary.conf > rte. The new record goes through the existing ff_ipc_record_prefix() checks: the pid is alive with the same start time, and the directory is a direct child of /var/run/dpdk/.
  • tools/README.md: documents the lookup order.

The file_prefix / container naming is unchanged, so existing deployments, scripts and hugepage file names stay the same.

Testing

TencentOS 4.4, kernel 6.6, DPDK 24.11.6, 2 MB hugepages. dpdk-testpmd --file-prefix=ovs419 --vdev net_vhost0,iface=/tmp/vhost-419.sock stood in for OVS, and helloworld used [vdev0] path=/tmp/vhost-419.sock with no file_prefix, so the stack ran under container.

Case Before After
ifconfig, vdev and no file_prefix Connection refused (reproduces #419) lists f-stack-0, inet 192.168.1.2
sysctl, netstat -an — OK
FF_FILE_PREFIX=rte / =container — the env var still takes precedence
stack stopped, record left behind — record rejected, falls back to the default, no wrong attach
file_prefix=t419 (container-t419) fails OK

lib (-Werror), tools and example build cleanly. Not covered: tests/unit (no cmocka on the host), the data path over vhost-user, several stacks on one host, and graceful_reload.

Notes

  • With several independent stacks on one host the record names the one started last, so FF_FILE_PREFIX is still needed to pick another one (documented in tools/README.md).

🤖 Generated with Claude Code

… by itself (issue F-Stack#419): every DPDK primary records its EAL runtime directory in /var/run/ff_primary.conf (pid, start time, runtime_dir), and ff_ipc_init() falls back to that record after FF_FILE_PREFIX and the resident slim primary's record, before the EAL default. Before this, a [vdevN] config ran the stack under --file-prefix=container while the tools attached to rte and failed with "mp_socket ... Connection refused". The record is checked like the slim one (live pid with the same start time, a direct child of /var/run/dpdk/); the file_prefix naming is unchanged.
@jfb8856606
jfb8856606 merged commit 61a9543 into F-Stack:dev Oct 14, 2026
1 check passed
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.

2 participants