IRQLs in Network Drivers

Every driver function called by NDIS runs at a system-determined IRQL (one of PASSIVE_LEVEL < DISPATCH_LEVEL < DIRQL). For example, a miniport driver's initialization function, halt function, reset function, and shutdown function commonly run at PASSIVE_LEVEL, although the reset and shutdown functions can be invoked at a higher IRQL if the system requires it. Interrupt code runs at DIRQL, so an NDIS intermediate or protocol driver never runs at DIRQL. All other NDIS driver functions run at or below IRQL = DISPATCH_LEVEL.

The IRQL at which a driver function runs affects which NDIS functions it can call. Certain functions can be called only at IRQL = PASSIVE_LEVEL. Others can be called at DISPATCH_LEVEL or lower. You should check every NDIS function for IRQL restrictions.

Any driver function that shares resources with the driver's interrupt service routine (ISR) must be able to raise its IRQL to DIRQL to prevent race conditions. NDIS provides such a mechanism.