Documentation ¶
Overview ¶
Package eal contains bindings of DPDK Environment Abstraction Layer.
Index ¶
- Constants
- Variables
- func AllocObjectID(dbgtype string) string
- func CallMain(f interface{}) interface{}
- func Free(ptr interface{})
- func FromTscDuration(d int64) time.Duration
- func GetNanosInTscUnit() float64
- func GetTscUnit() time.Duration
- func PostMain(fn cptr.Function)
- func ToTscDuration(d time.Duration) int64
- func Zmalloc(dbgtype string, size interface{}, socket NumaSocket) unsafe.Pointer
- func ZmallocAligned(dbgtype string, size interface{}, align int, socket NumaSocket) unsafe.Pointer
- type Errno
- type LCore
- type NumaSocket
- type PollThread
- type TscTime
- type VDev
- type WithNumaSocket
Constants ¶
const MaxLCoreID = C.RTE_MAX_LCORE
MaxLCoreID is the maximum LCore ID.
Variables ¶
var ( // MainLCore is the main lcore. MainLCore LCore // Workers are worker lcores. Workers []LCore // Sockets are NUMA sockets of worker lcores. Sockets []NumaSocket // MainThread is a PollThread running on the initial lcore. MainThread PollThread // MainReadSide is an RCU read-side object of the MainThread. MainReadSide *urcu.ReadSide )
EAL variables, available after ealinit.Init().
var GqlWithNumaSocket = &graphql.Field{ Type: graphql.Int, Name: "numaSocket", Description: "NUMA socket.", Resolve: func(p graphql.ResolveParams) (interface{}, error) { socket := p.Source.(WithNumaSocket).NumaSocket() return gqlserver.Optional(socket.ID(), !socket.IsAny()), nil }, }
GqlWithNumaSocket is a GraphQL field for source object that implements WithNumaSocket.
Functions ¶
func AllocObjectID ¶
AllocObjectID allocates an identifier/name for DPDK objects.
func CallMain ¶
func CallMain(f interface{}) interface{}
CallMain executes a function on the main thread and waits for its completion. f must be a function with zero parameters and zero or one return values. Returns f's return value, or nil if f does not have a return value.
func FromTscDuration ¶
FromTscDuration converts TSC duration to time.Duration.
func GetNanosInTscUnit ¶
func GetNanosInTscUnit() float64
GetNanosInTscUnit returns number of nanoseconds in a TSC time unit.
func GetTscUnit ¶
GetTscUnit returns TSC time unit as time.Duration.
func ToTscDuration ¶
ToTscDuration converts time.Duration to TSC duration.
func Zmalloc ¶
func Zmalloc(dbgtype string, size interface{}, socket NumaSocket) unsafe.Pointer
Zmalloc allocates zero'ed memory on specified NumaSocket. Panics if out of memory.
func ZmallocAligned ¶
func ZmallocAligned(dbgtype string, size interface{}, align int, socket NumaSocket) unsafe.Pointer
ZmallocAligned allocates zero'ed memory on specified NumaSocket. Panics if out of memory. size can be either uintptr or a signed integer type. align specifies alignment requirement in cachelines (must be power of 2), or 0 to indicate no requirement.
Types ¶
type LCore ¶
type LCore struct {
// contains filtered or unexported fields
}
LCore represents a logical core. Zero LCore is invalid.
func (LCore) MarshalJSON ¶
MarshalJSON encodes lcore as number. Invalid lcore is encoded as null.
func (LCore) NumaSocket ¶
func (lc LCore) NumaSocket() (socket NumaSocket)
NumaSocket returns the NUMA socket where this lcore is located.
func (LCore) RemoteLaunch ¶
RemoteLaunch asynchronously launches a function on this lcore. Errors are fatal.
type NumaSocket ¶
type NumaSocket struct {
// contains filtered or unexported fields
}
NumaSocket represents a NUMA socket. Zero value is SOCKET_ID_ANY.
func NumaSocketFromID ¶
func NumaSocketFromID(id int) (socket NumaSocket)
NumaSocketFromID converts socket ID to NumaSocket.
func NumaSocketsOf ¶
func NumaSocketsOf(list interface{}) (result []NumaSocket)
NumaSocketsOf collects associated/preferred NUMA sockets of a list of objects. list must be a slice of objects that implement WithNumaSocket; panics otherwise.
func (NumaSocket) IsAny ¶
func (socket NumaSocket) IsAny() bool
IsAny returns true if this represents SOCKET_ID_ANY.
func (NumaSocket) MarshalJSON ¶
func (socket NumaSocket) MarshalJSON() ([]byte, error)
MarshalJSON encodes NUMA socket as number. Any is encoded as null.
func (NumaSocket) Match ¶
func (socket NumaSocket) Match(other NumaSocket) bool
Match returns true if either NumaSocket is SOCKET_ID_ANY, or both are the same NumaSocket.
func (NumaSocket) NumaSocket ¶
func (socket NumaSocket) NumaSocket() NumaSocket
NumaSocket implements WithNumaSocket.
func (NumaSocket) String ¶
func (socket NumaSocket) String() string
type PollThread ¶
PollThread represents a thread that can accept and execute posted functions.
type VDev ¶
type VDev struct {
// contains filtered or unexported fields
}
VDev represents a DPDK virtual device.
func NewVDev ¶
func NewVDev(name, args string, socket NumaSocket) (vdev *VDev, e error)
NewVDev creates a virtual device.
func (*VDev) NumaSocket ¶
func (vdev *VDev) NumaSocket() NumaSocket
NumaSocket returns the NUMA socket of this device, if known.
type WithNumaSocket ¶
type WithNumaSocket interface {
NumaSocket() NumaSocket
}
WithNumaSocket interface is implemented by types that have an associated or preferred NUMA socket.