Documentation
¶
Index ¶
- Constants
- Variables
- func AddLPMRule(lpm unsafe.Pointer, ip types.IPv4Address, depth uint8, ...) int
- func AdjMbuf(m *Mbuf, length uint) bool
- func AllocateMbuf(mb *uintptr, mempool *Mempool) error
- func AllocateMbufs(mb []uintptr, mempool *Mempool, n uint) error
- func AppendMbuf(mb *Mbuf, length uint) bool
- func BoolToInt(value bool) uint8
- func CheckHWRXPacketsTimestamp(port uint16) bool
- func CheckHWTXChecksumCapability(port uint16) bool
- func CheckPortMaxTXQueues(port uint16) int32
- func CheckPortRSS(port uint16) int32
- func CheckRSSPacketCount(p *Port, queue int16) int64
- func CreateKni(portId uint16, core uint, name string) error
- func CreateLPM(name string, socket uint8, maxRules uint32, numberTbl8 uint32, ...) unsafe.Pointer
- func CreatePort(port uint16, willReceive bool, promiscuous bool, ...) error
- func DeleteLPMRule(lpm unsafe.Pointer, ip types.IPv4Address, depth uint8) int
- func DirectSend(m *Mbuf, port uint16) bool
- func DirectStop(pktsForFreeNumber int, buf []uintptr)
- func FreeKNI(port uint16) error
- func FreeLPM(lpm unsafe.Pointer)
- func FreeMempools()
- func GetDataLenMbuf(mb *Mbuf) uint
- func GetNameByPort(port uint16) (string, error)
- func GetPacketDataStartPointer(mb *Mbuf) uintptr
- func GetPacketOffloadFlags(mb *Mbuf) uint64
- func GetPacketTimestamp(mb *Mbuf) uint64
- func GetPktLenMbuf(mb *Mbuf) uint
- func GetPortByName(name string) (uint16, error)
- func GetPortMACAddress(port uint16) [types.EtherAddrLen]uint8
- func GetPortsNumber() int
- func GetRawPacketBytesMbuf(mb *Mbuf) []byte
- func InitDPDK(argc C.int, argv **C.char, burstSize uint, mbufNumber uint, mbufCacheSize uint, ...) error
- func InitDPDKArguments(args []string) (C.int, **C.char)
- func InitDevice(device string) int
- func IntArrayToBool(value *[32]uint8) *[32]bool
- func PortStatistics(port uint16)
- func PrependMbuf(mb *Mbuf, length uint) bool
- func ReceiveOS(socket int, OUT *Ring, flag *int32, coreID int, stats *common.RXTXStats)
- func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int, race *int32, ...)
- func ReceiveXDP(socket XDPSocket, OUT *Ring, flag *int32, coreID int, stats *common.RXTXStats)
- func ReportMempoolsState()
- func Send(port uint16, IN Rings, unrestrictedClones bool, flag *int32, coreID int, ...)
- func SendOS(socket int, IN Rings, flag *int32, coreID int, stats *common.RXTXStats)
- func SendXDP(socket XDPSocket, IN Rings, flag *int32, coreID int, stats *common.RXTXStats)
- func SetAffinity(coreID int) error
- func SetCountersEnabledInApplication(enabled bool)
- func SetNextMbuf(next *Mbuf, prev *Mbuf)
- func SetPacketStructSize(t int) error
- func SetTXIPv4OLFlags(mb *Mbuf, l2len, l3len uint32)
- func SetTXIPv4TCPOLFlags(mb *Mbuf, l2len, l3len uint32)
- func SetTXIPv4UDPOLFlags(mb *Mbuf, l2len, l3len uint32)
- func SetTXIPv6TCPOLFlags(mb *Mbuf, l2len, l3len uint32)
- func SetTXIPv6UDPOLFlags(mb *Mbuf, l2len, l3len uint32)
- func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool, ...)
- func Statistics(N float32)
- func Stop(IN Rings, flag *int32, coreID int, stats *common.RXTXStats)
- func StopDPDK()
- func StopPort(port uint16)
- func TrimMbuf(m *Mbuf, length uint) bool
- func WriteDataToMbuf(mb *Mbuf, data []byte)
- type Mbuf
- type Mempool
- type Port
- type Ring
- type Rings
- type XDPSocket
Constants ¶
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
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 ¶
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 ¶
AdjMbuf removes length bytes at mbuf beginning. Heavily based on DPDK rte_pktmbuf_adj
func AllocateMbuf ¶
AllocateMbuf allocates one mbuf.
func AllocateMbufs ¶
AllocateMbufs allocates n mbufs.
func AppendMbuf ¶
AppendMbuf appends length bytes to mbuf. Heavily based on DPDK rte_pktmbuf_append
func CheckPortMaxTXQueues ¶ added in v0.9.0
func CheckPortRSS ¶
func CheckRSSPacketCount ¶
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 ¶
DeleteLPMRule removes one rule from LPM table
func FreeMempools ¶
func FreeMempools()
func GetDataLenMbuf ¶
GetDataLenMbuf returns amount of data in a given Mbuf - one segment if scattered
func GetNameByPort ¶
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 ¶
GetPacketDataStartPointer returns the pointer to the beginning of packet.
func GetPacketOffloadFlags ¶
func GetPacketTimestamp ¶
func GetPktLenMbuf ¶
GetPktLenMbuf returns amount of data in a given chain of Mbufs - whole packet
func GetPortByName ¶
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 ¶
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 ¶
InitDPDKArguments allocates and initializes arguments for dpdk.
func InitDevice ¶
func IntArrayToBool ¶
func PortStatistics ¶ added in v0.9.0
func PortStatistics(port uint16)
PortStatistics print statistics about NIC port.
func PrependMbuf ¶
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 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 ¶ added in v0.9.0
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 SetCountersEnabledInApplication ¶
func SetCountersEnabledInApplication(enabled bool)
func SetNextMbuf ¶
func SetPacketStructSize ¶
SetPacketStructSize sets the size of the packet.
func SetTXIPv4OLFlags ¶
SetTXIPv4OLFlags sets mbuf flags for IPv4 header checksum calculation hardware offloading.
func SetTXIPv4TCPOLFlags ¶
SetTXIPv4TCPOLFlags sets mbuf flags for IPv4 and TCP headers checksum calculation hardware offloading.
func SetTXIPv4UDPOLFlags ¶
SetTXIPv4UDPOLFlags sets mbuf flags for IPv4 and UDP headers checksum calculation hardware offloading.
func SetTXIPv6TCPOLFlags ¶
SetTXIPv6TCPOLFlags sets mbuf flags for IPv6 TCP header checksum calculation hardware offloading.
func SetTXIPv6UDPOLFlags ¶
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 TrimMbuf ¶
TrimMbuf removes length bytes at the mbuf end. Heavily based on DPDK rte_pktmbuf_trim
func WriteDataToMbuf ¶
WriteDataToMbuf copies data to mbuf.
Types ¶
type Mempool ¶
type Mempool C.struct_rte_mempool
Mempool is a pool of objects.
func CreateMempool ¶
CreateMempool creates and returns a new memory pool.
func CreateMempools ¶
type Ring ¶
type Ring C.struct_nff_go_ring
Ring is a ring buffer for pointers
func CreateRing ¶
CreateRing creates ring with given name and count.
func (*Ring) DequeueBurst ¶
DequeueBurst dequeues data from ring buffer.
func (*Ring) EnqueueBurst ¶
EnqueueBurst enqueues data to ring buffer.
func (*Ring) GetRingCount ¶
GetRingCount gets number of objects in ring.
type Rings ¶
type Rings []*Ring
func CreateRings ¶
CreateRings creates ring with given name and count.