package xdp

import "gvisor.dev/gvisor/pkg/tcpip/link/xdp"

Package xdp provides link layer endpoints backed by AF_XDP sockets.

Index

Constants

const MTU = 1500

MTU is sized to ensure packets fit inside a 2048 byte XDP frame.

Functions

func New

func New(opts *Options) (stack.LinkEndpoint, error)

New creates a new endpoint from an AF_XDP socket.

Types

type Options

type Options struct {
	// FD is used to read/write packets.
	FD int

	// ClosedFunc is a function to be called when an endpoint's peer (if
	// any) closes its end of the communication pipe.
	ClosedFunc func(tcpip.Error)

	// Address is the link address for this endpoint.
	Address tcpip.LinkAddress

	// SaveRestore if true, indicates that this NIC capability set should
	// include CapabilitySaveRestore
	SaveRestore bool

	// DisconnectOk if true, indicates that this NIC capability set should
	// include CapabilityDisconnectOk.
	DisconnectOk bool

	// TXChecksumOffload if true, indicates that this endpoints capability
	// set should include CapabilityTXChecksumOffload.
	TXChecksumOffload bool

	// RXChecksumOffload if true, indicates that this endpoints capability
	// set should include CapabilityRXChecksumOffload.
	RXChecksumOffload bool

	// InterfaceIndex is the interface index of the underlying device.
	InterfaceIndex int

	// Bind is true when we're responsible for binding the AF_XDP socket to
	// a device. When false, another process is expected to bind for us.
	Bind bool

	// GRO enables generic receive offload.
	GRO bool
}

Options specify the details about the fd-based endpoint to be created.

Source Files

endpoint.go

Version
v0.0.0-20250515200445-d30c58e5b8a4 (latest)
Published
May 15, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
13 hours ago

Tools for package owners.