Allocating and Freeing Scatter/Gather Lists

An NDIS miniport driver calls the NdisMAllocateNetBufferSGList function in its MiniportSendNetBufferLists function. The miniport driver calls NdisMAllocateNetBufferSGList once for each NET_BUFFER structure that it must map. After the resources become available and HAL has the SG list ready, NDIS calls the driver's MiniportProcessSGList function. NDIS can call MiniportProcessSGList before or after the miniport driver's call to NdisMAllocateNetBufferSGList returns.

To improve system performance, the scatter/gather list is generated from the network data starting at the beginning of the MDL that is specified at the CurrentMdl member of the associated NET_BUFFER_DATA structure. The start of the network data in the SG list is offset from the beginning of the SG list by the value specified in the CurrentMdlOffset member of the associated NET_BUFFER_DATA structure.

While handling a DPC for a send-complete interrupt, and after the miniport driver does not need the SG list any more, the miniport driver should call the NdisMFreeNetBufferSGList function to free the SG list.

Note Do not call NdisMFreeNetBufferSGList while the driver or hardware is still accessing the memory that is described by the NET_BUFFER structure that is associated with the scatter/gather list.

Before accessing received data, miniport drivers must call NdisMFreeNetBufferSGList to flush the memory cache.

Miniport Driver Scatter/Gather DMA

NDIS Scatter/Gather DMA

Registering and Deregistering DMA Channels