DPC Handler (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

Every miniport driver that manages a network interface card (NIC) that interrupts must have a MiniportHandleInterruptfunction. Even if NDIS completely handles the interrupt, it always queues a deferred procedure call (DPC) for the miniport driver, causing the miniport driver's MiniportHandleInterrupthandler to run. If MiniportISRprocesses an interrupt, it controls whether MiniportHandleInterruptis queued by the value MiniportISRreturns in the InterruptRecognizedand QueueMiniportHandleInterruptarguments. If MiniportISRsets QueueMiniportHandleInterruptto TRUE, MiniportHandleInterruptis queued for execution at IRQL = DISPATCH_LEVEL.

MiniportHandleInterruptis called after interrupts have been disabled on the NIC by the MiniportISRor MiniportDisableInterruptfunction. MiniportHandleInterruptshould read whatever data it needs to finish processing the interrupt-driven I/O operation. MiniportHandleInterruptthen reenables interrupts on the NIC, either by letting NDIS call the miniport driver's MiniportEnableInterruptfunction after MiniportHandleInterruptreturns control or by enabling the interrupt from within MiniportHandleInterrupt, which is faster. Until interrupts are reenabled, no further interrupts can occur on the NIC. To ensure that no receive data is missed, MiniportHandleInterruptshould reenable interrupts as quickly as possible.

A miniport driver that processes interrupts handles data receives and send completes in the context of its MiniportHandleInterruptfunction. For example, if MiniportHandleInterruptdetermines that the reason for the interrupt is a receive, it indicates the data up by calling NdisMIndicateReceivePacket, NdisMCoIndicateReceivePacket, or NdisMXxxIndicateReceive in the context of the DPC. For more information about how a miniport driver processes receives, see Receiving Data.

If a connectionless miniport driver determines that the reason for the interrupt is a send completion, it calls NdisMSendCompleteto signal the completion of a packet previously sent to MiniportSendor MiniportSendPackets. Similarly, if a connection-oriented miniport driver determines that the reason for the interrupt is a send completion, it calls NdisMCoSendCompleteto signal the completion of a packet that was previously sent to MiniportCoSendPackets, which returned NDIS_STATUS_PENDING. The send operations of a miniport driver are described in Sending Packets.

Sustained bursts of network activity, which are typically data receives, can force a miniport driver's MiniportHandleInterruptfunction to run for a long time, handling outstanding receive and send-completion events from the NIC. However, MiniportHandleInterruptshould not continue to run indefinitely to handle such outstanding events because MiniportHandleInterruptruns at DISPATCH_LEVEL and thus prevents all other threads that run at DISPATCH_LEVEL or lower from running on a particular processor. Therefore, MiniportHandleInterruptshould limit the time it spends handling outstanding events. For example, MiniportHandleInterruptmight limit the number of iterations it executes based on the total number of receive descriptors on the NIC.

When a miniport driver processes a receive, it must not reenable interrupts until either of the following has occurred:

  • The miniport driver has passed up an entire miniport driver-allocated packet or an array of packets containing the received data

  • The miniport driver's MiniportTransferData function has transferred the incoming data to a protocol driver-supplied packet if any protocol driver is interested in the data (Only connectionless miniports can have a MiniportTransferData function.)

If a miniport driver-allocated packet is passed up to a protocol driver and the protocol keeps the packet, the miniport driver must supply a new empty packet for the next receive. After it has completely processed the receive and is prepared for the next receive, the miniport driver can reenable interrupts.

 

 

Send comments about this topic to Microsoft