ethdev

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: 17 Imported by: 0

Documentation

Overview

Package ethdev contains bindings of DPDK Ethernet device.

Index

Constants

This section is empty.

Variables

View Source
var (
	GqlEthDevNodeType *gqlserver.NodeType
	GqlEthDevType     *graphql.Object
)

GraphQL types.

Functions

This section is empty.

Types

type Config

type Config struct {
	RxQueues []RxQueueConfig
	TxQueues []TxQueueConfig
	MTU      int            // if non-zero, change MTU
	Promisc  bool           // promiscuous mode
	Conf     unsafe.Pointer // pointer to rte_eth_conf, nil means default
}

Config contains EthDev configuration.

func (*Config) AddRxQueues

func (cfg *Config) AddRxQueues(count int, qcfg RxQueueConfig)

AddRxQueues adds RxQueueConfig for several queues

func (*Config) AddTxQueues

func (cfg *Config) AddTxQueues(count int, qcfg TxQueueConfig)

AddTxQueues adds TxQueueConfig for several queues

type EthDev

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

EthDev represents an Ethernet adapter.

func Find

func Find(name string) EthDev

Find locates an EthDev by name.

func FromID

func FromID(id int) EthDev

FromID converts port ID to EthDev.

func List

func List() (list []EthDev)

List returns a list of Ethernet adapters.

func (EthDev) DevInfo

func (port EthDev) DevInfo() (info DevInfo)

DevInfo retrieves information about the hardware device.

func (EthDev) ID

func (port EthDev) ID() int

ID returns EthDev ID.

func (EthDev) IsDown

func (port EthDev) IsDown() bool

IsDown determines whether this EthDev is down.

func (EthDev) MTU

func (port EthDev) MTU() int

MTU retrieves MTU of this EthDev.

func (EthDev) MacAddr

func (port EthDev) MacAddr() (a net.HardwareAddr)

MacAddr retrieves MAC address of this EthDev. If the underlying EthDev returns an invalid MAC address, a random MAC address is returned instead.

func (EthDev) Name

func (port EthDev) Name() string

Name returns port name.

func (EthDev) NumaSocket

func (port EthDev) NumaSocket() (socket eal.NumaSocket)

NumaSocket returns the NUMA socket where this EthDev is located.

func (EthDev) ResetStats

func (port EthDev) ResetStats()

ResetStats clears hardware statistics.

func (EthDev) RxQueues

func (port EthDev) RxQueues() (list []RxQueue)

RxQueues returns RX queues of a running port.

func (EthDev) Start

func (port EthDev) Start(cfg Config) error

Start configures and starts this EthDev.

func (EthDev) Stats

func (port EthDev) Stats() (stats Stats)

Stats retrieves hardware statistics.

func (EthDev) Stop

func (port EthDev) Stop(mode StopMode) error

Stop stops this EthDev. If mode is StopDetach, this EthDev cannot be restarted. Otherwise, it may be re-configured and started again.

func (EthDev) String

func (port EthDev) String() string

func (EthDev) TxQueues

func (port EthDev) TxQueues() (list []TxQueue)

TxQueues returns TX queues of a running port.

func (EthDev) Valid

func (port EthDev) Valid() bool

Valid returns true if this is a valid Ethernet port.

type Pair

type Pair struct {
	PortA EthDev
	PortB EthDev
	// contains filtered or unexported fields
}

Pair represents a pair of EthDevs connected via ring-based PMD.

func NewPair

func NewPair(cfg PairConfig) (pair *Pair)

NewPair creates a pair of connected EthDevs.

func (*Pair) Close

func (pair *Pair) Close() error

Close stops both ports.

func (*Pair) EthDevConfig

func (pair *Pair) EthDevConfig() Config

EthDevConfig returns Config that can be used to start a port.

type PairConfig

type PairConfig struct {
	NQueues       int            // number of queues on EthDev
	RingCapacity  int            // ring capacity connecting pair of EthDevs
	QueueCapacity int            // queue capacity in each EthDev
	Socket        eal.NumaSocket // where to allocate data structures
	RxPool        *pktmbuf.Pool  // mempool for packet reception
}

PairConfig contains configuration for Pair.

type RxQueue

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

RxQueue represents an RX queue.

func (RxQueue) RxBurst

func (q RxQueue) RxBurst(vec pktmbuf.Vector) int

RxBurst receives a burst of input packets. Returns the number of packets received and written into vec.

type RxQueueConfig

type RxQueueConfig struct {
	Capacity int            // ring capacity
	Socket   eal.NumaSocket // where to allocate the ring
	RxPool   *pktmbuf.Pool  // where to store packets
	Conf     unsafe.Pointer // pointer to rte_eth_rxconf
}

RxQueueConfig contains EthDev RX queue configuration.

type StopMode

type StopMode int

StopMode selects the behavior of stopping an EthDev.

const (
	// StopDetach detaches the device. It cannot be restarted.
	StopDetach StopMode = iota

	// StopReset resets the device. It can be restarted.
	StopReset
)

type TxQueue

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

TxQueue represents an TX queue.

func (TxQueue) TxBurst

func (q TxQueue) TxBurst(vec pktmbuf.Vector) int

TxBurst transmits a burst of output packets. Returns the number of packets enqueued.

type TxQueueConfig

type TxQueueConfig struct {
	Capacity int            // ring capacity
	Socket   eal.NumaSocket // where to allocate the ring
	Conf     unsafe.Pointer // pointer to rte_eth_txconf
}

TxQueueConfig contains EthDev TX queue configuration.

type VNet

type VNet struct {
	ealthread.Thread // bridge thread

	Ports []EthDev

	NDrops int
	// contains filtered or unexported fields
}

VNet represents a virtual Ethernet subnet.

func NewVNet

func NewVNet(cfg VNetConfig) *VNet

NewVNet creates a virtual Ethernet subnet.

func (*VNet) Close

func (vnet *VNet) Close() error

Close stops the bridge and closes all ports.

func (*VNet) ThreadRole

func (*VNet) ThreadRole() string

ThreadRole returns "VNETBRIDGE" used in lcore allocator.

type VNetConfig

type VNetConfig struct {
	PairConfig
	NNodes int

	BurstSize       int
	LossProbability float64
	Shuffle         bool
}

VNetConfig contains VNet configuration.

Jump to

Keyboard shortcuts

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