VOID
NdisMSetupDmaTransfer(
OUT PNDIS_STATUS Status,
IN PNDIS_HANDLE MiniportDmaHandle,
IN PNDIS_BUFFER Buffer,
IN ULONG Offset,
IN ULONG Length,
IN BOOLEAN WriteToDevice
);
NdisMSetupDmaTransfer sets up the host DMA controller for a DMA transfer.
Drivers of slave-DMA NICs call NdisMSetupDmaTransfer in response to incoming send requests, for which the driver sets WriteToDevice to TRUE. They set WriteToDevice to FALSE when they transfer received data from the NIC to host memory.
The caller of NdisMSetupDmaTransfer supplies a buffer descriptor mapping the host memory range that is the target of the transfer or that contains data for a download operation from the host to the NIC. To specify a transfer sized to suit the DMA constraints of its NIC, the caller can set up a subrange to be transferred with the Offset and Length parameters if necessary.
The caller must supply a buffer descriptor that specifies the host range into which received data will be transferred from the NIC when WriteToDevice is FALSE. Otherwise, the buffer descriptor at Buffer was chained to a packet descriptor input to the NIC driver’s MiniportSend or MiniportSendPackets function.
To improve performance for small transmit requests, such as a send request of less than 256K in length, a miniport can copy the packet data into an internal staging buffer and pass a driver-allocated buffer descriptor mapping that buffer to NdisMSetupDmaTransfer.
On return from NdisMSetupDmaTransfer, the host DMA controller has been programmed for the transfer. The miniport then programs its NIC for the transfer operation.
When the transfer is complete, the miniport must call NdisMCompleteDmaTransfer.
Callers of NdisMSetupDmaTransfer run at IRQL <= DISPATCH_LEVEL.
MiniportHandleInterrupt, MiniportSend, MiniportSendPackets, MiniportTimer, NdisAllocateBuffer, NdisAllocateBufferPool, NdisAllocateMemory, NdisMCompleteDmaTransfer, NdisMDeregisterDmaChannel, NdisMRegisterDmaChannel