ReactOS  0.4.15-dev-1200-gc3b3fcd
retry.c
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 2010
4 
5 Module Name:
6 
7  retry.c
8 
9 Abstract:
10 
11  Packet retry routines for CLASSPNP
12 
13 Environment:
14 
15  kernel mode only
16 
17 Notes:
18 
19 
20 Revision History:
21 
22 --*/
23 
24 #include "classp.h"
25 #include "debug.h"
26 
27 #ifdef DEBUG_USE_WPP
28 #include "retry.tmh"
29 #endif
30 
31 
32 /*
33  * InterpretTransferPacketError
34  *
35  * Interpret the SRB error into a meaningful IRP status.
36  * ClassInterpretSenseInfo also may modify the SRB for the retry.
37  *
38  * Return TRUE iff packet should be retried.
39  */
41 {
43  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExtension->PrivateFdoData;
44  ULONG timesAlreadyRetried;
45  BOOLEAN shouldRetry = FALSE;
47 
48  /*
49  * Interpret the error using the returned sense info first.
50  */
51  Pkt->RetryIn100nsUnits = 0;
52 
53 
54  /*
55  * Pre-calculate the number of times the IO has already been
56  * retried, so that all InterpretSenseInfo routines get the right value.
57  */
58  if (ClasspTransferPacketGetNumberOfRetriesDone(Pkt, pCdb, &timesAlreadyRetried) == FALSE)
59  {
60  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, "Unhandled SRB Function %xh in error path for packet %p (did miniport change Srb.Cdb.OperationCode ?)", (ULONG)pCdb->CDB10.OperationCode, Pkt));
61  }
62 
63  if (fdoData->InterpretSenseInfo != NULL) {
64 
65  SCSI_REQUEST_BLOCK tempSrb = { 0 };
67 
68  // SAL annotation and ClassInitializeEx() both validate this
70 
71  //
72  // If class driver does not support extended SRB and this is
73  // an extended SRB, convert to legacy SRB and pass to class
74  // driver.
75  //
76  if ((Pkt->Srb->Function == SRB_FUNCTION_STORAGE_REQUEST_BLOCK) &&
77  ((fdoExtension->CommonExtension.DriverExtension->SrbSupport &
80  srbPtr = &tempSrb;
81  }
82 
83  shouldRetry = fdoData->InterpretSenseInfo->Interpret(Pkt->Fdo,
85  srbPtr,
87  0,
88  timesAlreadyRetried,
91  &Pkt->RetryIn100nsUnits);
92 
93 
94  } else {
95 
96  //
97  // In this case, fdoData->InterpretSenseInfo == NULL so we must do our
98  // own error code and sense info processing.
99  //
100 
102  UCHAR senseInfoBufferLength = ClasspTransferPacketGetSenseInfoBufferLength(Pkt);
104  UCHAR senseKey = 0;
106  UCHAR additionalSenseQual = 0;
107 
109 
110  validSense = ScsiGetSenseKeyAndCodes(senseInfoBuffer,
111  senseInfoBufferLength,
113  &senseKey,
115  &additionalSenseQual);
116 
117  if (pCdb->MEDIA_REMOVAL.OperationCode == SCSIOP_MEDIUM_REMOVAL) {
118 
119  ULONG retryIntervalSeconds = 0;
120  /*
121  * This is an Ejection Control SRB. Interpret its sense info specially.
122  */
123  shouldRetry = ClassInterpretSenseInfo(
124  Pkt->Fdo,
126  IRP_MJ_SCSI,
127  0,
128  timesAlreadyRetried,
129  &Pkt->Irp->IoStatus.Status,
130  &retryIntervalSeconds);
131 
132  if (shouldRetry) {
133  /*
134  * If the device is not ready, wait at least 2 seconds before retrying.
135  */
136  BOOLEAN setRetryIntervalSeconds = FALSE;
137 
138  if (validSense) {
139 
142  setRetryIntervalSeconds = TRUE;
143  }
144  }
145 
146  if (!setRetryIntervalSeconds && (SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_SELECTION_TIMEOUT)) {
147  setRetryIntervalSeconds = TRUE;
148  }
149 
150  if (setRetryIntervalSeconds) {
151  retryIntervalSeconds = MAX(retryIntervalSeconds, 2);
152  }
153  }
154 
155  if (shouldRetry)
156  {
157  Pkt->RetryIn100nsUnits = retryIntervalSeconds;
158  Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
159  }
160 
161  }
162  else if ((pCdb->MODE_SENSE.OperationCode == SCSIOP_MODE_SENSE) ||
163  (pCdb->MODE_SENSE.OperationCode == SCSIOP_MODE_SENSE10)) {
164 
165  ULONG retryIntervalSeconds = 0;
166  /*
167  * This is an Mode Sense SRB. Interpret its sense info specially.
168  */
169  shouldRetry = ClassInterpretSenseInfo(
170  Pkt->Fdo,
172  IRP_MJ_SCSI,
173  0,
174  timesAlreadyRetried,
175  &Pkt->Irp->IoStatus.Status,
176  &retryIntervalSeconds);
177  if (shouldRetry) {
178  /*
179  * If the device is not ready, wait at least 2 seconds before retrying.
180  */
181  BOOLEAN setRetryIntervalSeconds = FALSE;
182 
183  if (validSense) {
186  setRetryIntervalSeconds = TRUE;
187  }
188  }
189 
190  if (!setRetryIntervalSeconds && (SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_SELECTION_TIMEOUT)) {
191  setRetryIntervalSeconds = TRUE;
192  }
193 
194  if (setRetryIntervalSeconds) {
195  retryIntervalSeconds = MAX(retryIntervalSeconds, 2);
196  }
197  }
198 
199  /*
200  * Some special cases for mode sense.
201  */
203  shouldRetry = TRUE;
204  }
205  else if (SRB_STATUS(Pkt->Srb->SrbStatus) == SRB_STATUS_DATA_OVERRUN) {
206  /*
207  * This is a HACK.
208  * Atapi returns SRB_STATUS_DATA_OVERRUN when it really means
209  * underrun (i.e. success, and the buffer is longer than needed).
210  * So treat this as a success.
211  * When the caller of this function sees that the status was changed to success,
212  * it will add the transferred length to the original irp.
213  */
215  shouldRetry = FALSE;
216  }
217 
218  if (shouldRetry)
219  {
220  Pkt->RetryIn100nsUnits = retryIntervalSeconds;
221  Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
222  }
223 
224  }
225  else if ((pCdb->CDB10.OperationCode == SCSIOP_READ_CAPACITY) ||
226  (pCdb->CDB16.OperationCode == SCSIOP_READ_CAPACITY16)) {
227 
228  ULONG retryIntervalSeconds = 0;
229 
230  /*
231  * This is a Drive Capacity SRB. Interpret its sense info specially.
232  */
233  shouldRetry = ClassInterpretSenseInfo(
234  Pkt->Fdo,
236  IRP_MJ_SCSI,
237  0,
238  timesAlreadyRetried,
239  &Pkt->Irp->IoStatus.Status,
240  &retryIntervalSeconds);
242  shouldRetry = TRUE;
243  }
244 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
245  else if (ClasspSrbTimeOutStatus(Pkt->Srb)) {
246 
247  Pkt->TimedOut = TRUE;
248 
249  if (shouldRetry) {
250  //
251  // For requests that have timed-out we may only perform a limited
252  // number of retries. This is typically less than the general
253  // number of retries allowed.
254  //
255  if (Pkt->NumIoTimeoutRetries == 0) {
256  shouldRetry = FALSE;
257  } else {
259  //
260  // We expect to be able to retry if there are some general retries remaining.
261  //
262  }
263  }
264  }
265 #endif
266 
267  if (shouldRetry)
268  {
269  Pkt->RetryIn100nsUnits = retryIntervalSeconds;
270  Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
271  }
272 
273  }
274  else if (IS_SCSIOP_READWRITE(pCdb->CDB10.OperationCode)) {
275 
276  ULONG retryIntervalSeconds = 0;
277  /*
278  * This is a Read/Write Data packet.
279  */
281 
282  shouldRetry = ClassInterpretSenseInfo(Pkt->Fdo,
284  origCurrentSp->MajorFunction,
285  0,
286  timesAlreadyRetried,
287  &Pkt->Irp->IoStatus.Status,
288  &retryIntervalSeconds);
289 
290  /*
291  * Deal with some special cases.
292  */
294  /*
295  * We are in extreme low-memory stress.
296  * We will retry in smaller chunks.
297  */
298  shouldRetry = TRUE;
299  }
300  else if (TEST_FLAG(origCurrentSp->Flags, SL_OVERRIDE_VERIFY_VOLUME) &&
302  /*
303  * We are still verifying a (possibly) reloaded disk/cdrom.
304  * So retry the request.
305  */
307  shouldRetry = TRUE;
308 
309  }
310 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
311  else if (ClasspSrbTimeOutStatus(Pkt->Srb)) {
312 
313  Pkt->TimedOut = TRUE;
314 
315  if (shouldRetry) {
316  //
317  // For requests that have timed-out we may only perform a limited
318  // number of retries. This is typically less than the general
319  // number of retries allowed.
320  //
321  if (Pkt->NumIoTimeoutRetries == 0) {
322  shouldRetry = FALSE;
323  } else {
325  //
326  // We expect to be able to retry if there are some general retries remaining.
327  //
328  }
329  }
330  }
331 #endif
332 
333  if (shouldRetry)
334  {
335  Pkt->RetryIn100nsUnits = retryIntervalSeconds;
336  Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
337  }
338 
339  } else if (ClasspIsOffloadDataTransferCommand(pCdb)) {
340 
341  ULONG retryIntervalSeconds = 0;
342 
343  Pkt->TransferCount = 0;
344 
345  shouldRetry = ClassInterpretSenseInfo(
346  Pkt->Fdo,
348  IRP_MJ_SCSI,
349  0,
350  timesAlreadyRetried,
351  &Pkt->Irp->IoStatus.Status,
352  &retryIntervalSeconds);
353 
354  if (shouldRetry) {
355 
356  Pkt->RetryIn100nsUnits = retryIntervalSeconds;
357  Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
358 
359  } else {
360 
361  if (ClasspIsTokenOperation(pCdb)) {
362 
363  BOOLEAN isInformationValid = FALSE;
365 
366  if (validSense) {
367 
368  //
369  // If this is a data underrun condition (i.e. target truncated the offload data transfer),
370  // the SenseData's Information field may have the TransferCount.
371  //
374 
375  //
376  // Sense data in Descriptor format
377  //
379 
380  PVOID startBuffer = NULL;
381  UCHAR startBufferLength = 0;
382 
383 
384  if (ScsiGetSenseDescriptor(senseInfoBuffer,
386  &startBuffer,
387  &startBufferLength)) {
388  UCHAR outType;
389  PVOID outBuffer = NULL;
390  UCHAR outBufferLength = 0;
391 
393 
394  if (ScsiGetNextSenseDescriptorByType(startBuffer,
395  startBufferLength,
396  typeList,
397  ARRAYSIZE(typeList),
398  &outType,
399  &outBuffer,
400  &outBufferLength)) {
401 
403 
404  if (ScsiValidateInformationSenseDescriptor(outBuffer, outBufferLength)) {
406  isInformationValid = TRUE;
407  }
408 
409  } else {
410 
411  //
412  // ScsiGetNextDescriptorByType should only return a type that is specified by us.
413  //
414  NT_ASSERT(FALSE);
415  }
416  }
417  }
418  } else {
419 
420  //
421  // Sense data in Fixed format
422  //
424  isInformationValid = TRUE;
425  }
426 
427  if (isInformationValid) {
429  }
430  }
431  }
432  }
433  }
434 
435  }
436  else {
437  TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL, "Unhandled SRB Function %xh in error path for packet %p (did miniport change Srb.Cdb.OperationCode ?)", (ULONG)pCdb->CDB10.OperationCode, Pkt));
438  }
439  }
440 
441  return shouldRetry;
442 }
443 
444 
445 /*
446  * RetryTransferPacket
447  *
448  * Retry sending a TRANSFER_PACKET.
449  *
450  * Return TRUE iff the packet is complete.
451  * (if so the status in pkt->irp is the final status).
452  */
454 {
455  BOOLEAN packetDone;
456  BOOLEAN scaleDown = FALSE;
458  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExtension->PrivateFdoData;
459  PCDB pCdb = SrbGetCdb(Pkt->Srb);
460 
461 #if !defined(__REACTOS__) && NTDDI_VERSION >= NTDDI_WINBLUE
463  (pCdb != NULL) && IS_SCSIOP_READWRITE(pCdb->CDB10.OperationCode)) {
464 
466  //We've already retried this the maximum times. Bail out.
467  return TRUE;
468  }
470  }
471  else {
473  Pkt->NumRetries--;
474  }
475 #else
477  Pkt->NumRetries--;
478 #endif
479 
480  TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "retrying failed transfer (pkt=%ph, op=%s)", Pkt, DBGGETSCSIOPSTR(Pkt->Srb)));
481 
482  if (!fdoData->DisableThrottling) {
483 
484  //
485  // If this is the last retry, then turn off disconnect, sync transfer,
486  // and tagged queuing. On all other retries, leave the original settings.
487  // Do not apply this for thin provisioning soft threshold errors, since
488  // they should succeed as soon as they're retried on the right IT nexus.
489  //
491  scaleDown = TRUE;
492  }
493 
494 #if (NTDDI_VERSION >= NTDDI_WINBLUE)
495  //
496  // If this request previously timed-out and there are no more retries left
497  // for timed-out requests, then we should also apply the scale down.
498  //
499  if (Pkt->TimedOut && Pkt->NumIoTimeoutRetries == 0) {
500  scaleDown = TRUE;
501  }
502 #endif
503  }
504 
505 
506  if (scaleDown) {
507  /*
508  * Tone down performance on the retry.
509  * This increases the chance for success on the retry.
510  * We've seen instances of drives that fail consistently but then start working
511  * once this scale-down is applied.
512  */
517  }
518 
520 
521  UCHAR cdbOpcode = 0;
522  BOOLEAN isReadWrite = FALSE;
523 
524  if (pCdb) {
525  cdbOpcode = pCdb->CDB10.OperationCode;
526  isReadWrite = IS_SCSIOP_READWRITE(cdbOpcode);
527  }
528 
529  if ((Pkt->DriverUsesStartIO) &&
530  ( (cdbOpcode == SCSIOP_WRITE6 ) ||
531  (cdbOpcode == SCSIOP_WRITE ) ||
532  (cdbOpcode == SCSIOP_WRITE12) ||
533  (cdbOpcode == SCSIOP_WRITE16) )) {
534 
535  /* don't retry writes in super-low-memory conditions if the
536  * driver must serialize against StartIO. This is because
537  * some write methods used in such drivers cannot accept
538  * random-sized writes. (i.e CD-RW in packet writing mode)
539  * Reads, however, are always safe to split up.
540  */
541  SET_FLAG(fdoData->TrackingFlags, TRACKING_FORWARD_PROGRESS_PATH1);
542  packetDone = TRUE;
543  }
544  else if (Pkt->InLowMemRetry || !isReadWrite){
545  /*
546  * This should never happen under normal circumstances.
547  * The memory manager guarantees that at least four pages will
548  * be available to allow forward progress in the port driver.
549  * So a one-page transfer should never fail with insufficient resources.
550  *
551  * However, it is possible to get in here with virtual storage
552  * or thin provisioned storage for example.
553  * A single sector write can trigger an allocation request and
554  * presently a forward progress guarantee is not provided.
555  * VHD also may have some limitations in forward progress guarantee.
556  * And USB too might also fall into this category.
557  */
558  SET_FLAG(fdoData->TrackingFlags, TRACKING_FORWARD_PROGRESS_PATH2);
559  packetDone = TRUE;
560  }
561  else {
562  /*
563  * We are in low-memory stress.
564  * Start the low-memory retry state machine, which tries to
565  * resend the packet in little one-page chunks.
566  */
567  SET_FLAG(fdoData->TrackingFlags, TRACKING_FORWARD_PROGRESS_PATH3);
569  Pkt->BufPtrCopy,
570  Pkt->BufLenCopy,
573  packetDone = FALSE;
574  }
575  }
576  else {
577  /*
578  * Retry the packet by simply resending it after a delay.
579  * Put the packet back in the pending queue and
580  * schedule a timer to retry the transfer.
581  *
582  * Do not call SetupReadWriteTransferPacket again because:
583  * (1) The minidriver may have set some bits
584  * in the SRB that it needs again and
585  * (2) doing so would reset numRetries.
586  *
587  * BECAUSE we do not call SetupReadWriteTransferPacket again,
588  * we have to reset a couple fields in the SRB that
589  * some miniports overwrite when they fail an SRB.
590  */
591 
594 
596 
597  packetDone = FALSE;
598  }
599 
600  return packetDone;
601 }
602 
603 
605 {
607 
608  if (Pkt->RetryIn100nsUnits == 0){
610  }
611  else {
612  LARGE_INTEGER timerPeriod;
613 
614  NT_ASSERT(Pkt->RetryIn100nsUnits < 100 * 1000 * 1000 * 10); // sanity check -- 100 seconds is normally too long
615  timerPeriod.QuadPart = -(Pkt->RetryIn100nsUnits);
617  KeSetTimer(&Pkt->RetryTimer, timerPeriod, &Pkt->RetryTimerDPC);
618  }
619 }
620 
621 
622 VOID
623 NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
628 {
629  PTRANSFER_PACKET pkt;
630  PDEVICE_OBJECT fdo;
631  PFUNCTIONAL_DEVICE_EXTENSION fdoExtension;
632 
634 
636 
637  fdo = pkt->Fdo;
638  fdoExtension = fdo->DeviceExtension;
639 
643 
644 
645  /*
646  * Sometimes the port driver can allocates a new 'sense' buffer
647  * to report transfer errors, e.g. when the default sense buffer
648  * is too small. If so, it is up to us to free it.
649  * Now that we're done using the sense info, free it if appropriate.
650  * Then clear the sense buffer so it doesn't pollute future errors returned in this packet.
651  */
652  if (PORT_ALLOCATED_SENSE_EX(fdoExtension, pkt->Srb)) {
653  TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_RW, "Freeing port-allocated sense buffer for pkt %ph.", pkt));
654  FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(fdoExtension, pkt->Srb);
657  }
658  else {
661  }
662 
664 
666 
667 }
668 
669 
671 {
672  NT_ASSERT(Len > 0);
674 
675  if (Pkt->DriverUsesStartIO)
676  {
677  /*
678  * special case: StartIO-based writing must stay serialized for performance
679  * and proper operations (i.e. sequential writing mode). If need more than
680  * one transfer to perform this operation, and it's a StartIO-based driver
681  * (such as CDROM), then just use a single packet and use the retry logic
682  * that's already built-in to the packet engine. Note that low-mem retry
683  * cannot be used directly because some write methods do not work if the
684  * writes are only PAGE_SIZE (i.e. packet writing may corrupt data).
685  */
687  }
688  else
689  {
691  }
694  Pkt->LowMemRetry_nextChunkTargetLocation = TargetLocation;
695 }
696 
697 
698 /*
699  * StepLowMemRetry
700  *
701  * During extreme low-memory stress, this function retries
702  * a packet in small one-page chunks, sent serially.
703  *
704  * Returns TRUE iff the packet is done.
705  */
707 {
708  BOOLEAN packetDone;
709 
710  if (Pkt->LowMemRetry_remainingBufLen == 0){
711  packetDone = TRUE;
712  }
713  else {
714  ULONG thisChunkLen;
715  if (Pkt->DriverUsesStartIO)
716  {
717  /*
718  * Need the fdoData for the HwMaxXferLen
719  */
721  PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
722 
723  /*
724  * Need the adapterDesc to limit transfers based on byte count
725  */
726  PCOMMON_DEVICE_EXTENSION commonExtension = Pkt->Fdo->DeviceExtension;
727  PSTORAGE_ADAPTER_DESCRIPTOR adapterDesc = commonExtension->PartitionZeroExtension->AdapterDescriptor;
728 
729  ULONG hwMaxXferLen;
730 
731  /*
732  * special case: StartIO-based writing must stay serialized for performance
733  * and proper operations (i.e. sequential writing mode). If need more than
734  * one transfer to perform this operation, and it's a StartIO-based driver
735  * (such as CDROM), then just use a single packet and use the retry logic
736  * that's already built-in to the packet engine. Note that low-mem retry
737  * cannot be used directly because some write methods do not work if the
738  * writes are only PAGE_SIZE (i.e. packet writing may corrupt data).
739  */
741 
742  /*
743  * We precomputed fdoData->HwMaxXferLen using (MaximumPhysicalPages-1).
744  * If the buffer is page-aligned, that's one less page crossing so we can add the page back in.
745  * Note: adapters that return MaximumPhysicalPages=0x10 depend on this to
746  * transfer aligned 64K requests in one piece.
747  * Also note: make sure adding PAGE_SIZE back in doesn't wrap to zero.
748  */
749 
750  if (((ULONG_PTR)(Pkt->LowMemRetry_remainingBufPtr) & (PAGE_SIZE-1)) || (fdoData->HwMaxXferLen > 0xffffffff-PAGE_SIZE)){
751  hwMaxXferLen = fdoData->HwMaxXferLen;
752  }
753  else {
755  hwMaxXferLen = min(fdoData->HwMaxXferLen+PAGE_SIZE, adapterDesc->MaximumTransferLength);
756  }
757  thisChunkLen = MIN(Pkt->LowMemRetry_remainingBufLen, hwMaxXferLen);
758  }
759  else {
760  /*
761  * Make sure the little chunk we send is <= a page length
762  * AND that it does not cross any page boundaries.
763  */
764  ULONG bytesToNextPageBoundary;
765  bytesToNextPageBoundary = PAGE_SIZE-(ULONG)((ULONG_PTR)Pkt->LowMemRetry_remainingBufPtr%PAGE_SIZE);
766  thisChunkLen = MIN(Pkt->LowMemRetry_remainingBufLen, bytesToNextPageBoundary);
768  }
769 
770 
771  /*
772  * Set up the transfer packet for the new little chunk.
773  * This will reset numRetries so that we retry each chunk as required.
774  */
777  thisChunkLen,
779  Pkt->OriginalIrp);
780 
781  Pkt->LowMemRetry_remainingBufPtr += thisChunkLen;
782  Pkt->LowMemRetry_remainingBufLen -= thisChunkLen;
784 
785  //
786  // When running in low-memory stress, always use a partial MDL.
787  // This allows lower drivers to potentially map a smaller buffer.
788  //
790 
792 
793  packetDone = FALSE;
794  }
795 
796  return packetDone;
797 }
798 
#define IN
Definition: typedefs.h:39
NTSTATUS SubmitTransferPacket(PTRANSFER_PACKET Pkt)
Definition: xferpkt.c:850
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength(_In_ PVOID Srb)
Definition: srbhelper.h:638
_In_ PTRANSFER_PACKET Pkt
Definition: classp.h:1754
* PSTORAGE_ADAPTER_DESCRIPTOR
Definition: ntddstor.h:599
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
BOOLEAN DriverUsesStartIO
Definition: classp.h:543
UCHAR senseKey
Definition: scsi.h:4019
BOOLEAN InterpretTransferPacketError(PTRANSFER_PACKET Pkt)
Definition: retry.c:40
struct _CDB::_MEDIA_REMOVAL MEDIA_REMOVAL
FORCEINLINE VOID SrbSetDataTransferLength(_In_ PVOID Srb, _In_ ULONG DataTransferLength)
Definition: srbhelper.h:784
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
DISK_GEOMETRY DiskGeometry
Definition: classpnp.h:888
#define TRUE
Definition: types.h:120
#define SCSIOP_MODE_SENSE
Definition: cdrw_hw.h:896
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
BOOLEAN NTAPI ClassInterpretSenseInfo(_In_ PDEVICE_OBJECT Fdo, _In_ PSCSI_REQUEST_BLOCK _Srb, _In_ UCHAR MajorFunctionCode, _In_ ULONG IoDeviceCode, _In_ ULONG RetryCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, 100) ULONG *RetryInterval)
Definition: class.c:4452
BOOLEAN RetryTransferPacket(PTRANSFER_PACKET Pkt)
Definition: retry.c:453
struct _FUNCTIONAL_DEVICE_EXTENSION * PartitionZeroExtension
Definition: classpnp.h:599
Definition: cdrw_hw.h:28
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
COMMON_DEVICE_EXTENSION CommonExtension
Definition: classpnp.h:873
UCHAR NumThinProvisioningRetries
Definition: classp.h:517
#define REVERSE_BYTES(Destination, Source)
Definition: scsi.h:3465
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define SCSI_SENSE_OPTIONS_FIXED_FORMAT_IF_UNKNOWN_FORMAT_INDICATED
Definition: scsi.h:3839
PSTORAGE_REQUEST_BLOCK_HEADER Srb
Definition: classp.h:580
#define SCSI_ADSENSE_LUN_NOT_READY
Definition: cdrw_hw.h:1218
ULONG BytesPerSector
Definition: ntdddisk.h:442
UCHAR NumIoTimeoutRetries
Definition: classp.h:518
IO_STATUS_BLOCK IoStatus
FORCEINLINE PCDB SrbGetCdb(_In_ PVOID Srb)
Definition: srbhelper.h:583
VOID TransferPacketQueueRetryDpc(PTRANSFER_PACKET Pkt)
Definition: retry.c:604
#define SCSIOP_WRITE16
Definition: scsi.h:915
struct _CDB::_CDB10 CDB10
PUCHAR LowMemRetry_remainingBufPtr
Definition: classp.h:545
FORCEINLINE VOID SrbSetSenseInfoBufferLength(_In_ PVOID Srb, _In_ UCHAR SenseInfoBufferLength)
Definition: srbhelper.h:675
KDPC RetryTimerDPC
Definition: classp.h:524
#define TRACKING_FORWARD_PROGRESS_PATH3
Definition: classp.h:2387
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
#define SCSIOP_WRITE12
Definition: cdrw_hw.h:957
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
FORCEINLINE VOID SrbClearSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:982
UCHAR NumRetries
Definition: classp.h:516
#define SRB_STATUS(Status)
Definition: srb.h:381
LARGE_INTEGER TargetLocationCopy
Definition: classp.h:564
Iosb Information
Definition: create.c:4353
#define IsDescriptorSenseDataFormat(SenseInfoBuffer)
Definition: scsi.h:3685
struct _CDB::_CDB16 CDB16
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define SP_UNTAGGED
Definition: srb.h:225
#define IRP_MJ_SCSI
T MIN(T a, T b)
Definition: polytest.cpp:79
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
UCHAR TimedOut
Definition: classp.h:519
__inline VOID FREE_PORT_ALLOCATED_SENSE_BUFFER_EX(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: classp.h:2560
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
ULONGLONG TransferCount
Definition: classp.h:610
struct _FUNCTIONAL_DEVICE_EXTENSION * PFUNCTIONAL_DEVICE_EXTENSION
PDEVICE_OBJECT Fdo
Definition: classp.h:503
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define SCSIOP_WRITE
Definition: cdrw_hw.h:906
unsigned char BOOLEAN
#define SCSIOP_MODE_SENSE10
Definition: cdrw_hw.h:946
smooth NULL
Definition: ftsmooth.c:416
__inline PVOID ClasspTransferPacketGetSenseInfoBuffer(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2513
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
Definition: timerobj.c:233
#define SL_OVERRIDE_VERIFY_VOLUME
Definition: iotypes.h:1803
BOOLEAN InLowMemRetry
Definition: classp.h:544
#define NUM_THIN_PROVISIONING_RETRIES
Definition: classp.h:162
#define SrbSetRequestTag
Definition: srbhelper.h:869
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
#define TRACKING_FORWARD_PROGRESS_PATH2
Definition: classp.h:2386
UCHAR additionalSenseCode
Definition: scsi.h:4020
struct _CDB::_MODE_SENSE MODE_SENSE
LARGE_INTEGER LowMemRetry_nextChunkTargetLocation
Definition: classp.h:547
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
__inline BOOLEAN ClasspIsOffloadDataTransferCommand(_In_ PCDB Cdb)
Definition: classp.h:2087
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:511
BOOLEAN UsePartialMdl
Definition: classp.h:595
PIRP OriginalIrp
Definition: classp.h:509
VOID ClasspConvertToScsiRequestBlock(_Out_ PSCSI_REQUEST_BLOCK Srb, _In_ PSTORAGE_REQUEST_BLOCK SrbEx)
Definition: utils.c:6559
uint64_t ULONGLONG
Definition: typedefs.h:67
PSRB_HISTORY RetryHistory
Definition: classp.h:598
VOID SetupReadWriteTransferPacket(PTRANSFER_PACKET pkt, PVOID Buf, ULONG Len, LARGE_INTEGER DiskLocation, PIRP OriginalIrp)
Definition: xferpkt.c:718
PFIXED_SENSE_DATA senseInfoBuffer
Definition: scsi.h:3710
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:389
struct _TRANSFER_PACKET * PTRANSFER_PACKET
#define Len
Definition: deflate.h:82
BOOLEAN ClasspIsThinProvisioningError(_In_ PSCSI_REQUEST_BLOCK _Srb)
Definition: utils.c:9125
#define SRB_STATUS_DATA_OVERRUN
Definition: srb.h:349
#define DBGGETSCSIOPSTR(_pSrb)
Definition: debug.h:26
#define SRB_FLAGS_DISABLE_DISCONNECT
Definition: srb.h:388
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
unsigned char UCHAR
Definition: xmlstorage.h:181
#define SCSI_SENSE_COPY_ABORTED
Definition: cdrw_hw.h:1197
Definition: ketypes.h:687
#define SCSIOP_READ_CAPACITY16
Definition: scsi.h:364
#define SCSIOP_MEDIUM_REMOVAL
Definition: cdrw_hw.h:902
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define SRB_STATUS_SELECTION_TIMEOUT
Definition: srb.h:342
#define SCSI_SENSE_ABORTED_COMMAND
Definition: cdrw_hw.h:1198
PFIXED_SENSE_DATA outBuffer
Definition: scsi.h:4022
KTIMER RetryTimer
Definition: classp.h:523
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
T MAX(T a, T b)
Definition: polytest.cpp:85
__inline BOOLEAN PORT_ALLOCATED_SENSE_EX(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb)
Definition: classp.h:2547
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
__inline BOOLEAN ClasspTransferPacketGetNumberOfRetriesDone(_In_ PTRANSFER_PACKET Pkt, _In_ PCDB Cdb, _Out_ PULONG TimesAlreadyRetried)
Definition: classp.h:2459
ULONG LowMemRetry_remainingBufLen
Definition: classp.h:546
#define TRACKING_FORWARD_PROGRESS_PATH1
Definition: classp.h:2385
#define SCSI_SENSEQ_DATA_UNDERRUN
Definition: scsi.h:761
#define IS_SCSIOP_READWRITE(opCode)
Definition: cdrom.h:803
FORCEINLINE PVOID SrbGetSenseInfoBuffer(_In_ PVOID Srb)
Definition: srbhelper.h:619
VOID InitLowMemRetry(PTRANSFER_PACKET Pkt, PVOID BufPtr, ULONG Len, LARGE_INTEGER TargetLocation)
Definition: retry.c:670
VOID NTAPI TransferPacketRetryTimerDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: retry.c:624
#define min(a, b)
Definition: monoChain.cc:55
__inline PCDB ClasspTransferPacketGetCdb(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2445
#define SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION
Definition: scsi.h:630
#define SCSIOP_READ_CAPACITY
Definition: cdrw_hw.h:904
FORCEINLINE VOID SrbSetDataBuffer(_In_ PVOID Srb, _In_opt_ __drv_aliasesMem PVOID DataBuffer)
Definition: srbhelper.h:747
PUCHAR BufPtrCopy
Definition: classp.h:562
static PDB_INFORMATION information
Definition: db.cpp:176
unsigned int ULONG
Definition: retypes.h:1
FORCEINLINE VOID SrbSetSenseInfoBuffer(_In_ PVOID Srb, _In_opt_ PVOID SenseInfoBuffer)
Definition: srbhelper.h:657
FORCEINLINE VOID SrbSetSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:964
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
SENSE_DATA_EX SrbErrorSenseData
Definition: classp.h:570
__inline UCHAR ClasspTransferPacketGetSenseInfoBufferLength(_In_ PTRANSFER_PACKET Pkt)
Definition: classp.h:2521
PCLASS_INTERPRET_SENSE_INFO2 InterpretSenseInfo
Definition: classp.h:958
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
#define SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR
Definition: scsi.h:657
__inline BOOLEAN ClasspIsTokenOperation(_In_ PCDB Cdb)
Definition: classp.h:2044
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define CLASS_SRB_STORAGE_REQUEST_BLOCK
Definition: classpnp.h:573
BOOLEAN StepLowMemRetry(PTRANSFER_PACKET Pkt)
Definition: retry.c:706
__callback PCLASS_INTERPRET_SENSE_INFO Interpret
Definition: classpnp.h:566
#define SET_FLAG(Flags, Bit)
Definition: cdrom.h:1493
#define REVERSE_BYTES_QUAD(Destination, Source)
Definition: scsi.h:3452
ULONG BufLenCopy
Definition: classp.h:563
#define SCSIOP_WRITE6
Definition: cdrw_hw.h:876
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
Definition: srb.h:387
LONGLONG QuadPart
Definition: typedefs.h:114
#define _Analysis_assume_(expr)
Definition: no_sal2.h:10
BOOLEAN validSense
Definition: scsi.h:4018
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define NT_ASSERT
Definition: rtlfuncs.h:3312
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675