Chapter 10. Improving Performance

10.1. Overview

Once your user-mode driver has been written and debugged, you might find that certain modules in your code do not operate fast enough (for example: an interrupt handler or accessing I/O-mapped regions). If this is the case, try to improve performance in one of the following ways:

  • Improve the performance of your user-mode driver [10.2].
  • Create a Kernel PlugIn driver [11] and move the performance-critical portions of your code to the Kernel PlugIn.

Use the following checklist to determine how to best improve the performance of your driver.

10.1.1. Performance Improvement Checklist

The following checklist will help you determine how to improve the performance of your driver:

ISA Card — accessing an I/O-mapped range on the card

When transferring a large amount of data, use block (string) transfers and/or group several data transfer function calls into a single multi-transfer function call, as explained in Section 10.2.2 below.

If this does not solve the problem, handle the I/O at kernel mode by writing a Kernel PlugIn driver, as explained in Chapters 11 and 12 of the manual.

PCI Card — accessing an I/O-mapped range on the card Avoid using I/O ranges in your hardware design. Use Memory mapped ranges instead as they are accessed significantly faster.
Accessing a memory-mapped range on the card

Try to access memory directly instead of using function calls, as explained in Section 10.2.1 below.
When transferring large amounts of data, consider also the solution to problem #1 above.

If the problem persists, then there is a hardware design problem. You will not be able to increase performance by using any software design method, writing a Kernel PlugIn, or even by writing a full kernel driver.

Interrupt latency — missing interrupts, receiving interrupts too late Handle the interrupts in the kernel mode by writing a Kernel PlugIn driver, as explained in Chapters 11 and 12.
PCI target access vs. master access PCI target access is usually slower than PCI master access (bus-master DMA). For large data transfers, bus-master DMA access is preferable. Section 9.1 of the manual explains how to use WinDriver to implement bus-master DMA.