low

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: BSD-3-Clause Imports: 9 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

This section is empty.

Functions

func AddLPMRule

func AddLPMRule(lpm unsafe.Pointer, ip uint32, depth uint8, nextHop uint32) 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 CheckHWTXChecksumCapability

func CheckHWTXChecksumCapability(port uint16) bool

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, sendQueuesNumber uint16, promiscuous bool, hwtxchecksum bool, inIndex int32) error

CreatePort initializes a new port using global settings and parameters.

func DeleteLPMRule

func DeleteLPMRule(lpm unsafe.Pointer, ip uint32, 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 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 GetPacketDataStartPointer

func GetPacketDataStartPointer(mb *Mbuf) uintptr

GetPacketDataStartPointer returns the pointer to the beginning of packet.

func GetPktLenMbuf

func GetPktLenMbuf(mb *Mbuf) uint

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

func GetPortMACAddress

func GetPortMACAddress(port uint16) [common.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) 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 IntArrayToBool

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

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 ReceiveKNI

func ReceiveKNI(port uint16, OUT *Ring, flag *int32, coreID int)

ReceiveKNI - get packets from Linux core and enqueue on a Ring.

func ReceiveRSS

func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int)

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

func ReportMempoolsState

func ReportMempoolsState()

ReportMempoolsState prints used and free space of mempools.

func Send

func Send(port uint16, queue int16, IN Rings, inIndexNumber int32, flag *int32, coreID int)

Send - dequeue packets and send.

func SetAffinity

func SetAffinity(coreID int) error

SetAffinity sets cpu affinity mask.

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 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)

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 (*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.

Jump to

Keyboard shortcuts

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