Previous Next

NdisGetBufferPhysicalArraySize

NdisGetBufferPhysicalArraySize returns the number of discontiguous physical blocks backing a buffer, given the buffer descriptor.

VOID
  NdisGetBufferPhysicalArraySize(
    IN PNDIS_BUFFER  Buffer,
    OUT PUINT  ArraySize
    );

Parameters

Buffer
Pointer to the buffer descriptor.
ArraySize
Pointer to a caller-supplied variable in which this function returns the number of discrete physical ranges backing the buffer.

Headers

Declared in Ndis.h. Include Ndis.h.

Comments

The driver of a bus-master DMA NIC might call NdisGetBufferPhysicalArraySize to determine how many NDIS_PHYSICAL_ADDRESS structures to allocate and fill in before calling NdisMStartBufferPhysicalMapping.

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

NDIS_PHYSICAL_ADDRESS, NdisMStartBufferPhysicalMapping