for all cases except receiving a USBD_STATUS_STALL_PID status.
This decision should be made by higher-level driver (and classpnp drivers do it)
pCDB = (PCDB)Request->Cdb;
ASSERT(pCDB);
pCDB = (PCDB)Request->Cdb;
ASSERT(pCDB);
- if (Status != STATUS_SUCCESS || Context->RetryCount >= 1)
+ if (!NT_SUCCESS(Status))
{
// Complete the master IRP
Context->Irp->IoStatus.Status = Status;
{
// Complete the master IRP
Context->Irp->IoStatus.Status = Status;
// clear timer srb
Context->FDODeviceExtension->LastTimerActiveSrb = NULL;
}
// clear timer srb
Context->FDODeviceExtension->LastTimerActiveSrb = NULL;
}
- else
- {
- DPRINT1("Retrying Count %lu %p\n", Context->RetryCount, Stack->DeviceObject);
-
- // re-schedule request
- USBSTOR_HandleExecuteSCSI(Stack->DeviceObject, Context->Irp, Context->RetryCount + 1);
-
- // srb error handling finished
- Context->FDODeviceExtension->SrbErrorHandlingActive = FALSE;
-
- // srb error handling finished
- Context->FDODeviceExtension->TimerWorkQueueEnabled = TRUE;
-
- // clear timer srb
- Context->FDODeviceExtension->LastTimerActiveSrb = NULL;
- }
- USBSTOR_HandleExecuteSCSI(IoStack->DeviceObject, Irp, 0);
+ USBSTOR_HandleExecuteSCSI(IoStack->DeviceObject, Irp);
{
if (USBD_STATUS(Context->Urb.UrbHeader.Status) == USBD_STATUS(USBD_STATUS_STALL_PID))
{
{
if (USBD_STATUS(Context->Urb.UrbHeader.Status) == USBD_STATUS(USBD_STATUS_STALL_PID))
{
- if (Context->RetryCount < 2)
+ if (Context->StallRetryCount < 2)
+ ++Context->StallRetryCount;
// clear stall and resend cbw
Context->ErrorIndex = 1;
// clear stall and resend cbw
Context->ErrorIndex = 1;
}
else if (USBD_STATUS(Context->Urb.UrbHeader.Status) == USBD_STATUS(USBD_STATUS_STALL_PID))
{
}
else if (USBD_STATUS(Context->Urb.UrbHeader.Status) == USBD_STATUS(USBD_STATUS_STALL_PID))
{
+ ++Context->StallRetryCount;
Request->SrbStatus = SRB_STATUS_DATA_OVERRUN;
Request->DataTransferLength = Context->Urb.UrbBulkOrInterruptTransfer.TransferBufferLength;
Request->SrbStatus = SRB_STATUS_DATA_OVERRUN;
Request->DataTransferLength = Context->Urb.UrbBulkOrInterruptTransfer.TransferBufferLength;
// initialize rest of context
Context->Irp = Irp;
Context->FDODeviceExtension = FDODeviceExtension;
// initialize rest of context
Context->Irp = Irp;
Context->FDODeviceExtension = FDODeviceExtension;
- Context->RetryCount = 0;
+ Context->StallRetryCount = 0;
return USBSTOR_IssueBulkOrInterruptRequest(
FDODeviceExtension,
return USBSTOR_IssueBulkOrInterruptRequest(
FDODeviceExtension,
NTSTATUS
USBSTOR_HandleExecuteSCSI(
IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
USBSTOR_HandleExecuteSCSI(
IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp,
- IN ULONG RetryCount)
{
PCDB pCDB;
NTSTATUS Status;
{
PCDB pCDB;
NTSTATUS Status;
PIRP Irp;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
ULONG ErrorIndex;
PIRP Irp;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
ULONG ErrorIndex;
+ ULONG StallRetryCount; // the number of retries after receiving USBD_STATUS_STALL_PID status
NTSTATUS
USBSTOR_HandleExecuteSCSI(
IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
USBSTOR_HandleExecuteSCSI(
IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp,
- IN ULONG RetryCount);
NTSTATUS
USBSTOR_SendCSWRequest(
NTSTATUS
USBSTOR_SendCSWRequest(