3.1.3.5 AllocateCompleteHandler

A busmaster DMA NIC miniport must supply a MiniportAllocateComplete function if it calls NdisMAllocateSharedMemoryAsync to allocate buffer space. NdisMAllocateSharedMemoryAsync can be called at raised IRQL, for instance from a driver’s MiniportHandleInterrupt function. Rather than forcing a driver to allocate all the buffer space it will ever require in MiniportInitialize, a driver can call NdisMAllocateSharedMemoryAsync when it runs short of buffers. Usually only a miniport that calls NdisMIndicateReceivePacket will have such a need.

Since a miniport that indicates up a complete packet, typically a miniport that manages a busmaster DMA device with a ring buffer, relinquishes ownership of indicated packets to upper layers, it relies on the upper layers to return the packets promptly. If the miniport runs short of buffers for received data because packets are not returned promptly, it can allocate a buffer in its MiniportHandleInterrupt function at raised IRQL by calling NdisMAllocateSharedMemoryAsync. The driver must then provide an AllocateCompleteHandler to be called when the asynchronous allocation is complete.