Freigeben über


Allocating Network Data Pools in an NDIS 6.0 Protocol Driver

NDIS 6.0 drivers do not allocate packet pools by calling the NdisAllocatePacketPool function, nor do they use NDIS_PACKET structures. Instead, before sending and receiving NET_BUFFER and NET_BUFFER_LIST structures, the protocol driver must allocate a NET_BUFFER pool and a NET_BUFFER_LIST pool. To allocate pools, NDIS 6.0 protocol drivers call the NdisAllocateNetBufferListPool and NdisAllocateNetBufferPool functions.

Each NET_BUFFER_LIST structure that a protocol driver uses to send network data has at least one associated NET_BUFFER structure. A driver should therefore allocate a NET_BUFFER_LIST pool with a preallocated NET_BUFFER in each NET_BUFFER_LIST. To create such a pool, call the NdisAllocateNetBufferListPool function with the fAllocateNetBuffer member of the NET_BUFFER_LIST_POOL_PARAMETERS structure set to TRUE.

The protocol driver's ProtocolUnbindAdapterEx function should call the NdisFreeNetBufferListPool and NdisFreeNetBufferPool functions to free the NET_BUFFER_LIST and NET_BUFFER pools, respectively. These functions replace the NdisFreePacketPool function. The driver passes these functions the pool handle that the associated allocation functions returned.

Before freeing these pools, the driver should ensure that all outstanding send operations are complete and free all of the structures that were allocated from the pools.

For more information about NDIS 6.0 data buffer management, see Protocol Driver Buffer Management.