Message block allocation
See
``Messages, STREAMS''
for information about message blocks
and how they are allocated.
-
STREAMS blocks are allocated with the
allocb(D3str),
allocb_physreq(D3str),
or
esballoc(D3str)
function.
If no STREAMS blocks are available,
these calls fail.
The driver should silently drop the mesage or data being processed
and increment the
mac_frame_nosr
statistic.
STREAMS
allocb( )
failures show up in the STREAMS statistics
that can be viewed with the netstat command
or the
crash
strstat command.
-
When allocating STREAMS buffers greater than 4K
in a DDI driver,
use the
allocb_physreq(D3str)
function and specify the buffer size in the
phys_dmasize
member of the
physreq(D4)
structure that is pointed to by the last argument of the
allocb_physreq( )
function.
The pages in these large STREAMS blocks
are virtually contiguous but may not be physically contiguous
if the buffers are allocated with the
allocb(D3str)
function.
Drivers for adapters that use Bus Master DMA expect that
each (address_start, length
) scatter element
represents a physically contiguous region of memory.
DDI drivers can use the
msgphysreq(D3str)
function to check whether a STREAMS message block
is physically contiguous.
-
DDI drivers that use DMA
should allocate a replacement block with the
allocb_physreq(D3str)
function before attempting to pass
the completed receive frame upstream.
allocb_physreq( )
points to a
physreq(D4)
structure that indicates physical address alignment
and contiguity constraints on memory.
Some older STREAMS drivers
may include some intricate coding
that prevented orphaned descriptors that could occur
when STREAMS blocks for DMA were allocated with the
allocb(D3str)
function.
Such code can be removed from DDI drivers when
allocb_physreq( )
is used.
-
STREAMS drivers should not generate
DL_UNITDATA_IND(D7dlpi)
messages because of
allocb( )
failures for
DL_UNITDATA_REQ(D7dlpi)
messages.
-
For drivers that use memory-mapped I/O,
use
esballoc(D3str)
rather than
allocb(D3str).
-
Some devices such as the IBM Token-Ring Network
16/4 Busmaster Service Adapter/A
are limited to 24 address lines
and so cannot perform DMA operations
with addresses beyond 16Mb.
Because of the dynamic memory allocation scheme,
it is not possible to guarantee that
all STREAMS memory is in the lowest 16Mb of memory.
DDI drivers for DMA devices
that cannot perform DMA operations above 16Mb
should set the
phys_dmasize
member
of the
physreq(D4)
structure to the correct size (24 in this case)
when running on systems with more than 16Mb of memory configured.
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005