diff options
author | Michael Brown | 2017-03-07 17:11:22 +0100 |
---|---|---|
committer | Michael Brown | 2017-03-07 17:11:22 +0100 |
commit | d9886f1961f9970b4354442e84b98727b69cd73a (patch) | |
tree | f3327344ff70be0e1dde0b079cd2d7b455389546 /src/drivers/block | |
parent | [efi] Refactor to use centralised SAN device abstraction (diff) | |
download | ipxe-d9886f1961f9970b4354442e84b98727b69cd73a.tar.gz ipxe-d9886f1961f9970b4354442e84b98727b69cd73a.tar.xz ipxe-d9886f1961f9970b4354442e84b98727b69cd73a.zip |
[block] Retry any SAN device operation
The SCSI layer currently implements a retry loop in order to retry
commands that fail due to spurious "error" conditions such as "power
on occurred". Move this retry loop to the generic SAN device layer:
this allow for retries due to other transient error conditions such as
an iSCSI target having dropped the connection due to inactivity.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/block')
-rw-r--r-- | src/drivers/block/scsi.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c index fd5f82b9..847e0d46 100644 --- a/src/drivers/block/scsi.c +++ b/src/drivers/block/scsi.c @@ -40,9 +40,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); * */ -/** Maximum number of command retries */ -#define SCSICMD_MAX_RETRIES 10 - /* Error numbers generated by SCSI sense data */ #define EIO_NO_SENSE __einfo_error ( EINFO_EIO_NO_SENSE ) #define EINFO_EIO_NO_SENSE \ @@ -283,9 +280,6 @@ struct scsi_command { /** Command tag */ uint32_t tag; - /** Retry count */ - unsigned int retries; - /** Private data */ uint8_t priv[0]; }; @@ -449,28 +443,11 @@ static int scsicmd_command ( struct scsi_command *scsicmd ) { * @v rc Reason for close */ static void scsicmd_done ( struct scsi_command *scsicmd, int rc ) { - struct scsi_device *scsidev = scsicmd->scsidev; /* Restart SCSI interface */ intf_restart ( &scsicmd->scsi, rc ); - /* SCSI targets have an annoying habit of returning occasional - * pointless "error" messages such as "power-on occurred", so - * we have to be prepared to retry commands. - */ - if ( ( rc != 0 ) && ( scsicmd->retries++ < SCSICMD_MAX_RETRIES ) ) { - /* Retry command */ - DBGC ( scsidev, "SCSI %p tag %08x failed: %s\n", - scsidev, scsicmd->tag, strerror ( rc ) ); - DBGC ( scsidev, "SCSI %p tag %08x retrying (retry %d)\n", - scsidev, scsicmd->tag, scsicmd->retries ); - if ( ( rc = scsicmd_command ( scsicmd ) ) == 0 ) - return; - } - - /* If we didn't (successfully) reissue the command, hand over - * to the command completion handler. - */ + /* Hand over to the command completion handler */ scsicmd->type->done ( scsicmd, rc ); } |