Skip to content

Experimental devlink per-port parameter support#2

Open
lhoward wants to merge 2 commits into
mainfrom
devlink-avb
Open

Experimental devlink per-port parameter support#2
lhoward wants to merge 2 commits into
mainfrom
devlink-avb

Conversation

@lhoward

@lhoward lhoward commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Adds a minimal devlink (generic netlink) client — enough to enumerate devlink ports and set a per-port parameter — so callers can drive the mv88e6xxx per-port avb_cfg knob that replaces the old BR_FILTER_STREAM_RESERVED bridge port flag in the 802.1Qat stream-reservation rework.

What's here

  • RTNLDevlink: dedicated NETLINK_GENERIC socket, resolves the devlink genl family, dumps DEVLINK_CMD_PORT_GET (RTNLDevlinkPort), issues DEVLINK_CMD_PORT_PARAM_SET.
  • devlink uAPI command/attribute constants duplicated as Swift enums (the build host's <linux/devlink.h> may predate the per-port parameter commands).
  • NLSocket_CB_VALID gains a NETLINK_GENERIC arm for devlink PORT_NEW dump replies.
  • CNetLink pulls in the genl/ctrl headers; Package.swift links nl-genl-3.

Status

Experimental — not yet built or exercised against hardware in this environment.

Note on base

This branch is based on local main, which is ahead of origin/main by one unpushed commit (NetLink: model MDB entry state, replacing the stream-reserved flag). That commit therefore also appears in this PR's diff; it is a prerequisite for the wider rework and is expected to land with / ahead of this work.

🤖 Generated with Claude Code

lhoward and others added 2 commits June 6, 2026 17:54
Replace the per-entry MDBFlags bitmask (with its streamReserved member)
and the filterStreamReserved bridge port option with an MDBState enum
(temporary, permanent, dynamicReservation) carried in br_mdb_entry.state.

A reserved stream is now added by passing state: .dynamicReservation to
RTNLLinkBridge.add(), and RTNLMDBEntry exposes mdbState plus an
isDynamicReservation accessor. This tracks the kernel UAPI rework that
replaced MDB_FLAGS_STREAM_RESERVED with the MDB_DYNAMIC_RESERVATION entry
state and removed the IFLA_BRPORT_FILTER_STREAM_RESERVED port flag (the
software bridge now tags such frames for a tc-flower egress rule rather
than filtering on the ingress port).

Update the nltool example to the new state-based API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a minimal devlink (generic netlink) client, sufficient to enumerate
devlink ports and set a per-port parameter, so callers can drive the
mv88e6xxx per-port "avb_cfg" knob that replaces the old
BR_FILTER_STREAM_RESERVED bridge port flag.

RTNLDevlink opens a dedicated NETLINK_GENERIC socket, resolves the
"devlink" genl family, dumps DEVLINK_CMD_PORT_GET (RTNLDevlinkPort), and
issues DEVLINK_CMD_PORT_PARAM_SET. The devlink uAPI command/attribute
constants are duplicated as Swift enums because the build host's
<linux/devlink.h> may predate the per-port parameter commands.

NLSocket_CB_VALID grows a NETLINK_GENERIC arm that recognises devlink
PORT_NEW dump replies and yields RTNLDevlinkPort. CNetLink pulls in the
genl/ctrl headers and Package.swift links nl-genl-3.

Experimental and not yet exercised against hardware.
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