From: Fu Siyuan Date: Thu, 23 Jan 2014 08:36:37 +0000 (+0000) Subject: Re-execute the failed SCSI command if iSCSI driver could reinstates the session succe... X-Git-Tag: edk2-stable201903~11784 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f20fc992aee02c54404b68c46abd30ffbdd9888e Re-execute the failed SCSI command if iSCSI driver could reinstates the session successfully. Signed-off-by: Fu Siyuan Reviewed-by: Dong, Guo Reviewed-by: Tian, Feng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15173 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c index dea7f7cb95..da14105542 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiExtScsiPassThru.c @@ -1,7 +1,7 @@ /** @file The IScsi's EFI_EXT_SCSI_PASS_THRU_PROTOCOL driver. -Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
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 @@ IScsiExtScsiPassThruFunction ( { 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 @@ 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. + // + if (EFI_ERROR (IScsiSessionReinstatement (Private))) { + return EFI_DEVICE_ERROR; + } + + Status = IScsiExecuteScsiCommand (This, Target, Lun, Packet); + } + + return Status; } /** diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c index ffe0c6e1a8..60131b32db 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c +++ b/MdeModulePkg/Universal/Network/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.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
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 @@ IScsiOnNopInRcvd ( 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 @@ ON_EXIT: IScsiDelTcb (Tcb); } - if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_READY)) { - // - // Reinstate the session. - // - if (EFI_ERROR (IScsiSessionReinstatement (Private))) { - Status = EFI_DEVICE_ERROR; - } - } - return Status; } diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h index cac98c8b3d..48b4e7251f 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.h @@ -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.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
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 @@ 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. **/ EFI_STATUS