Share via


Porting Miniport Driver DMA Operations to NDIS 6.0

When compared with NDIS 5.x, NDIS 6.0 provides a much different interface for handling DMA. For information about the benefits of the NDIS 6.0 approach, see NDIS 6.0 SGDMA Support.

NDIS 6.0 provides services to register for DMA support. It also provides a runtime interface that a miniport driver uses when it handles send requests.

To register for NDIS 6.0 scatter gather DMA (SGDMA) support, initialize an NDIS_SG_DMA_DESCRIPTION structure and then pass this structure to the NdisMRegisterScatterGatherDma function. NdisMRegisterScatterGatherDma returns a handle and the miniport driver subsequently passes the handle to NDIS SGDMA runtime functions.

To release SGDMA resources that it allocated, a miniport driver calls the NdisMDeregisterScatterGatherDma function and passes it the handle returned by NdisMRegisterScatterGatherDma. The driver should call NdisMDeregisterScatterGatherDma in the context of its MiniportHaltEx function.

NDIS 6.0 scatter gather lists are associated with NET_BUFFER structures.

For miniport drivers that call the NdisMAllocateSharedMemoryAsyncEx function (formerly NdisMAllocateSharedMemoryAsync), define the MiniportSharedMemoryAllocateComplete function (formerly MiniportAllocateComplete). The entry point for MiniportSharedMemoryAllocateComplete is in the NDIS_SG_DMA_DESCRIPTION structure.

Note  In NDIS 6.0, you must call the NdisMRegisterDmaChannel function before calling NdisMAllocateSharedMemoryAsyncEx.

While processing send requests, a miniport driver can call the NdisMAllocateNetBufferSGList function to obtain a scatter gather DMA list (SGL) for a NET_BUFFER structure.

When a miniport driver calls NdisMAllocateNetBufferSGList, NDIS calls the HAL to build the SGL. After the HAL builds the SGL, NDIS calls the MiniportProcessSGList function. When NDIS calls MiniportProcessSGList, the driver can send the NET_BUFFER structure to the hardware.

Miniport drivers must call the NdisMFreeNetBufferSGList function to free an SGL.

For more information about scatter gather DMA, see Scatter/Gather DMA. For more information about porting send request handling, see Porting NDIS Miniport Driver Send Data Handling.