Repository navigation
Description
Parent: #1399
Dependencies
None. Can start now.
Gap
xdpmode.Select (internal/plumbing/ebpf/xdpmode/mode.go) picks generic XDP only when the host has a bnxt_en NIC, and nothing overrides it. Hosts with bnxt_en run every gateway, NAT and dispatcher attachment in generic mode (docs/operations/xdp-attach-mode.md). The containerlab lab has only veths, so it always selects native and never runs Galactic's programs in generic mode.
That leaves the tagged-transport generic-mode rows without an environment. Those rows are in the #1399 contract (docs/designs/vlan-transport/acceptance.md, environment L) and in the acceptance of #1403 and #1405. VLAN tag handling also differs by mode: generic XDP sees the tag in skb metadata before the kernel untags it, as #1488 showed.
Deliverable
A host-wide setting that forces the XDP attach mode for every Galactic XDP attachment on a host, plus a containerlab option that runs the lab in generic mode.
Work items
- Add one setting that forces
nativeorgenericmode. It applies to every caller ofxdpmode.Select, which today meanscmd/galactic-gateway/gateway.goandcmd/galactic-nat/nat.go, and through them the shared dispatcher. When the setting is unset, today's driver-based decision is unchanged. - Keep the host-wide rule that a host never mixes native and generic redirect paths. Two components on one host that resolve different modes must fail clearly at startup or attach, never attach in mixed modes.
- Reject an invalid value with a clear error. Log the source of the decision (forced or driver-based) next to the existing decision reason.
- Add a containerlab variable or Taskfile option that deploys every lab node in generic mode, and document it in
deploy/containerlab/README.md. - Update
docs/operations/xdp-attach-mode.mdand the component environment-variable references.
Acceptance
Lab checks deferred. Under #1399's 2026-11-30 decision, this PR carries unit tests and real-kernel root tests. Every check below that needs the shared containerlab lab runs in #1405's end-of-epic lab pass instead, and is not a merge gate here.
- Unit tests cover: unset (driver-based result unchanged, including the
bnxt_encase), forcedgenericon a host withoutbnxt_en, forcednative, an invalid value, and the mixed-mode rejection. - A lab run with the generic option shows
xdpgenericinip -d link showfor every gateway, NAT and dispatcher attachment. The existing lab baseline checks pass in that mode and in the default mode. - With the setting unset, the lab deploys in native mode exactly as before.
- The delivering PR includes unit and real-kernel root test results and closes this task. Automate configurable tagged and untagged transport acceptance #1405 records the native and generic XDP lab results at epic closeout.
Activity
privateip commentedon Nov 30, 2026
Verdict: valid. On
epic/1399-vlan-transport(352fe3a),xdpmode.Selecthas no override, anddocs/operations/xdp-attach-mode.mdsays there is no override variable. Its only callers arecmd/galactic-gateway/gateway.goandcmd/galactic-nat/nat.go.Approved plan
Setting.
GALACTIC_XDP_MODE/--xdp-mode, valuesauto(default; empty means the same),nativeorgeneric. It is one name shared bygalactic-gatewayandgalactic-nat(internal/config), not a per-component variable. Any other value failsValidatewith a message listing the accepted values.autokeeps today's driver-based decision, includingbnxt_en.Selection.
xdpmode.Selecttakes the setting. A forced mode still runs the sysfs checks (missing target, unreadable driver).Decisiongains aSource(forcedordriver), and both callers log it next to the existingmodeandreason. Forcingnativeon a host with abnxt_enNIC is allowed and logs a warning citing #673.Mixed-mode guard. Before any attach, each component claims the host's mode under
/sys/fs/bpf/galactic-xdp/modes/<component>/, records its mode and source there, and holds a flock on that directory for its lifetime. If another component holds a live claim in a different mode, startup fails with an error naming both components, modes and sources. A claim whose holder has exited is stale and is replaced. This holds whatever the source of either decision, in both direct and dispatch attach.Before this change, the dispatcher's
host_moderecord let a later process migrate the links it covers while an earlier process in the other mode went not-ready, so interfaces only the earlier one covered could stay in the old mode. With the guard, the later process fails at startup instead, which also covers abnxt_enNIC hot-added while one pod is running. The existinghost_moderecord and migration logic stay as they are.Lab. A Taskfile variable
XDP_MODEsetsGALACTIC_XDP_MODEon every NAT and gateway DaemonSet during deploy,task lab:xdp-modeswitches a running lab, andtask verify:xdp-modechecks every gateway, NAT and dispatcher attachment forxdpgenericorxdp. Unset, the lab deploys natively as before.Docs.
docs/operations/xdp-attach-mode.md, the gateway and NAT configuration references, anddeploy/containerlab/README.md.Tests. Unit tests cover unset (driver result unchanged,
bnxt_enincluded), forcedgenericwithoutbnxt_en, forcednativewith and withoutbnxt_en, an invalid value, the mixed-mode rejection, stale-claim replacement, and a new pod starting beside an old one that writes no claim. A real-bpffs case runs intask test:unit-root.Verification.
task ci, then a lab run in default mode and in generic mode with the baseline checks, plus a mixed-mode negative case, ending with the lab back in native mode.privateip commentedon Nov 30, 2026
Delivered by #1535, merged into the epic branch
epic/1399-vlan-transportas dd624af.GALACTIC_XDP_MODE(auto,native,generic) forces the host-wide XDP attach mode, and a per-host claim stops two components from running different modes. The lab option andverify:xdp-modeare in place. The lab checks for this task run in #1405's end-of-epic lab pass, as #1399 decided. Closed by hand becauseFixesonly fires when the epic branch merges intomain.feat(xdpmode): Let operators force the host-wide XDP attach mode