Bewerken

Delen via


Freeing a VM Queue

To free a receive queue, an overlying driver issues an OID_RECEIVE_FILTER_FREE_QUEUE set OID request. The InformationBuffer member of the NDIS_OID_REQUEST structure contains a pointer to an NDIS_RECEIVE_QUEUE_FREE_PARAMETERS structure with a queue identifier of type NDIS_RECEIVE_QUEUE_ID.

OID_RECEIVE_FILTER_FREE_QUEUE frees a receive queue that an overlying driver allocated by using the OID_RECEIVE_FILTER_ALLOCATE_QUEUE OID. For more information about allocating a receive queue, see Allocating a VM Queue.

Note  The default queue, which has a queue identifier of NDIS_DEFAULT_RECEIVE_QUEUE_ID, is always allocated and cannot be freed.

An overlying driver must free all the filters that it sets on a queue before it frees the queue. Also, an overlying driver must free all the receive queues that it allocated on a network adapter before it calls the NdisCloseAdapterEx function to close a binding to the network adapter. NDIS frees all the queues that are allocated on a network adapter before it calls the miniport driver's MiniportHaltEx function.

When a miniport driver receives a request to free a queue, it does the following:

  • Must immediately stop DMA to shared memory resources that are associated with the queue.

  • Generates a status indication to indicate that the DMA is stopped.

  • Waits for all outstanding NET_BUFFER_LIST structures, which are associated with the queue, to be returned.

  • Frees the associated shared memory and hardware resources.

When a miniport driver receives an OID_RECEIVE_FILTER_FREE_QUEUE set request, the queue must enter the Stop DMA state, it stops the DMA on a queue and the miniport driver must indicate the status change by using the NDIS_STATUS_RECEIVE_QUEUE_STATE status indication. For more information about queue states, see Queue States and Operations.

After the miniport driver issues the NDIS_STATUS_RECEIVE_QUEUE_STATE status indication, it must wait for all the pending receive indications to complete before it can free the associated shared memory. For more information about freeing shared memory, see Shared Memory Resource Allocation.