NdisMAllocateSharedMemoryAsync allocates additional memory shared between a miniport driver and its bus-master DMA NIC, usually when the miniport driver is running low on available NIC receive buffers.
NDIS_STATUS
NdisMAllocateSharedMemoryAsync(
IN NDIS_HANDLE MiniportAdapterHandle,
IN ULONG Length,
IN BOOLEAN Cached,
IN PVOID Context
);
NdisMAllocateSharedMemoryAsync can return one of the following:
Declared in Ndis.h. Include Ndis.h.
Drivers of bus-master DMA NICs call NdisMAllocateSharedMemoryAsync to dynamically allocate shared memory for transfer operations when high network traffic places excessive demands on the shared memory space that the driver allocated during initialization.
Such a NIC driver usually maintains one or more state variables to track the number of shared memory buffers available for incoming transfers. When the number of available buffers reaches a driver-determined low, the miniport driver calls NdisMAllocateSharedMemoryAsync to allocate more buffer space in shared memory. When the number of available buffers climbs to a driver-determined high, it calls NdisMFreeSharedMemory one or more times to release its preceding dynamic allocation(s).
Usually, such a driver retains the block of shared memory that its MiniportInitialize function allocated with NdisMAllocateSharedMemory until the NIC is removed, when its MiniportHalt function is called. This allocation is sufficient to handle an average demand for transfers through the NIC.
A miniport driver should set a limit on how much shared memory it can allocate. This limit is driver-specific and should be high enough so that the driver does not run out of buffers. Do not set a limit that is excessively high, as this could result in a wasteful consumption of shared memory that could reduce system performance.
Any miniport driver that calls NdisMAllocateSharedMemoryAsync or NdisMAllocateSharedMemory must release all outstanding allocations with one or more calls to NdisMFreeSharedMemory when its NIC is removed.
Callers of NdisMAllocateSharedMemoryAsync run at IRQL <= DISPATCH_LEVEL.
MiniportAllocateComplete, MiniportHalt, MiniportInitialize, NdisAllocateBuffer, NdisMAllocateSharedMemory, NdisMFreeSharedMemory