afxdp

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package afxdp adapts the zero-copy AF_XDP forwarder.Forwarder to the vtep.Datapath seam. It is the privileged, kernel-zero-copy driver of the vtep family (veth + driver-XDP NIC, shared UMEM, in-place transform), used for the per-node / tunnelproxy VTEP where the overlay consumer is the host kernel.

Unlike the netstack and tun drivers — which drive the engine through the cross-buffer EngineXfrm contract — the AF_XDP driver keeps the in-place forwarder.Handler contract and its shared-UMEM zero-copy fast path entirely internally. This wrapper is a pure lifecycle adapter (Run/Close delegate to the forwarder's existing per-queue poll loop); it deliberately does not route the hot path through EngineXfrm, whose copy-based contract would forfeit the zero-copy handoff. The forwarder's in-place loop, shared UMEM, and minInPlaceHeadroom invariant are untouched.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datapath

type Datapath struct {
	// contains filtered or unexported fields
}

Datapath wraps a *forwarder.Forwarder so it satisfies vtep.Datapath. The wrapped forwarder owns its veth/XDP device and AF_XDP underlay and releases them on Close.

func Wrap

func Wrap(fwd *forwarder.Forwarder) *Datapath

Wrap adapts an already-constructed forwarder.Forwarder (built via forwarder.NewForwarder with the desired phy/virt/filter options) to the vtep.Datapath interface. The caller transfers ownership: the returned Datapath's Close closes the forwarder.

func (*Datapath) Close

func (d *Datapath) Close() error

Close releases the forwarder's device and AF_XDP resources. It is idempotent and safe to call after Run returns.

func (*Datapath) Run

func (d *Datapath) Run(ctx context.Context) error

Run drives the forwarder's per-queue poll loop, blocking until ctx is cancelled or a queue errors, then returns. Run must not be called more than once (the forwarder's own guards apply).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL