Bewerken

Delen via


Protocol Driver Buffer Management

A protocol driver must manage NET_BUFFER_LIST structure pools and NET_BUFFER structure pools for send operations. To create these pools, drivers call the following functions:

NdisAllocateNetBufferListPool

NdisAllocateNetBufferPool

Protocol drivers can use the following functions to allocate structures from the pools:

NdisAllocateNetBufferAndNetBufferList

NdisAllocateNetBufferList

NdisAllocateNetBuffer

Calling NdisAllocateNetBufferAndNetBufferList is more efficient than calling NdisAllocateNetBufferList followed by NdisAllocateNetBuffer. However, NdisAllocateNetBufferAndNetBufferList only creates one NET_BUFFER structure on the NET_BUFFER_LIST structure. To use NdisAllocateNetBufferAndNetBufferList, the driver must set the AllocateNetBuffer parameter to TRUE when it calls NdisAllocateNetBufferListPool.

Protocol drivers can use OID requests to query the back-fill and context space requirements of the underlying drivers. A protocol driver should determine the back-fill and context requirements for a binding in the Opening or Restarting states. The driver should allocate sufficient back-fill and context space for the entire stack. If necessary, a protocol driver can free the pools and reallocate them in the Restarting state.

Protocol drivers use the following functions to free the pools:

NdisFreeNetBufferListPool

NdisFreeNetBufferPool.

Protocol drivers use the following functions to free the structures allocated from the pools:

NdisFreeNetBufferList

NdisFreeNetBuffer

Drivers should free NET_BUFFER structures allocated with NdisAllocateNetBuffer before freeing the associated NET_BUFFER_LIST structure. NET_BUFFER structures allocated with NdisAllocateNetBufferAndNetBufferList are freed when the driver calls NdisFreeNetBufferList for the associated NET_BUFFER_LIST structure.