Skip to content

Feature Request: Optional Modular Build Mode for F-Stack #1093

Open

Description

@hardboydu

Background

F-Stack currently has relatively tight coupling between the FreeBSD network stack, DPDK, INI-based configuration, and management tools. This limits reusability, flexibility, and support for alternative implementations.

Proposal

Introduce an optional modular build mode that provides better separation between these components.

This mode is intended as an additional build option and will not change or affect the existing F-Stack architecture or build mode. Existing users can continue to build and use F-Stack exactly as before.

The proposed modular mode would provide:

1. FreeBSD Network Stack and DPDK

Build the FreeBSD network stack as an independent library and introduce a generic Packet I/O / device abstraction layer.

DPDK becomes one backend implementation, while other backends such as AF_XDP or netmap could be supported in the future.

2. Configuration and INI Files

Decouple the configuration layer from the INI file format.

Provide a configuration API and/or sysctl-style interface for getting and setting network stack parameters.

INI configuration remains available for backward compatibility.

3. Tools and DPDK

Decouple management tools from DPDK-specific interfaces.

Provide a generic IPC mechanism for tools to communicate with the F-Stack process and perform operations such as:

  • Querying network stack status
  • Getting/setting configuration
  • Querying connections, routes, and statistics
  • Performing runtime management operations

Target Architecture

                         Application
                              |
                         F-Stack API
                              |
              +---------------+---------------+
              |                               |
       Configuration API                FreeBSD Network Stack
              |                               |
       +------+------+                  Packet I/O API
       |      |     |                        |
      API   sysctl  INI          +-----------+-----------+
                                 |           |           |
                                DPDK       AF_XDP      netmap

              Tools
                 |
             Generic IPC
                 |
           F-Stack Process

Compatibility

The existing F-Stack build and runtime model remains unchanged.

The modular architecture is provided as an optional build mode. Users who do not need it can continue using the existing DPDK-based architecture without any changes.

Benefits

  • Reuse the FreeBSD network stack independently.
  • Reduce coupling between the network stack and DPDK.
  • Enable alternative Packet I/O backends.
  • Provide flexible configuration interfaces.
  • Decouple management tools from DPDK.
  • Establish a more modular architecture while maintaining full backward compatibility.

We would like to discuss whether this optional modular build mode could be considered for future F-Stack development.

Activity

  1. jfb8856606 commented on Sep 21, 2026

    @jfb8856606
    Contributor

    Thanks for the detailed proposal, and sorry for the late reply.

    F-Stack has chosen DPDK as its packet I/O layer because DPDK is what we use extensively in production, so a modular/abstracted packet I/O build mode is not on our current roadmap. Our near-term focus is the 2.0 release (FreeBSD 15.0 + DPDK 24.11, expected mid-October 2026), and we don't have the resources to take on an architecture-level refactor at the same time. This is the same position we took in #589 (netmap).

    That said, parts of the separation you describe already exist in the code, which may make a community contribution more tractable than it looks:

    1. Packet I/O: the FreeBSD side talks to DPDK only through a thin interface in lib/ff_dpdk_if.h (ff_dpdk_register_if, ff_dpdk_if_send, ff_dpdk_pktmbuf_free, ff_dpdk_if_get_mtu / ff_dpdk_if_set_mtu, ff_dpdk_if_get_mtu_capability). lib/ff_veth.c uses only these, so this header is the natural place to introduce a backend abstraction. The main obstacle is that the interface is still mbuf-based and carries DPDK semantics, so a backend-neutral packet representation would be needed first.

    2. Tools/IPC: all tools under tools/ already go through tools/compat/ff_ipc.[ch] (ff_ipc_send / ff_ipc_recv with typed messages: FF_SYSCTL, FF_IOCTL, FF_ROUTE, FF_TOP, ...). The API is already generic; only the transport is DPDK-specific (rte_ring + rte_mempool secondary process, root required). Swapping in a Unix socket transport would be a self-contained change.

    3. Configuration: ff_sysctl() is already exported in lib/ff_api.h with full get/set semantics, and tools/sysctl can reach a running F-Stack process through the IPC above. INI parsing is isolated in lib/ff_ini_parser.c / ff_config.c.

    So the pieces are smaller than a full redesign. If you're interested in driving this, PRs are very welcome — we'd suggest starting with the tools/IPC transport (item 2), which is the most self-contained and least likely to conflict with the 2.0 work.

    We'll keep this issue open as a feature request for now, but please understand that it isn't scheduled on our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions