Contents

allocatePacket

Allocates a packet with a data buffer that is larger than or equal to the size specified.

Declaration

virtual mbuf_t allocatePacket(
 UInt32size);

Parameters

  • size:

    The minimum size of the data buffer for the mbuf packet allocated.

Return Value

Returns an mbuf packet, or 0 if allocation failed.

Overview

This method will always return a single mbuf unless the size requested (plus the alignment padding) is greater than MCLBYTES. The data buffer for the mbuf (or an mbuf chain) returned is aligned according to the constraints reported by getPacketBufferConstraints(). The length fields in each mbuf returned are set by this method, thus allowing the mbuf to be passed directly to an IOMbufMemoryCursor object in order to convert the mbuf to a physical address scatter-gather list.

See Also

Miscellaneous