diff mbox series

[14/39] NCR5380: Fold SCSI message ABORT onto DID_ABORT

Message ID 20210423113944.42672-15-hare@suse.de
State New
Headers show
Series SCSI result cleanup, part 2 | expand

Commit Message

Hannes Reinecke April 23, 2021, 11:39 a.m. UTC
The message byte can take only two values, COMMAND_COMPLETE and ABORT.
So we can easily map ABORT to DID_ABORT and do not set the message byte.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/NCR5380.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig April 26, 2021, 3:23 p.m. UTC | #1
On Fri, Apr 23, 2021 at 01:39:19PM +0200, Hannes Reinecke wrote:
> The message byte can take only two values, COMMAND_COMPLETE and ABORT.

> So we can easily map ABORT to DID_ABORT and do not set the message byte.


The real question is rather: did anyone care about the message byte,
and why can't this assignment be dropped entirely?
Hannes Reinecke April 26, 2021, 3:43 p.m. UTC | #2
On 4/26/21 5:23 PM, Christoph Hellwig wrote:
> On Fri, Apr 23, 2021 at 01:39:19PM +0200, Hannes Reinecke wrote:

>> The message byte can take only two values, COMMAND_COMPLETE and ABORT.

>> So we can easily map ABORT to DID_ABORT and do not set the message byte.

> 

> The real question is rather: did anyone care about the message byte,

> and why can't this assignment be dropped entirely?

> 

We need to handle this to be compatible with current SCSI EH. There we do

if (msg_byte(scmd->result) != COMMAND_COMPLETE)
    return FAILED;

And as it's extremely hard to validate the various stages which the
driver can find itself I couldn't exclude that the ABORT message never
ended up present by the time the command completed.
Hence I'd opted for the careful approach and mapped it to DID_ABORT;
that way I'm sure I don't mess up SCSI EH.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		        Kernel Storage Architect
hare@suse.de			               +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)
diff mbox series

Patch

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d7594b794d3c..1aea164c535c 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1826,9 +1826,9 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 					hostdata->connected = NULL;
 					hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
 
-					cmd->result &= ~0xffff;
-					cmd->result |= cmd->SCp.Status;
-					cmd->result |= cmd->SCp.Message << 8;
+					if (cmd->SCp.Message == ABORT)
+						set_host_byte(cmd, DID_ABORT);
+					set_status_byte(cmd, cmd->SCp.Status);
 
 					set_resid_from_SCp(cmd);