Documentation
¶
Index ¶
- Variables
- func PktMbufAllocBulk(p *mempool.Mempool, ms []*Mbuf) error
- func PktMbufFreeBulk(ms []*Mbuf)
- func PktMbufPrivSize(p *mempool.Mempool) int
- type Mbuf
- func (m *Mbuf) BufLen() uint16
- func (m *Mbuf) Data() []byte
- func (m *Mbuf) HashRss() uint32
- func (m *Mbuf) HeadRoomSize() uint16
- func (m *Mbuf) Mempool() *mempool.Mempool
- func (m *Mbuf) Next() *Mbuf
- func (m *Mbuf) PktLen() uint32
- func (m *Mbuf) PktMbufAppend(data []byte) error
- func (m *Mbuf) PktMbufClone(p *mempool.Mempool) *Mbuf
- func (m *Mbuf) PktMbufFree()
- func (m *Mbuf) PktMbufHeadRoomSize() uint16
- func (m *Mbuf) PktMbufReset()
- func (m *Mbuf) PktMbufTailRoomSize() uint16
- func (m *Mbuf) PrivData(ptr *common.CStruct)
- func (m *Mbuf) PrivSize() uint16
- func (m *Mbuf) RawFree()
- func (m *Mbuf) RefCntRead() uint16
- func (m *Mbuf) RefCntSet(v uint16)
- func (m *Mbuf) RefCntUpdate(v int16) uint16
- func (m *Mbuf) ResetAndAppend(data *common.CStruct) error
- func (m *Mbuf) TailRoomSize() uint16
Constants ¶
This section is empty.
Variables ¶
var ErrNullData = errors.New("NULL response returned")
ErrNullData is returned if NULL is returned by Cgo call.
Functions ¶
func PktMbufAllocBulk ¶
PktMbufAllocBulk allocate a bulk of mbufs.
func PktMbufFreeBulk ¶
func PktMbufFreeBulk(ms []*Mbuf)
PktMbufReset frees a bulk of packet mbufs back into their original mempools.
func PktMbufPrivSize ¶
PktMbufPrivSize get the application private size of mbufs stored in a pktmbuf_pool. The private size of mbuf is a zone located between the rte_mbuf structure and the data buffer where an application can store data associated to a packet.
Types ¶
type Mbuf ¶
type Mbuf C.struct_rte_mbuf
Mbuf contains a packet.
func AllocResetAndAppend ¶
AllocResetAndAppend allocates an uninitialized mbuf from mempool p, resets the fields of the mbuf to default values and appends the given data to an mbuf.
Note that NULL may be returned if allocation failed or if there is not enough tailroom space in the last segment of mbuf. p is the mempool from which the mbuf is allocated. Data is C array representation of data to add.
func PktMbufAlloc ¶
PktMbufAlloc allocate an uninitialized mbuf from mempool p. Note that NULL may be returned if allocation failed.
func (*Mbuf) BufLen ¶
BufLen represents DataRoomSize that was initialized in mempool.CreateMbufPool.
NOTE: Max available data length that mbuf can hold is BufLen - HeadRoomSize.
func (*Mbuf) HeadRoomSize ¶
HeadRoomSize returns the value of the data_off field, which must be equal to the size of the headroom in concrete mbuf.
func (*Mbuf) PktMbufAppend ¶
PktMbufAppend append the given data to an mbuf. Error may be returned if there is not enough tailroom space in the last segment of mbuf.
func (*Mbuf) PktMbufClone ¶
PktMbufClone clones the mbuf using supplied mempool as the buffer source. NOTE: NULL may return if allocation fails.
func (*Mbuf) PktMbufFree ¶
func (m *Mbuf) PktMbufFree()
PktMbufFree returns this mbuf into its originating mempool along with all its segments.
func (*Mbuf) PktMbufHeadRoomSize ¶
PktMbufHeadRoomSize represents RTE_PKTMBUF_HEADROOM size in concrete mbuf.
NOTE: This implies Cgo call and is used for testing purposes only. Use HeadRoomSize instead.
func (*Mbuf) PktMbufReset ¶
func (m *Mbuf) PktMbufReset()
PktMbufReset reset the fields of a packet mbuf to their default values.
func (*Mbuf) PktMbufTailRoomSize ¶
PktMbufTailRoomSize represents RTE_PKTMBUF_TAILROOM which is available length that can be appended to mbuf.
NOTE: This implies Cgo call and is used for testing purposes only. Use TailRoomSize instead.
func (*Mbuf) PrivData ¶
PrivData sets ptr to point to mbuf's private area. Private data length is set to the priv_size field of an mbuf itself. Although this length may be 0 the private area may still be usable as HeadRoomSize is not 0.
Feel free to edit the contents. A pointer to the headroom will be returned if the length of the private zone is 0.
func (*Mbuf) RawFree ¶
func (m *Mbuf) RawFree()
RawFree returns this mbuf into its originating mempool.
func (*Mbuf) RefCntRead ¶
RefCntRead reads the value of an mbuf's refcnt.
func (*Mbuf) RefCntUpdate ¶
RefCntUpdate adds given value to an mbuf's refcnt and returns its new value.
func (*Mbuf) ResetAndAppend ¶
ResetAndAppend reset the fields of a mbuf to their default values and append the given data to an mbuf. Error may be returned if there is not enough tailroom space in the last segment of mbuf. Len is the amount of data to append (in bytes).
func (*Mbuf) TailRoomSize ¶
TailRoomSize returns available length that can be appended to mbuf.