NdisGetBufferPhysicalArraySize
VOID
NdisGetBufferPhysicalArraySize(
IN PNDIS_BUFFER Buffer,
OUT PUINT ArraySize
);
NdisGetBufferPhysicalArraySize returns the number of discontiguous physical blocks backing a buffer, given the buffer descriptor.
Parameters
Buffer
Points to the buffer descriptor.
ArraySize
Points to a caller-supplied variable in which this function returns the number of discrete physical ranges backing the buffer.
Comments
The driver of a busmaster DMA NIC might call NdisGetBufferPhysicalArraySize to determine how many NDIS_PHYSICAL_ADDRESS structures to allocate and fill in before calling NdisStartBufferPhysicalMapping.
A protocol driver might call NdisGetBufferPhysicalArraySize to build a scatter/gather list for an underlying NIC driver. However, a protocol driver with such NIC-specific functionality is unlikely to be bindable to any other NIC driver.
The maximum number of physical blocks in the buffer can be one more than the number this function writes, depending on the arrangement of the buffer in paged memory. NdisGetBufferPhysicalArraySize returns the number of pages required to back a buffer of the given length, so if the buffer descriptor actually maps a buffer that begins at an offset within a page, the value returned by this call is one less than the number of page breaks.
A driver must release any spin lock it is holding before calling NdisGetBufferPhysicalArraySize.
Callers of NdisGetBufferPhysicalArraySize run at IRQL <= DISPATCH_LEVEL.
See Also