ealconfig

package
v0.0.0-...-c2e30b8 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: NIST-PD-fallback Imports: 8 Imported by: 0

Documentation

Overview

Package ealconfig prepares EAL parameters.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLCore = errors.New("no LCore available")

ErrNoLCore indicates there is no LCore available.

View Source
var ErrPciAddress = errors.New("bad PCI address")

ErrPciAddress indicates the input PCI address is invalid.

View Source
var PmdPath string

PmdPath is the location of DPDK drivers. This is assigned to C.RTE_EAL_PMD_PATH by ealinit package.

Functions

This section is empty.

Types

type Config

type Config struct {
	LCoreConfig
	MemoryConfig
	DeviceConfig

	// ExtraFlags is additional flags passed to DPDK.
	ExtraFlags string `json:"extraFlags,omitempty"`

	// Flags is all flags passed to DPDK.
	// This replaces all other options.
	Flags string `json:"flags,omitempty"`
}

Config contains EAL configuration.

func (Config) Args

func (cfg Config) Args(req Request, hwInfo HwInfoSource) (args []string, e error)

Args validates the configuration and constructs EAL arguments.

type CoreInfo

type CoreInfo struct {
	ID          int
	NumaSocket  int
	HyperThread bool
}

CoreInfo describes a CPU core.

type DeviceConfig

type DeviceConfig struct {
	// Drivers is a list of shared object files or directories containing them.
	// Default is to include all DPDK drivers.
	//
	// If this is overridden, you must include these drivers:
	// - librte_crypto_openssl.so
	// - librte_mempool_ring.so
	// - librte_net_af_packet.so
	// - librte_net_memif.so
	// Not loading these drivers will likely cause NDN-DPDK activation failure.
	Drivers []string `json:"drivers,omitempty"`

	// PciDevices is an allowlist of PCI devices to enable.
	// This may include Ethernet adapters, NVMe storage controllers, etc.
	// Each should be a PCI address.
	PciDevices []PciAddress `json:"pciDevices,omitempty"`

	// AllPciDevices enables all PCI devices.
	// If AllPciDevices is false and PciDevices is empty, the PCI bus is disabled.
	AllPciDevices bool `json:"allPciDevices,omitempty"`

	// VirtualDevices is a list of virtual devices.
	// Each should be a device argument for DPDK --vdev flag.
	VirtualDevices []string `json:"virtualDevices,omitempty"`

	// DeviceFlags is device-related flags passed to DPDK.
	// This replaces all other options.
	DeviceFlags string `json:"deviceFlags,omitempty"`
}

DeviceConfig contains device related configuration.

type HwInfoSource

type HwInfoSource interface {
	// Cores provides information about CPU cores.
	Cores() []CoreInfo
}

HwInfoSource provides information about hardware.

func DefaultHwInfoSource

func DefaultHwInfoSource() HwInfoSource

DefaultHwInfoSource returns the default HwInfoSource implementation.

type LCoreConfig

type LCoreConfig struct {
	// Cores is the list of processors (hardware cores) available to DPDK.
	// Note that Go code is not restricted to these cores.
	//
	// The default is allowing all cores on the system.
	// If this list contains a non-existent core, it is skipped.
	Cores []int `json:"cores,omitempty"`

	// CoresPerNuma maps from NUMA socket ID to the number of cores available to DPDK.
	// This is ignored if Cores is specified.
	//
	// Example:
	//  CoresPerNuma[0] = 10     allows up to 10 cores on socket 0.
	//  CoresPerNuma[1] = -2     allows all but 2 cores on socket 1.
	//  CoresPerNuma[2] = 0      disallows all cores on socket 2.
	//  Omitting CoresPerNuma[3] allows all cores on socket 3.
	//
	// If this map contains a non-existent NUMA socket, it is skipped.
	CoresPerNuma map[int]int `json:"coresPerNuma,omitempty"`

	// LCoreFlags is lcore-related flags passed to DPDK.
	// This replaces all other options.
	LCoreFlags string `json:"lcoreFlags,omitempty"`
}

LCoreConfig contains CPU and logical core related configuration.

type MemoryConfig

type MemoryConfig struct {
	// MemChannels is the number of memory channels.
	// Omitting or setting an incorrect value may result in suboptimal performance.
	MemChannels int `json:"memChannels,omitempty"`

	// MemPerNuma maps from NUMA socket ID to the amount of memory (MiB).
	// Hugepages must be configured prior to starting NDN-DPDK.
	//
	// Example:
	//  MemPerNuma[0] = 16384  limits up to 16384MB on socket 0.
	//  Omitting MemPerNuma[1] places no memory limit on socket 1.
	//  MemPerNuma[1] = 0      limits up to 1MB on socket 2; DPDK does not support a zero limit.
	MemPerNuma map[int]int `json:"memPerNuma,omitempty"`

	// FilePrefix is shared data file prefix.
	// Each independent instance of NDN-DPDK must have different FilePrefix.
	FilePrefix string `json:"filePrefix,omitempty"`

	// DisableHugeUnlink disables unlink hugepage map files.
	DisableHugeUnlink bool `json:"disableHugeUnlink,omitempty"`

	// MemFlags is memory-related flags passed to DPDK.
	// This replaces all other options.
	MemFlags string `json:"memFlags,omitempty"`
}

MemoryConfig contains memory related configuration.

type PciAddress

type PciAddress struct {
	ghw.PCIAddress
}

PciAddress represents a PCI address.

func MustParsePciAddress

func MustParsePciAddress(input string) (a PciAddress)

MustParsePciAddress parses a PCI string, and panics on failure.

func ParsePciAddress

func ParsePciAddress(input string) (a PciAddress, e error)

ParsePciAddress parses a PCI address.

func (PciAddress) MarshalText

func (a PciAddress) MarshalText() (text []byte, e error)

MarshalText implements encoding.TextMarshaler interface.

func (PciAddress) String

func (a PciAddress) String() string

String returns the PCI address in 0000:00:01.0 format.

func (*PciAddress) UnmarshalText

func (a *PciAddress) UnmarshalText(text []byte) (e error)

UnmarshalText implements encoding.TextUnmarshaler interface.

func (PciAddress) Valid

func (a PciAddress) Valid() bool

Valid determines whether the PCI address is valid.

type Request

type Request struct {
	// MinLCores is the minimum required number of lcores.
	// This is processed by LCoreConfig.
	//
	// If there are fewer processor cores than MinLCores, lcores will be created as threads
	// floating among available cores, resulting in lower performance.
	MinLCores int
}

Request contains requirements of the activating application.

Jump to

Keyboard shortcuts

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