FIX: Large Transfers Via SCSI Passthrough May Crash SystemLast reviewed: October 29, 1997Article ID: Q126369 |
3.50
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSWhen transferring data via the SCSI passthrough (IOCTL_SCSI_PASS_THROUGH and IOCTL_SCSI_PASS_THROUGH_DIRECT), a transfer larger than the targeted SCSI host bus adapter (HBA) can support may crash the system.
CAUSEThe SCSI port driver is not checking that the requested data transfer can be safely handled by the SCSI HBA.
RESOLUTIONThe Win32 application must ensure that SCSI passthrough data transfers can be safely handled by the HBA before sending them to the SCSI port driver. To do so, the application should first make a call to get the capabilities of the SCSI HBA. This is done with a call to DeviceIoControl with an IOCTL of IOCTL_SCSI_GET_CAPABILITIES. The returned capabilities structure will include two very important items:
- MaximumTransferLength, which specifies the maximum number of bytes the HBA can transfer in a single transfer operation. - MaximumPhysicalPages, which specifies the maximum number of physical discontiguities between address ranges that a data buffer can have if the HBA supports scatter/gather.These two values are originally set by the SCSI miniport, but may be adjusted slightly by the SCSI port driver during initialization depending on the hardware configuration of the computer. Before each transfer, the application should ensure that the requested transfer does not exceed either the SCSI HBA MaximumTransferLength nor the MaximumPhysicalPages. If the transfer is too large, the application should split the request into two (or more) smaller requests.
Calculating the maximum transfer sizeThe simplest thing to do is to multiply the MaximumPhysicalPages value by the page size for the machine. The requested transfer size should equal the result or the MaximumTransferLength, whichever is smaller. In other words, the requested transfer size should equal the smaller of:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was resolved in Windows NT version 3.51.
REFERENCESThere is a sample program on the DDK CD, called SPTI (SCSI Pass Through Interface) that demonstrates a lot of the concepts discussed in this article. Currently, the files for this sample are on the DDK CD in:
\q_a\samples\ddk\sptiThese files are not automatically copied to the users hard disk during installation of the DDK -- they must be copied manually.
|
Additional reference words: 3.50 memory buffering
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |