low

package
v0.9.3-0...-e3c37e7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RtePtypeL2Ether = C.RTE_PTYPE_L2_ETHER
	RtePtypeL3Ipv4  = C.RTE_PTYPE_L3_IPV4
	RtePtypeL3Ipv6  = C.RTE_PTYPE_L3_IPV6
	RtePtypeL4Tcp   = C.RTE_PTYPE_L4_TCP
	RtePtypeL4Udp   = C.RTE_PTYPE_L4_UDP
)

These constants are used by packet package to parse protocol headers

View Source
const (
	RteLpmValidExtEntryBitmask = C.RTE_LPM_VALID_EXT_ENTRY_BITMASK
	RteLpmTbl8GroupNumEntries  = C.RTE_LPM_TBL8_GROUP_NUM_ENTRIES
	RteLpmLookupSuccess        = C.RTE_LPM_LOOKUP_SUCCESS
)

These constants are used by packet package for longest prefix match lookup

Variables

View Source
var (
	CountersEnabledInFramework bool = bool(C.counters_enabled_in_framework)
	UseInterlockedCounters     bool = bool(C.use_interlocked_counters)
	AnalyzePacketSizes         bool = bool(C.analyze_packet_sizes)
)

Functions

func AddLPMRule

func AddLPMRule(lpm unsafe.Pointer, ip types.IPv4Address, depth uint8, nextHop types.IPv4Address) int

AddLPMRule adds one rule to LPM table

func AdjMbuf

func AdjMbuf(m *Mbuf, length uint) bool

AdjMbuf removes length bytes at mbuf beginning. Heavily based on DPDK rte_pktmbuf_adj

func AllocateMbuf

func AllocateMbuf(mb *uintptr, mempool *Mempool) error

AllocateMbuf allocates one mbuf.

func AllocateMbufs

func AllocateMbufs(mb []uintptr, mempool *Mempool, n uint) error

AllocateMbufs allocates n mbufs.

func AppendMbuf

func AppendMbuf(mb *Mbuf, length uint) bool

AppendMbuf appends length bytes to mbuf. Heavily based on DPDK rte_pktmbuf_append

func BoolToInt

func BoolToInt(value bool) uint8

func CheckHWRXPacketsTimestamp

func CheckHWRXPacketsTimestamp(port uint16) bool

func CheckHWTXChecksumCapability

func CheckHWTXChecksumCapability(port uint16) bool

func CheckPortMaxTXQueues

func CheckPortMaxTXQueues(port uint16) int32

func CheckPortRSS

func CheckPortRSS(port uint16) int32

func CheckRSSPacketCount

func CheckRSSPacketCount(p *Port, queue int16) int64

func CreateKni

func CreateKni(portId uint16, core uint, name string) error

CreateKni creates a KNI device

func CreateLPM

func CreateLPM(name string, socket uint8, maxRules uint32, numberTbl8 uint32, tbl24 unsafe.Pointer, tbl8 unsafe.Pointer) unsafe.Pointer

CreateLPM creates LPM table We can't reuse any structures like rte_lpm or rte_lpm_tbl_entry due to CGO problems with bitfields (uint24 compile time error). We we pass pointers via "unsafe.Pointer" and "void*" C function will return pointers to correct rte_lpm fields to tbl24 and tbl8, so we shouldn't worry about rte_lpm changings. However we use indexing while lookup, so we will need to check our sizes if DPDK changes rte_lpm_tbl_entry struct size

func CreatePort

func CreatePort(port uint16, willReceive bool, promiscuous bool, hwtxchecksum,
	hwrxpacketstimestamp bool, inIndex int32, tXQueuesNumberPerPort int) error

CreatePort initializes a new port using global settings and parameters.

func DeleteLPMRule

func DeleteLPMRule(lpm unsafe.Pointer, ip types.IPv4Address, depth uint8) int

DeleteLPMRule removes one rule from LPM table

func DirectSend

func DirectSend(m *Mbuf, port uint16) bool

DirectSend sends one mbuf.

func DirectStop

func DirectStop(pktsForFreeNumber int, buf []uintptr)

DirectStop frees mbufs.

func FreeKNI

func FreeKNI(port uint16) error

func FreeLPM

func FreeLPM(lpm unsafe.Pointer)

FreeLPM frees lpm structure

func FreeMempools

func FreeMempools()

func GetDataLenMbuf

func GetDataLenMbuf(mb *Mbuf) uint

GetDataLenMbuf returns amount of data in a given Mbuf - one segment if scattered

func GetNameByPort

func GetNameByPort(port uint16) (string, error)

GetNameByPort gets the device name from port id. The device name is specified as below:

- PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0 - SoC device name, for example- fsl-gmac0 - vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]

func GetPacketDataStartPointer

func GetPacketDataStartPointer(mb *Mbuf) uintptr

GetPacketDataStartPointer returns the pointer to the beginning of packet.

func GetPacketOffloadFlags

func GetPacketOffloadFlags(mb *Mbuf) uint64

func GetPacketTimestamp

func GetPacketTimestamp(mb *Mbuf) uint64

func GetPktLenMbuf

func GetPktLenMbuf(mb *Mbuf) uint

GetPktLenMbuf returns amount of data in a given chain of Mbufs - whole packet

func GetPortByName

func GetPortByName(name string) (uint16, error)

GetPortByName gets the port id from device name. The device name should be specified as below:

- PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0 - SoC device name, for example- fsl-gmac0 - vdev dpdk name, for example- net_[pcap0|null0|tap0]

func GetPortMACAddress

func GetPortMACAddress(port uint16) [types.EtherAddrLen]uint8

GetPortMACAddress gets MAC address of given port.

func GetPortsNumber

func GetPortsNumber() int

GetPortsNumber gets total number of available Ethernet devices.

func GetRawPacketBytesMbuf

func GetRawPacketBytesMbuf(mb *Mbuf) []byte

GetRawPacketBytesMbuf returns raw data from packet.

func InitDPDK

func InitDPDK(argc C.int, argv **C.char, burstSize uint, mbufNumber uint, mbufCacheSize uint, needKNI int,
	NoPacketHeadChange bool, needChainedReassembly bool, needChainedJumbo bool, needMemoryJumbo bool) error

InitDPDK initializes the Environment Abstraction Layer (EAL) in DPDK.

func InitDPDKArguments

func InitDPDKArguments(args []string) (C.int, **C.char)

InitDPDKArguments allocates and initializes arguments for dpdk.

func InitDevice

func InitDevice(device string) int

func IntArrayToBool

func IntArrayToBool(value *[32]uint8) *[32]bool

func PortStatistics

func PortStatistics(port uint16)

PortStatistics print statistics about NIC port.

func PrependMbuf

func PrependMbuf(mb *Mbuf, length uint) bool

PrependMbuf prepends length bytes to mbuf data area. TODO 4 following functions support only not chained mbufs now Heavily based on DPDK rte_pktmbuf_prepend

func ReceiveOS

func ReceiveOS(socket int, OUT *Ring, flag *int32, coreID int, stats *common.RXTXStats)

func ReceiveRSS

func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int, race *int32, stats *common.RXTXStats)

ReceiveRSS - get packets from port and enqueue on a Ring.

func ReceiveXDP

func ReceiveXDP(socket XDPSocket, OUT *Ring, flag *int32, coreID int, stats *common.RXTXStats)

func ReportMempoolsState

func ReportMempoolsState()

ReportMempoolsState prints used and free space of mempools.

func Send

func Send(port uint16, IN Rings, unrestrictedClones bool, flag *int32, coreID int, stats *common.RXTXStats,
	sendThreadIndex, totalSendTreads int)

Send - dequeue packets and send.

func SendOS

func SendOS(socket int, IN Rings, flag *int32, coreID int, stats *common.RXTXStats)

func SendXDP

func SendXDP(socket XDPSocket, IN Rings, flag *int32, coreID int, stats *common.RXTXStats)

func SetAffinity

func SetAffinity(coreID int) error

SetAffinity sets cpu affinity mask.

func SetCountersEnabledInApplication

func SetCountersEnabledInApplication(enabled bool)

func SetNextMbuf

func SetNextMbuf(next *Mbuf, prev *Mbuf)

func SetPacketStructSize

func SetPacketStructSize(t int) error

SetPacketStructSize sets the size of the packet.

func SetTXIPv4OLFlags

func SetTXIPv4OLFlags(mb *Mbuf, l2len, l3len uint32)

SetTXIPv4OLFlags sets mbuf flags for IPv4 header checksum calculation hardware offloading.

func SetTXIPv4TCPOLFlags

func SetTXIPv4TCPOLFlags(mb *Mbuf, l2len, l3len uint32)

SetTXIPv4TCPOLFlags sets mbuf flags for IPv4 and TCP headers checksum calculation hardware offloading.

func SetTXIPv4UDPOLFlags

func SetTXIPv4UDPOLFlags(mb *Mbuf, l2len, l3len uint32)

SetTXIPv4UDPOLFlags sets mbuf flags for IPv4 and UDP headers checksum calculation hardware offloading.

func SetTXIPv6TCPOLFlags

func SetTXIPv6TCPOLFlags(mb *Mbuf, l2len, l3len uint32)

SetTXIPv6TCPOLFlags sets mbuf flags for IPv6 TCP header checksum calculation hardware offloading.

func SetTXIPv6UDPOLFlags

func SetTXIPv6UDPOLFlags(mb *Mbuf, l2len, l3len uint32)

SetTXIPv6UDPOLFlags sets mbuf flags for IPv6 UDP header checksum calculation hardware offloading.

func SrKNI

func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool, IN Rings, stats *common.RXTXStats)

func Statistics

func Statistics(N float32)

Statistics print statistics about current speed of stop ring, recv/send speed and drops.

func Stop

func Stop(IN Rings, flag *int32, coreID int, stats *common.RXTXStats)

Stop - dequeue and free packets.

func StopDPDK

func StopDPDK()

func StopPort

func StopPort(port uint16)

func TrimMbuf

func TrimMbuf(m *Mbuf, length uint) bool

TrimMbuf removes length bytes at the mbuf end. Heavily based on DPDK rte_pktmbuf_trim

func WriteDataToMbuf

func WriteDataToMbuf(mb *Mbuf, data []byte)

WriteDataToMbuf copies data to mbuf.

Types

type Mbuf

type Mbuf C.struct_rte_mbuf

Mbuf is a message buffer.

type Mempool

type Mempool C.struct_rte_mempool

Mempool is a pool of objects.

func CreateMempool

func CreateMempool(name string) *Mempool

CreateMempool creates and returns a new memory pool.

func CreateMempools

func CreateMempools(name string, inIndex int32) []*Mempool

type Port

type Port C.struct_cPort

func GetPort

func GetPort(n uint16) *Port

type Ring

type Ring C.struct_nff_go_ring

Ring is a ring buffer for pointers

func CreateRing

func CreateRing(count uint) *Ring

CreateRing creates ring with given name and count.

func LookupRing

func LookupRing(name string) *Ring

Lookup ring with given name.

func (*Ring) DequeueBurst

func (ring *Ring) DequeueBurst(buffer []uintptr, count uint) uint

DequeueBurst dequeues data from ring buffer.

func (*Ring) EnqueueBurst

func (ring *Ring) EnqueueBurst(buffer []uintptr, count uint) uint

EnqueueBurst enqueues data to ring buffer.

func (*Ring) GetRingCount

func (ring *Ring) GetRingCount() uint32

GetRingCount gets number of objects in ring.

type Rings

type Rings []*Ring

func CreateRings

func CreateRings(count uint, inIndexNumber int32) Rings

CreateRings creates ring with given name and count.

type XDPSocket

type XDPSocket *C.struct_xsk_socket_info

func InitXDP

func InitXDP(device string, queue int) XDPSocket

Jump to

Keyboard shortcuts

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