diff options
author | Michael Brown | 2009-07-08 00:00:11 +0200 |
---|---|---|
committer | Michael Brown | 2009-07-18 00:00:09 +0200 |
commit | 1d8d8ef2c8e6bd951416941a42e3e6302238330a (patch) | |
tree | 521e7ff15194ef417bb99f941fb3f200af349a29 /src/net/tcp/iscsi.c | |
parent | [debug] Use a delimiter to break up DBG_HD() output (diff) | |
download | ipxe-1d8d8ef2c8e6bd951416941a42e3e6302238330a.tar.gz ipxe-1d8d8ef2c8e6bd951416941a42e3e6302238330a.tar.xz ipxe-1d8d8ef2c8e6bd951416941a42e3e6302238330a.zip |
[scsi] Make SCSI command issuing partially asynchronous
Move the icky call to step() from iscsi.c to scsi.c; this takes it at
least one step further away from where it really doesn't belong.
Diffstat (limited to 'src/net/tcp/iscsi.c')
-rw-r--r-- | src/net/tcp/iscsi.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 943bdefc..0f7b0de5 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -182,9 +182,10 @@ static void iscsi_close_connection ( struct iscsi_session *iscsi, int rc ) { static void iscsi_scsi_done ( struct iscsi_session *iscsi, int rc ) { assert ( iscsi->tx_state == ISCSI_TX_IDLE ); + assert ( iscsi->command != NULL ); + iscsi->command->rc = rc; iscsi->command = NULL; - iscsi->rc = rc; } /**************************************************************************** @@ -1550,32 +1551,24 @@ static int iscsi_command ( struct scsi_device *scsi, container_of ( scsi->backend, struct iscsi_session, refcnt ); int rc; + /* Abort immediately if we have a recorded permanent failure */ + if ( iscsi->instant_rc ) + return iscsi->instant_rc; + /* Record SCSI command */ iscsi->command = command; - /* Abort immediately if we have a recorded permanent failure */ - if ( iscsi->instant_rc ) { - rc = iscsi->instant_rc; - goto done; - } - /* Issue command or open connection as appropriate */ if ( iscsi->status ) { iscsi_start_command ( iscsi ); } else { - if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 ) - goto done; + if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 ) { + iscsi->command = NULL; + return rc; + } } - /* Wait for command to complete */ - iscsi->rc = -EINPROGRESS; - while ( iscsi->rc == -EINPROGRESS ) - step(); - rc = iscsi->rc; - - done: - iscsi->command = NULL; - return rc; + return 0; } static int iscsi_detached_command ( struct scsi_device *scsi __unused, |