3.1.3.6 CheckForHang Handler

A miniport optionally supplies a MiniportCheckForHang function when it calls NdisMRegisterMiniport. If a miniport does not register such a handler, it relies on NDIS to detect that its NIC is hung.

If a miniport supplies a MiniportCheckForHang function, this function will be called, by default, every two seconds or at a driver-requested timeout interval. The miniport’s MiniportCheckForHang function determines if its hardware is hung. MiniportCheckForHang returns TRUE if it detects that the NIC is hung, otherwise it returns FALSE.

If a miniport does not register a MiniportCheckForHang function, NDIS concludes that a miniport is hung if:

When a miniport calls NdisMSendComplete, NDIS updates its internal state information it keeps to track pending sends so that it does not incorrectly conclude that a NIC is hung.

A NIC driver can change the default behavior of NDIS with respect to timeout in several ways by calling NdisMSetAttributesEx rather than NdisMSetAttributes in its MiniportInitialize function. By calling NdisMSetAttributesEx, the miniport can:

If the miniport specifies that NDIS should ignore packet timeout and request timeout, the miniport is responsible for detecting when a NIC is hung.

Since NdisMSetAttributesEx must be called in MiniportInitialize, this is the only time that a driver can change the default behavior of NDIS with respect to timeouts.

If MiniportCheckForHang returns TRUE, or if a send or a request has pended more than twice the timeout period, NDIS calls MiniportReset.