ethnetif

package
v0.0.0-...-5d9ef32 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: NIST-PD-fallback Imports: 21 Imported by: 0

Documentation

Overview

Package ethnetif manages DPDK Ethernet devices associated with kernel network interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	GqlDriverKindEnum   *graphql.Enum
	GqlConfigFieldTypes gqlserver.FieldTypes
)

GraphQL types.

View Source
var XDPProgram string

XDPProgram is the absolute path to an XDP program ELF object. This should be assigned by package main.

Functions

func CreateEthDev

func CreateEthDev(cfg Config) (ethdev.EthDev, error)

CreateEthDev creates an Ethernet device.

func XDPDeleteFaceMapEntry

func XDPDeleteFaceMapEntry(dev ethdev.EthDev, key []byte)

XDPDeleteFaceMapEntry deletes an entry in the FaceMap defined in the XDP program attached to the EthDev. If the EthDev is not using XDP driver, this operation has no effect.

func XDPInsertFaceMapEntry

func XDPInsertFaceMapEntry(dev ethdev.EthDev, key []byte, xskQueue int)

XDPInsertFaceMapEntry inserts an entry in the FaceMap defined in the XDP program attached to the EthDev. If the EthDev is not using XDP driver, this operation has no effect.

Types

type Config

type Config struct {
	Driver  DriverKind          `json:"driver" gqldesc:"EthDev driver kind."`
	Netif   string              `json:"netif,omitempty" gqldesc:"Network interface name (XDP, AF_PACKET, bifurcated PCI devices)."`
	PCIAddr *pciaddr.PCIAddress `json:"pciAddr,omitempty" gqldesc:"PCI address (PCI devices)."`
	DevArgs map[string]any      `json:"devargs,omitempty" gqldesc:"DPDK device arguments."`

	SkipBringUp bool   `json:"skipBringUp,omitempty" gqldesc:"Don't attempt to bring up the interface."`
	SkipEthtool bool   `json:"skipEthtool,omitempty" gqldesc:"Don't perform ethtool updates for XDP."`
	XDPProgram  string `json:"-"` // override XDP program
}

Config selects a network interface and creates an EthDev.

type DriverKind

type DriverKind string

DriverKind indicates the kind of driver requested for a network interface.

const (
	DriverPCI      DriverKind = "PCI"
	DriverXDP      DriverKind = "XDP"
	DriverAfPacket DriverKind = "AF_PACKET"
)

type NetIntf

type NetIntf struct {
	*netlink.LinkAttrs
	Link netlink.Link
	// contains filtered or unexported fields
}

NetIntf controls a network interface via netlink and ethtool.

func NetIntfByName

func NetIntfByName(ifname string) (n *NetIntf, e error)

NetIntfByName creates netIntf by network interface name. If the network interface does not exist, returns an error.

func (*NetIntf) DisableVLANOffload

func (n *NetIntf) DisableVLANOffload()

DisableVLANOffload modifies the Ethernet device to disable VLAN offload. This helps ensure all traffic goes into the XDP program.

func (*NetIntf) EnsureLinkUp

func (n *NetIntf) EnsureLinkUp(skipBringUp bool) error

EnsureLinkUp brings up the link. If skipBringUp is true but the interface is down, returns an error.

func (NetIntf) FindDev

func (n NetIntf) FindDev() (dev ethdev.EthDev)

FindDev locates an existing EthDev for the network interface.

func (NetIntf) NumaSocket

func (n NetIntf) NumaSocket() (socket eal.NumaSocket)

NumaSocket determines the NUMA socket of a physical network interface.

func (NetIntf) PCIAddr

func (n NetIntf) PCIAddr() (a pciaddr.PCIAddress, e error)

PCIAddr determines the PCI address of a physical network interface.

func (*NetIntf) Refresh

func (n *NetIntf) Refresh()

Refresh refreshes netlink information stores in this struct.

func (*NetIntf) SetOneChannel

func (n *NetIntf) SetOneChannel()

SetOneChannel modifies the Ethernet device to have only one RX channel. This helps ensure all traffic goes into the XDP program.

func (*NetIntf) UnloadXDP

func (n *NetIntf) UnloadXDP()

UnloadXDP unloads any existing XDP program on a network interface. This allows libxdp to load a new XDP program.

func (NetIntf) VDevName

func (n NetIntf) VDevName(drv string) string

VDevName constructs virtual device name for a particular driver.

Jump to

Keyboard shortcuts

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