Revision: 15173
          http://sourceforge.net/p/edk2/code/15173
Author:   sfu5
Date:     2014-01-23 08:36:37 +0000 (Thu, 23 Jan 2014)
Log Message:
-----------
Re-execute the failed SCSI command if iSCSI driver could reinstates the session 
successfully.
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Dong, Guo <[email protected]>
Reviewed-by: Tian, Feng <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c
    trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
    trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h

Modified: 
trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c   
2014-01-23 05:27:14 UTC (rev 15172)
+++ trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c   
2014-01-23 08:36:37 UTC (rev 15173)
@@ -1,7 +1,7 @@
 /** @file
   The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver.
 
-Copyright (c) 2004 - 2007, 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
@@ -67,6 +67,7 @@
 {
   ISCSI_DRIVER_DATA           *Private;
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;
+  EFI_STATUS                  Status; 
 
   Private       = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
   ConfigNvData  = &Private->Session.ConfigData.NvData;
@@ -79,7 +80,19 @@
     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.
+    //
+    if (EFI_ERROR (IScsiSessionReinstatement (Private))) {
+      return EFI_DEVICE_ERROR;
+    }
+
+    Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet);
+  }
+
+  return Status;
 }
 
 /**

Modified: trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c     
2014-01-23 05:27:14 UTC (rev 15172)
+++ trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c     
2014-01-23 08:36:37 UTC (rev 15173)
@@ -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
@@ -2504,6 +2504,7 @@
                                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.
 **/
 EFI_STATUS
@@ -2679,15 +2680,6 @@
     IScsiDelTcb (Tcb);
   }
 
-  if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) {
-    //
-    // Reinstate the session.
-    //
-    if (EFI_ERROR (IScsiSessionReinstatement (Private))) {
-      Status = EFI_DEVICE_ERROR;
-    }
-  }
-
   return Status;
 }
 

Modified: trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h     
2014-01-23 05:27:14 UTC (rev 15172)
+++ trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h     
2014-01-23 08:36:37 UTC (rev 15173)
@@ -1,7 +1,7 @@
 /** @file
   The header file of iSCSI Protocol that defines many specific data structures.
 
-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
@@ -950,6 +950,7 @@
                                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.
 **/
 EFI_STATUS

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to