A.4.8.1 Deferring Interrupt-Driven I/O from HwScsiInterrupt

If interrupt-driven I/O operations take a long time to complete, a miniport driver should have a pair of HwScsiEnableInterruptsCallback and HwScsiDisableInterruptsCallback routines.

For example, if a miniport must stall for longer than 50 microseconds doing PIO, its HwScsiInterrupt routine should not retain control of the CPU for the full polling interval in order to complete a requested operation. Instead, its HwScsiInterrupt routine should do the following:

  1. Disable interrupts from the HBA.

  2. Set up the device extension with any context necessary to complete the operation.

  3. Call ScsiPortNotification with a pointer to the device extension, the NotificationType CallEnableInterrupts, and the miniport’s HwScsiEnableInterruptsCallback routine, described in Section A.4.8.2.

  4. Return control.

The Windows NT ScsiPortNotification calls the HwScsiEnableInterruptsCallback routine as a DPC routine. For more information about DPCs, see Chapter 3.

If a miniport’s HwScsiInterrupt routine cannot disable interrupts on the HBA but its interrupt-driven transfers can take more than 50 microseconds in the HwScsiInterrupt routine, the driver writer should tune the miniport by limiting the size of the transfers that it accepts. Otherwise, the mouse pointer will appear “jumpy” and/or serial and parallel throughput will degrade noticeably every time the miniport is transferring data concurrently.

Such a miniport’s HwScsiFindAdapter routine should reset the MaximumTransferLength value in the PORT_CONFIGURATION_INFORMATION to a value that allows the miniport to carry out interrupt-driven transfers without noticeably affecting the performance of other system drivers.

Such a miniport driver also might call ScsiPortNotification with a miniport-supplied HwScsiTimer routine. For more information about HwScsiTimer routines, which are synchronized with HwScsiInterrupt routines, see Section A.4.9.