Documentation ¶
Overview ¶
Package pktmbuf contains bindings of DPDK mbuf library.
Index ¶
- Constants
- Variables
- type MbufAccessor
- type Packet
- func (pkt *Packet) Append(input []byte) error
- func (pkt *Packet) Bytes() []byte
- func (pkt *Packet) Chain(tail *Packet) error
- func (pkt *Packet) Close() error
- func (pkt *Packet) Headroom() int
- func (pkt *Packet) Len() int
- func (pkt *Packet) Port() uint16
- func (pkt *Packet) Prepend(input []byte) error
- func (pkt *Packet) Ptr() unsafe.Pointer
- func (pkt *Packet) ReadFrom(r io.Reader) (n int64, e error)
- func (pkt *Packet) SegmentBytes() (list [][]byte)
- func (pkt *Packet) SetHeadroom(headroom int) error
- func (pkt *Packet) SetPort(port uint16)
- func (pkt *Packet) SetTimestamp(t eal.TscTime)
- func (pkt *Packet) SetType32(packetType uint32)
- func (pkt *Packet) Tailroom() int
- func (pkt *Packet) Timestamp() eal.TscTime
- func (pkt *Packet) Type32() uint32
- type Pool
- type PoolConfig
- type PoolInfo
- type Template
- type TemplateUpdates
- type Vector
Constants ¶
const DefaultHeadroom = C.RTE_PKTMBUF_HEADROOM
DefaultHeadroom is the default headroom of a mbuf.
Variables ¶
var ( GqlConfigType *graphql.Object GqlPoolType *graphql.Object GqlTemplateType *graphql.Object )
GraphQL types.
Functions ¶
This section is empty.
Types ¶
type MbufAccessor ¶
type MbufAccessor C.struct_rte_mbuf
MbufAccessor allows accessing mbuf union fields as pointers.
func MbufAccessorFromPtr ¶
func MbufAccessorFromPtr[T any](ptr *T) *MbufAccessor
MbufAccessorFromPtr converts *C.struct_rte_mbuf pointer to Packet.
func (*MbufAccessor) BufLen ¶
func (m *MbufAccessor) BufLen() *uint16
func (*MbufAccessor) DataLen ¶
func (m *MbufAccessor) DataLen() *uint16
func (*MbufAccessor) DataOff ¶
func (m *MbufAccessor) DataOff() *uint16
func (*MbufAccessor) NbSegs ¶
func (m *MbufAccessor) NbSegs() *uint16
func (*MbufAccessor) PacketType ¶
func (m *MbufAccessor) PacketType() *uint32
func (*MbufAccessor) PktLen ¶
func (m *MbufAccessor) PktLen() *uint32
func (*MbufAccessor) Port ¶
func (m *MbufAccessor) Port() *uint16
type Packet ¶
type Packet C.struct_rte_mbuf
Packet represents a packet in mbuf.
func PacketFromPtr ¶
PacketFromPtr converts *C.struct_rte_mbuf pointer to Packet.
func (*Packet) ReadFrom ¶
ReadFrom reads once from the reader into the dataroom of this packet. It can only be used on an empty packet.
func (*Packet) SegmentBytes ¶
SegmentBytes returns the data in each segment. Each []byte aliases the mbuf.
func (*Packet) SetHeadroom ¶
SetHeadroom changes headroom of the first segment. It can only be used on an empty packet.
func (*Packet) SetTimestamp ¶
SetTimestamp sets receive timestamp.
type Pool ¶
Pool represents a DPDK memory pool for packet buffers.
func NewPool ¶
func NewPool(cfg PoolConfig, socket eal.NumaSocket) (mp *Pool, e error)
NewPool creates a Pool.
func PoolFromPtr ¶
PoolFromPtr converts *C.struct_rte_mempool pointer to Pool.
type PoolConfig ¶
type PoolConfig struct { Capacity int `json:"capacity"` PrivSize int `json:"privSize"` Dataroom int `json:"dataroom"` }
PoolConfig contains configuration for NewPool.
type PoolInfo ¶
type PoolInfo struct { *Pool // contains filtered or unexported fields }
PoolInfo augments *Pool with NUMA socket information.
func (PoolInfo) NumaSocket ¶
func (pool PoolInfo) NumaSocket() eal.NumaSocket
NumaSocket returns NUMA socket on which the Pool was created.
type Template ¶
type Template interface { // ID returns template identifier. ID() string // Config returns current configuration. Config() PoolConfig // Update changes mempool configuration. // PrivSize can only be increased. // Dataroom can be updated only if original dataroom is non-zero. // Returns self. Update(update PoolConfig) Template // Pools returns a list of created Pools. Pools() []PoolInfo // Get retrieves or creates a Pool on the given NUMA socket. // Errors are fatal. Get(socket eal.NumaSocket) *Pool }
Template represents a template to create mempools.
var ( // Direct is a mempool template for direct mbufs. Direct Template // Indirect is a mempool template for indirect mbufs. Indirect Template )
Predefined mempool templates.
func RegisterTemplate ¶
func RegisterTemplate(id string, cfg PoolConfig) Template
RegisterTemplate adds a mempool template.
type TemplateUpdates ¶
type TemplateUpdates map[string]PoolConfig
TemplateUpdates contains updates to several mempool templates.
type Vector ¶
type Vector []*Packet
Vector is a vector of packet buffers.
func VectorFromPtr ¶
VectorFromPtr constructs Vector from **C.struct_rte_mbuf and count.
Directories ¶
Path | Synopsis |
---|---|
Package mbuftestenv contains helper functions to construct mbufs in test code.
|
Package mbuftestenv contains helper functions to construct mbufs in test code. |