port

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package port wraps RTE Port.

This tool is part of the DPDK Packet Framework tool suite and provides a standard interface to implement different types of packet ports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EthdevRx added in v0.0.5

type EthdevRx struct {
	// Configured Ethernet port and RX queue ID.
	PortID, QueueID uint16
}

EthdevRx is an input port built on top of pre-initialized NIC RX queue.

func (*EthdevRx) InOps added in v0.0.9

func (p *EthdevRx) InOps() *InOps

InOps implements InParams interface.

func (*EthdevRx) Transform added in v0.0.9

func (p *EthdevRx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type EthdevTx added in v0.0.5

type EthdevTx struct {
	// Configured Ethernet port and TX queue ID.
	PortID, QueueID uint16

	// Recommended burst size for NIC TX queue.
	TxBurstSize uint32

	// If NoDrop set writer makes Retries attempts to write packets to
	// NIC TX queue.
	NoDrop bool

	// If NoDrop set and Retries is 0, number of retries is unlimited.
	Retries uint32
}

EthdevTx is an output port built on top of pre-initialized NIC TX queue.

func (*EthdevTx) OutOps added in v0.0.9

func (p *EthdevTx) OutOps() *OutOps

OutOps implements OutParams interface.

func (*EthdevTx) Transform added in v0.0.9

func (p *EthdevTx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type FdRx added in v0.0.5

type FdRx struct {
	// Pre-initialized buffer pool.
	*mempool.Mempool

	// File descriptor.
	Fd uintptr

	// Maximum Transfer Unit (MTU)
	MTU uint32
}

FdRx input port built on top of valid non-blocking file descriptor.

func (*FdRx) InOps added in v0.0.9

func (rd *FdRx) InOps() *InOps

InOps implements InParams interface.

func (*FdRx) Transform added in v0.0.9

func (rd *FdRx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type FdTx added in v0.0.5

type FdTx struct {
	// File descriptor.
	Fd uintptr

	// Recommended write burst size. The actual burst size can be
	// bigger or smaller than this value.
	//
	// Should be power of 2.
	BurstSize uint32

	// If NoDrop set writer makes Retries attempts to write packets to
	// ring.
	NoDrop bool

	// If NoDrop set and Retries is 0, number of retries is unlimited.
	Retries uint32
}

FdTx is an output port built on top of valid non-blocking file descriptor.

func (*FdTx) OutOps added in v0.0.9

func (wr *FdTx) OutOps() *OutOps

OutOps implements OutParams interface.

func (*FdTx) Transform added in v0.0.9

func (wr *FdTx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type In added in v0.0.4

type In [0]byte

In is the instantiated input port.

func CreateIn added in v0.0.4

func CreateIn(socket int, params InParams) *In

CreateIn creates input port for specified socket and configuration.

It may return nil in case of an error.

func (*In) Free added in v0.0.9

func (port *In) Free(inOps *InOps) error

Free destroys created input port.

type InOps added in v0.0.4

InOps is the function table which implements input port.

type InParams added in v0.0.9

type InParams interface {
	// Returns allocated opaque structure along with its destructor.
	// Since InParams describes Go implementation of the port
	// configuration this member allocates its C counterpart as stated
	// in DPDK rte_port.
	common.Transformer

	// Returns pointer to associated rte_port_in_ops.
	InOps() *InOps
}

InParams describes the input port interface.

type InStats added in v0.0.9

type InStats struct {
	PacketsIn   uint64
	PacketsDrop uint64
}

InStats is an input port statistics.

type Out added in v0.0.4

type Out [0]byte

Out is the instantiated output port.

func CreateOut added in v0.0.4

func CreateOut(socket int, params OutParams) *Out

CreateOut creates output port for specified socket and configuration.

It may return nil in case of an error.

func (*Out) Free added in v0.0.9

func (port *Out) Free(outOps *OutOps) error

Free destroys created output port.

type OutOps added in v0.0.4

OutOps is the function table which implements output port.

type OutParams added in v0.0.9

type OutParams interface {
	// Returns allocated opaque structure argument along with its
	// destructor. It is used with ops function table.
	common.Transformer

	// Returns pointer to associated rte_port_out_ops.
	OutOps() *OutOps
}

OutParams describes configuration and behaviour of output port.

type OutStats added in v0.0.9

type OutStats struct {
	PacketsIn   uint64
	PacketsDrop uint64
}

OutStats is an output port statistics.

type RingRx added in v0.0.5

type RingRx struct {
	// Underlying ring
	*ring.Ring

	// Set if specified ring is multi consumer.
	Multi bool
}

RingRx is an input port built on top of pre-initialized RTE ring.

func (*RingRx) InOps added in v0.0.9

func (rd *RingRx) InOps() *InOps

InOps implements InParams interface.

func (*RingRx) Transform added in v0.0.9

func (rd *RingRx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type RingTx added in v0.0.5

type RingTx struct {
	// Underlying ring
	*ring.Ring

	// Recommended burst size for ring operations.
	TxBurstSize uint32

	// Set if specified ring is multi producer.
	Multi bool

	// If NoDrop set writer makes Retries attempts to write packets to
	// ring.
	NoDrop bool

	// If NoDrop set and Retries is 0, number of retries is unlimited.
	Retries uint32
}

RingTx is an output port built on top of pre-initialized single producer ring.

func (*RingTx) OutOps added in v0.0.9

func (wr *RingTx) OutOps() *OutOps

OutOps implements OutParams interface.

func (*RingTx) Transform added in v0.0.9

func (wr *RingTx) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type Sink

type Sink struct {
	// The full path of the pcap file to write the packets to.
	Filename string

	// The maximum number of packets write to the pcap file. If this value is
	// 0, the "infinite" write will be carried out.
	MaxPackets uint32
}

Sink is an output port that drops all packets written to it.

func (*Sink) OutOps added in v0.0.9

func (wr *Sink) OutOps() *OutOps

OutOps implements OutParams interface.

func (*Sink) Transform added in v0.0.9

func (wr *Sink) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type Source

type Source struct {
	// Pre-initialized buffer pool.
	*mempool.Mempool

	// The full path of the pcap file to read packets from.
	Filename string

	// The number of bytes to be read from each packet in the pcap file. If
	// this value is 0, the whole packet is read; if it is bigger than packet
	// size, the generated packets will contain the whole packet.
	BytesPerPacket uint32
}

Source is an input port that can be used to generate packets.

func (*Source) InOps added in v0.0.9

func (rd *Source) InOps() *InOps

InOps implements InParams interface.

func (*Source) Transform added in v0.0.9

func (rd *Source) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

Jump to

Keyboard shortcuts

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