|
|
The general guidelines for kernel-level device drivers that are given in ``Guidelines for all kernel drivers'' are relevant for STREAMS drivers as well. This section lists other issues that relate only to STREAMS drivers.
mac_frame_nosr
statistic.
STREAMS
allocb( )
failures show up in the STREAMS statistics
that can be viewed with the netstat -m command
or the
crash(ADM)
strstat command.
STREAMS drivers should not generate DL_UNITDATA_IND messages because of allocb( ) failures for DL_UNITDATA_REQ messages.
The following code fragment illustrates how to avoid this condition. If the allocb( ) call fails, this frame is dropped. STREAMS allocation falures usually result in a lost frame and it does not really matter which frame gets dropped.
/* receive allocb logic for BusMaster DMA devices */ if ((mp=allocb(size, pri) == NULL) ; /* no STREAMS memory available, drop completed frame */ else ; /* pass up RBD.mp, replace RBD.mp with 'mp' */
One way to avoid this problem is to use the timeout(D3oddi) function to implement a watchdog timer routine that runs every second or so to free messages left around as a result of missing transmit complete interrupts.
mp->b_datap->dp_ref
)
that is greater than 1.
address_start, length
) scatter element
represents a physically contiguous region of memory.
In earlier releases of SCO systems,
the data contained within the
b_rptr
and (b_wptr -1
)
of the STREAMS message block (mblk_t)
were always physically contiguous,
but for SCO OpenServer 5 Release 5 the driver must check each block
and break it into separate scatter elements if necessary.
MDI drivers can use the mdi_end_of_contig_segment(D3mdi) function to check whether a STREAMS message block is physically contiguous.