Canceling the NDIS Selective Suspend Idle Notification

If the network adapter becomes inactive for an idle time-out period, NDIS starts the selective suspend operation. Through this operation, the network adapter is transitioned to a low-power state. NDIS begins this operation by issuing an idle notification to the miniport driver. For more information about this operation, see Handling the NDIS Selective Suspend Idle Notification.

NDIS calls the MiniportIdleNotification handler function to notify the driver that the underlying network adapter seems to be idle. After the idle notification is issued, NDIS cancels a pending idle notification if one or more of the following conditions are true:

NDIS cancels the idle notification by calling the MiniportCancelIdleNotification handler function of the underlying miniport driver. When this function is called, the miniport driver must complete the idle notification to resume the adapter to a full-power state. For guidelines on this process, see Completing the NDIS Selective Suspend Idle Notification.

For more information about how to implement the MiniportCancelIdleNotification handler function, see Implementing a MiniportCancelIdleNotification Handler Function.

Canceling the Idle Notification Because of Overlying Driver Activity

NDIS monitors send requests and OID requests that are issued to a miniport driver whose network adapter has been suspended and is in a low-power state. When this happens, NDIS cancels the outstanding idle notification so that the network adapter can resume to a full-power state.

NDIS and the miniport driver follow these steps when an idle notification is canceled:

  1. NDIS calls the MiniportCancelIdleNotification handler function to cancel an outstanding idle notification. When this handler function is called, the miniport driver must cancel any bus-specific I/O request packets (IRPs) that it may have previously issued for the idle notification.

    For example, when MiniportCancelIdleNotification is called, the miniport for a USB network adapter performs the following steps:

    1. The miniport driver cancels the pending USB idle request (IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION) IRP. The miniport driver previously issued this IRP to the underlying USB bus driver when NDIS called the driver's MiniportIdleNotification function. The miniport driver cancels this IRP by calling IoCancelIrp.

    2. When the bus driver cancels the USB idle request IRP, it calls the miniport driver's completion routine for the IRP. This call notifies the driver that the IRP is completed and the network adapter can transition to a full-power state. From the context of the completion routine, the driver calls NdisMIdleNotificationComplete to notify NDIS that the network adapter can be transitioned to a full-power state.

    Note Depending on the dependencies for canceling bus-specific idle requests, the miniport driver calls NdisMIdleNotificationComplete either synchronously in the context of the call to MiniportCancelIdleNotification or asynchronously after MiniportCancelIdleNotification returns.

    For more information about how to implement a USB idle request IRP completion routine, see Implementing a USB Idle Request IRP Completion Routine.

  2. After the miniport driver cancels any bus-specific IRPs for the idle notification, it calls NdisMIdleNotificationComplete. This call notifies NDIS that the idle notification has been completed. NDIS then completes the selective suspend operation by transitioning the network adapter to a full-power state.

    When NdisMIdleNotificationComplete is called, NDIS performs the following steps:

    1. NDIS issues IRP_MN_SET_POWER to the underlying bus driver. This IRP requests the bus driver to set the power state of the network adapter to PowerDeviceD0.

    2. NDIS issues an OID set request of OID_PNP_SET_POWER to the miniport driver. In this OID request, NDIS specifies that the network adapter is now transitioning to a full-power state of NdisDeviceStateD0.

      When it handles this OID set request, the driver prepares the adapter for full- power operation. This includes restoring the receive and send engines to the same state they were in before the transition to the low-power state. The driver then completes the OID request with NDIS_STATUS_SUCCESS.

The following figure shows the steps that are involved when NDIS cancels an idle notification that was issued to a miniport driver for a USB network adapter.

Diagram that shows the idle notification resume process for a USB network adapter.

Canceling the Idle Notification Because of Wake-up Events

Before the network adapter is transitioned to a low-power state, NDIS issues an OID set request of OID_PM_PARAMETERS to the network adapter. This OID request specifies the types of wake-up events that the adapter can signal to resume to a full-power state. For NDIS selective suspend, the adapter is configured to signal any of the following wake-up events:

NDIS and the miniport driver follow these steps when NDIS cancels an idle notification because of a wake-up signal generated by the network adapter:

  1. The bus driver completes the IRP_MN_WAIT_WAKE that was issued by NDIS before transitioning the adapter to a low-power state. By completing the IRP, the bus driver notifies NDIS that the network adapter has generated a wake-up signal.

  2. NDIS calls the MiniportCancelIdleNotification handler function to start the operation of canceling the idle notification. The steps that are involved in this operation are the same as described in Canceling the Idle Notification because of Overlying Driver Activity.

For example, the following figure shows the steps that are involved when NDIS cancels an idle notification because of a wake-up event signaled by a USB network adapter.

Diagram that shows NDIS idle notification wake-up process for a USB network adapter.