util

package
v0.1.1-r1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrWrap

func ErrWrap(err error, msg string) error

ErrWrap annotates specified err with message string.

func ErrWrapf

func ErrWrapf(err error, format string, args ...interface{}) error

ErrWrapf annotates specified err with formatted string.

Types

type ErrWithMessage

type ErrWithMessage struct {
	Err error
	B   bytes.Buffer
}

ErrWithMessage wraps Err and buffer to store annotation.

func (*ErrWithMessage) Error

func (e *ErrWithMessage) Error() string

func (*ErrWithMessage) Unwrap

func (e *ErrWithMessage) Unwrap() error

type Hash32

type Hash32 struct {
	// Seed is the initial hash32 value.
	Seed uint32

	// Value is the calculated hash32 value. To reset the Hash32
	// state, simply reset this to Seed.
	Value uint32

	// Optimal block size. See BlockSize method of hash.Hash32
	// interface.
	Block int

	// If true then previous hash value is complemented to one before
	// specifying to Accum and the output is then complemented to one.
	OnesComplement bool

	// Accum is the backend hash implementation. It takes input byte
	// array and calculates new hash value based on previous one.
	Accum func([]byte, uint32) uint32
}

Hash32 wraps a function Accum to implement hash.Hash32 interface.

func (*Hash32) BlockSize

func (h *Hash32) BlockSize() int

BlockSize implements hash.Hash32 interface.

func (*Hash32) Reset

func (h *Hash32) Reset()

Reset implements hash.Hash32 interface.

func (*Hash32) Size

func (h *Hash32) Size() int

Size implements hash.Hash32 interface. Returns 4.

func (*Hash32) Sum

func (h *Hash32) Sum(b []byte) []byte

Sum implements hash.Hash32 interface.

func (*Hash32) Sum32

func (h *Hash32) Sum32() uint32

Sum32 implements hash.Hash32 interface.

func (*Hash32) Write

func (h *Hash32) Write(p []byte) (int, error)

Write implements io.Writer interface needed for hash.Hash32 implementation.

type LcoresList

type LcoresList []uint

LcoresList represents a list of unsigned ints, e.g. lcores. It implements sort.Interface.

func (LcoresList) Dup

func (list LcoresList) Dup() LcoresList

Dup allocates new list and copies list's contents into it.

func (LcoresList) Equal

func (list LcoresList) Equal(other LcoresList) bool

Equal returns true if list and other are identical.

func (LcoresList) Len

func (list LcoresList) Len() int

func (LcoresList) Less

func (list LcoresList) Less(i, j int) bool

func (LcoresList) Sort

func (list LcoresList) Sort()

Sort sorts list of unsigned ints.

func (LcoresList) String

func (list LcoresList) String() string

func (LcoresList) Swap

func (list LcoresList) Swap(i, j int)

type MbufArray

type MbufArray C.struct_mbuf_array

MbufArray is a wrapper of port and queue id.

func NewEthdevMbufArray

func NewEthdevMbufArray(pid ethdev.Port, qid uint16, socket int, size uint16) *MbufArray

NewEthdevMbufArray allocates new MbufArray from huge pages memory for specified queue id, socket NUMA node and containing up to size mbufs. If EAL failed to allocate memory it will panic.

func NewMbufArray

func NewMbufArray(socket int, size uint16) *MbufArray

NewMbufArray allocates new MbufArray from huge pages memory for socket NUMA node and containing up to size mbufs. If EAL failed to allocate memory it will panic.

func (*MbufArray) Buffer

func (buf *MbufArray) Buffer() (ret []*mbuf.Mbuf)

Buffer returns all mbufs in buf.

func (*MbufArray) Free

func (buf *MbufArray) Free()

Free releases acquired huge pages memory.

func (*MbufArray) Mbufs

func (buf *MbufArray) Mbufs() (ret []*mbuf.Mbuf)

Mbufs returns all mbufs retrieved by the ethdev API.

func (*MbufArray) Opaque

func (buf *MbufArray) Opaque() (opaque []byte)

Opaque returns slice of bytes pointing to user-defined data in MbufArray.

func (*MbufArray) Recharge

func (buf *MbufArray) Recharge() int

Recharge releases previously retrieved packets and retrieve new ones. Returns number of retrieved packets.

Jump to

Keyboard shortcuts

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