Skip to content

sriov: add support for devlink device parameters and PCIe Sub-Functions (SFs) - #610

Open
zarkdav wants to merge 6 commits into
canonical:mainfrom
zarkdav:feature/devlink-params-subfunctions
Open

sriov: add support for devlink device parameters and PCIe Sub-Functions (SFs)#610
zarkdav wants to merge 6 commits into
canonical:mainfrom
zarkdav:feature/devlink-params-subfunctions

Conversation

@zarkdav

@zarkdav zarkdav commented Aug 21, 2026

Copy link
Copy Markdown

Description

This PR introduces declarative Netplan support for:

  1. Generic & vendor-specific devlink device parameters via devlink-params: (e.g., flow_steering_mode: smfs, lag_port_select_mode: multi-port-esw, enable_roce: true).
  2. PCIe Sub-Functions (SFs) via sub-functions: (specifying sfnum, hw-address, and operational state active/inactive).

Example YAML configuration:

network:
  version: 2
  ethernets:
    enp3s0f0np0:
      embedded-switch-mode: switchdev
      devlink-params:
        flow_steering_mode: smfs
      sub-functions:
        - sfnum: 1
          hw-address: 00:11:22:33:44:55
          state: active
        - sfnum: 2
          hw-address: 00:11:22:33:44:56
          state: inactive

Changes Made:

  • C ABI & Libnetplan Core:
    • Added devlink_params (GHashTable*) and sub_functions (GArray*) fields to NetplanNetDefinition.
    • Added NetplanSubFunction struct and NetplanSubFunctionState enum in src/abi.h.
    • Added public iterator APIs (_netplan_netdef_new_devlink_params_iter, _netplan_netdef_new_sub_function_iter) in src/util.c.
    • Implemented YAML parsing and validation in src/parse.c.
    • Implemented YAML serialization in src/netplan.c.
    • Updated SR-IOV generator in src/gen-sriov.c to generate netplan-sriov-apply.service when devlink params or sub-functions are present.
  • Python CFFI & CLI:
    • Bound new iterators and structs in python-cffi/netplan/_build_cffi.py and python-cffi/netplan/netdef.py.
    • Implemented devlink parameter application and SF lifecycle management (devlink dev param set, devlink port add/function set/activate) in netplan_cli/cli/sriov.py.
  • Tests & Documentation:
    • Added C unit tests in tests/ctests/test_netplan_parser.c.
    • Added Python unit tests in tests/test_sriov.py.
    • Documented new properties in doc/netplan-yaml.md.

…ns (SFs)

Add parser support, ABI structs, serialization, CFFI bindings, CLI automation,
documentation, and test coverage for devlink-params and sub-functions.

- devlink-params: allows setting generic and vendor-specific devlink device
  parameters (such as flow_steering_mode or enable_roce) on SR-IOV Physical Functions.
- sub-functions: allows declarative configuration of PCIe Sub-Functions (SFs)
  including sfnum, port hardware address (hw-address), and operational state (active/inactive).
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