summaryrefslogtreecommitdiff
path: root/NetworkPkg
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2014-01-22 01:57:06 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-22 01:57:06 +0000
commitcb162780fee8f7d101cdcf3ca5db63fa2b6000db (patch)
tree45e00dfbfbbec9e087f4b3791765589654ad378d /NetworkPkg
parentb36f701d4f925172516cfdee72915e3217c92551 (diff)
Re-execute the failed SCSI command if iSCSI driver could reinstates the session successfully.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Dong, Guo <guo.dong@intel.com> Reviewed-by: Tian, Feng <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15152 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c20
-rw-r--r--NetworkPkg/IScsiDxe/IScsiProto.c12
-rw-r--r--NetworkPkg/IScsiDxe/IScsiProto.h3
3 files changed, 22 insertions, 13 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c b/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
index c4aed4c4a..c785853bd 100644
--- a/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
+++ b/NetworkPkg/IScsiDxe/IScsiExtScsiPassThru.c
@@ -1,7 +1,7 @@
/** @file
The implementation of EFI_EXT_SCSI_PASS_THRU_PROTOCOL.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -86,6 +86,9 @@ IScsiExtScsiPassThruFunction (
IN EFI_EVENT Event OPTIONAL
)
{
+ EFI_STATUS Status;
+ ISCSI_DRIVER_DATA *Private;
+
if (Target[0] != 0) {
return EFI_INVALID_PARAMETER;
}
@@ -94,7 +97,20 @@ IScsiExtScsiPassThruFunction (
return EFI_INVALID_PARAMETER;
}
- return IScsiExecuteScsiCommand (This, Target, Lun, Packet);
+ Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet);
+ if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) {
+ //
+ // Try to reinstate the session and re-execute the Scsi command.
+ //
+ Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
+ if (EFI_ERROR (IScsiSessionReinstatement (Private->Session))) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet);
+ }
+
+ return Status;
}
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiProto.c
index 29b3c2499..fb5d396aa 100644
--- a/NetworkPkg/IScsiDxe/IScsiProto.c
+++ b/NetworkPkg/IScsiDxe/IScsiProto.c
@@ -1,7 +1,7 @@
/** @file
The implementation of iSCSI protocol based on RFC3720.
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -2820,6 +2820,7 @@ IScsiOnNopInRcvd (
@retval EFI_DEVICE_ERROR Session state was not as required.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval EFI_PROTOCOL_ERROR There is no such data in the net buffer.
+ @retval EFI_NOT_READY The target can not accept new commands.
@retval Others Other errors as indicated.
**/
@@ -2998,15 +2999,6 @@ ON_EXIT:
IScsiDelTcb (Tcb);
}
- if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) {
- //
- // Reinstate the session.
- //
- if (EFI_ERROR (IScsiSessionReinstatement (Session))) {
- Status = EFI_DEVICE_ERROR;
- }
- }
-
return Status;
}
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.h b/NetworkPkg/IScsiDxe/IScsiProto.h
index d97fa083e..8099f3459 100644
--- a/NetworkPkg/IScsiDxe/IScsiProto.h
+++ b/NetworkPkg/IScsiDxe/IScsiProto.h
@@ -1,7 +1,7 @@
/** @file
The header file of iSCSI Protocol that defines many specific data structures.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -982,6 +982,7 @@ IScsiNormalizeName (
the Packet.
@retval EFI_DEVICE_ERROR Session state was not as required.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
+ @retval EFI_NOT_READY The target can not accept new commands.
@retval Others Other errors as indicated.
**/