From patchwork Wed Apr 18 15:01:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10348355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E60260216 for ; Wed, 18 Apr 2018 15:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 507442236A for ; Wed, 18 Apr 2018 15:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4472E285F5; Wed, 18 Apr 2018 15:03:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90C0E2236A for ; Wed, 18 Apr 2018 15:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753499AbeDRPDj (ORCPT ); Wed, 18 Apr 2018 11:03:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:39704 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753399AbeDRPDa (ORCPT ); Wed, 18 Apr 2018 11:03:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 82698AF6D; Wed, 18 Apr 2018 15:03:26 +0000 (UTC) From: Johannes Thumshirn To: "Martin K . Petersen" Cc: Bart Van Assche , Hannes Reinecke , James Bottomley , Linux SCSI Mailinglist , Douglas Gilbert , Johannes Thumshirn Subject: [VERY EARLY RFC 11/13] scsi: Change status bytes to use SAM-3 version Date: Wed, 18 Apr 2018 17:01:14 +0200 Message-Id: <20180418150116.18807-12-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180418150116.18807-1-jthumshirn@suse.de> References: <20180418150116.18807-1-jthumshirn@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Johannes Thumshirn --- drivers/ata/libata-scsi.c | 2 +- drivers/scsi/3w-9xxx.c | 2 +- drivers/scsi/3w-xxxx.c | 6 ++++-- drivers/scsi/arcmsr/arcmsr_hba.c | 4 ++-- drivers/scsi/dc395x.c | 4 ++-- drivers/scsi/dpt_i2o.c | 3 ++- drivers/scsi/gdth.c | 12 ++++++------ drivers/scsi/megaraid.c | 10 +++++----- drivers/scsi/megaraid/megaraid_mbox.c | 13 +++++++------ 9 files changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 0d6547351d85..96cd5c838c89 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -873,7 +873,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, qc->sg = scsi_sglist(cmd); qc->n_elem = scsi_sg_count(cmd); } else { - set_scsi_result(cmd, 0, DID_OK, 0, (QUEUE_FULL << 1)); + set_scsi_result(cmd, 0, DID_OK, 0, SAM_STAT_TASK_SET_FULL); cmd->scsi_done(cmd); } diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index ccdf7b08d117..7da983720550 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -1336,7 +1336,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) if (error == 1) { /* Ask for a host reset */ set_scsi_result(cmd, 0, DID_OK, 0, - (CHECK_CONDITION << 1)); + SAM_STAT_CHECK_CONDITION); } /* Report residual bytes for single sgl */ diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index da3c0ff13dac..ea259daf3089 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -431,7 +431,7 @@ static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill set_scsi_result(tw_dev->srb[request_id], 0, DID_OK, 0, - (CHECK_CONDITION << 1)); + SAM_STAT_CHECK_CONDITION); return TW_ISR_DONT_RESULT; /* Special case for isr to not over-write result */ } } @@ -2163,7 +2163,9 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance) /* If error, command failed */ if (error == 1) { /* Ask for a host reset */ - set_scsi_result(tw_dev->srb[request_id], 0, DID_OK, 0, CHECK_CONDITION << 1); + set_scsi_result(tw_dev->srb[request_id], + 0, DID_OK, 0, + SAM_STAT_CHECK_CONDITION); } /* Now complete the io */ diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 426d14c0104e..bea71f085679 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -1202,7 +1202,7 @@ static void arcmsr_report_sense_info(struct CommandControlBlock *ccb) struct scsi_cmnd *pcmd = ccb->pcmd; struct SENSE_DATA *sensebuffer = (struct SENSE_DATA *)pcmd->sense_buffer; - set_scsi_result(pcmd, 0, DID_OK, 0, (CHECK_CONDITION << 1)); + set_scsi_result(pcmd, 0, DID_OK, 0, SAM_STAT_CHECK_CONDITION); if (sensebuffer) { int sense_data_length = sizeof(struct SENSE_DATA) < SCSI_SENSE_BUFFERSIZE @@ -3030,7 +3030,7 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, return SCSI_MLQUEUE_HOST_BUSY; if (arcmsr_build_ccb( acb, ccb, cmd ) == FAILED) { set_scsi_result(cmd, 0, DID_ERROR, 0, - (RESERVATION_CONFLICT << 1)); + SAM_STAT_RESERVATION_CONFLICT); cmd->scsi_done(cmd); return 0; } diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index eebae800131d..89995bb09a94 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -3329,7 +3329,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, */ srb->flag &= ~AUTO_REQSENSE; srb->adapter_status = 0; - srb->target_status = CHECK_CONDITION << 1; + srb->target_status = SAM_STAT_CHECK_CONDITION; if (debug_enabled(DBG_1)) { switch (cmd->sense_buffer[2] & 0x0f) { case NOT_READY: @@ -3376,7 +3376,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, *((unsigned int *)(cmd->sense_buffer + 3))); } - if (status == (CHECK_CONDITION << 1)) { + if (status == SAM_STAT_CHECK_CONDITION) { cmd->result = 0; set_host_byte(cmd, DID_BAD_TARGET); goto ckc_e; diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 07af610a2410..2f281fd67596 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -2701,7 +2701,8 @@ static void adpt_fail_posted_scbs(adpt_hba* pHba) if(cmd->serial_number == 0){ continue; } - set_scsi_result(cmd, 0, DID_OK, 0, (QUEUE_FULL << 1)); + set_scsi_result(cmd, 0, DID_OK, 0, + SAM_STAT_TASK_SET_FULL); cmd->scsi_done(cmd); } spin_unlock_irqrestore(&d->list_lock, flags); diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 48f41e119d00..f34fb220be4f 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -2127,7 +2127,7 @@ static void gdth_next(gdth_ha_str *ha) memset((char*)nscp->sense_buffer,0,16); nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = NOT_READY; - set_scsi_result(nscp, 0, DID_OK, 0, (CHECK_CONDITION << 1)); + set_scsi_result(nscp, 0, DID_OK, 0, SAM_STAT_CHECK_CONDITION); if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; else @@ -2174,7 +2174,7 @@ static void gdth_next(gdth_ha_str *ha) nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = UNIT_ATTENTION; set_scsi_result(nscp, 0, DID_OK, 0, - (CHECK_CONDITION << 1)); + SAM_STAT_CHECK_CONDITION); if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; else @@ -2228,7 +2228,7 @@ static void gdth_next(gdth_ha_str *ha) nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = UNIT_ATTENTION; set_scsi_result(nscp, 0, DID_OK, 0, - (CHECK_CONDITION << 1)); + SAM_STAT_CHECK_CONDITION); if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; else @@ -3389,7 +3389,7 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, memset((char*)scp->sense_buffer,0,16); scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = NOT_READY; - set_scsi_result(scp, 0, DID_OK, 0, (CHECK_CONDITION << 1)); + set_scsi_result(scp, 0, DID_OK, 0, SAM_STAT_CHECK_CONDITION); } else if (service == CACHESERVICE) { if (ha->status == S_CACHE_UNKNOWN && (ha->hdr[t].cluster_type & @@ -3400,11 +3400,11 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, memset((char*)scp->sense_buffer,0,16); if (ha->status == (u16)S_CACHE_RESERV) { set_scsi_result(scp, 0, DID_OK, 0, - (RESERVATION_CONFLICT << 1)); + SAM_STAT_RESERVATION_CONFLICT); } else { scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = NOT_READY; - set_scsi_result(scp, 0, DID_OK, 0, (CHECK_CONDITION << 1)); + set_scsi_result(scp, 0, DID_OK, 0, SAM_STAT_CHECK_CONDITION); } if (!cmndinfo->internal_command) { ha->dvr.size = sizeof(ha->dvr.eu.sync); diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 1cb1b67d08c6..f8cebe02c9c4 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -1595,7 +1595,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status) 14); set_scsi_result(cmd, DRIVER_SENSE, DID_OK, 0, - CHECK_CONDITION << 1); + SAM_STAT_CHECK_CONDITION); } else { if (mbox->m_out.cmd == MEGA_MBOXCMD_EXTPTHRU) { @@ -1604,12 +1604,12 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status) epthru->reqsensearea, 14); set_scsi_result(cmd, DRIVER_SENSE, DID_OK, 0, - CHECK_CONDITION << 1); + SAM_STAT_CHECK_CONDITION); } else { cmd->sense_buffer[0] = 0x70; cmd->sense_buffer[2] = ABORTED_COMMAND; set_status_byte(cmd, - (CHECK_CONDITION << 1)); + SAM_STAT_CHECK_CONDITION); } } break; @@ -1629,7 +1629,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status) if( cmd->cmnd[0] == TEST_UNIT_READY ) { set_host_byte(cmd, DID_ERROR); set_status_byte(cmd, - (RESERVATION_CONFLICT << 1)); + SAM_STAT_RESERVATION_CONFLICT); } else /* @@ -1642,7 +1642,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status) set_host_byte(cmd, DID_ERROR); set_status_byte(cmd, - (RESERVATION_CONFLICT << 1)); + SAM_STAT_RESERVATION_CONFLICT); } else #endif diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 975e5a3c3786..47f4c7f9d5b5 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -1601,7 +1601,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy) scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = ILLEGAL_REQUEST; scp->sense_buffer[12] = MEGA_INVALID_FIELD_IN_CDB; - set_status_byte(scp, CHECK_CONDITION << 1); + set_status_byte(scp, SAM_STAT_CHECK_CONDITION); return NULL; } @@ -2363,7 +2363,7 @@ megaraid_mbox_dpc(unsigned long devp) 14); set_scsi_result(scp, DRIVER_SENSE, DID_OK, 0, - CHECK_CONDITION << 1); + SAM_STAT_CHECK_CONDITION); } else { if (mbox->cmd == MBOXCMD_EXTPTHRU) { @@ -2373,11 +2373,12 @@ megaraid_mbox_dpc(unsigned long devp) set_scsi_result(scp, DRIVER_SENSE, DID_OK, 0, - CHECK_CONDITION << 1); + SAM_STAT_CHECK_CONDITION); } else { scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = ABORTED_COMMAND; - set_status_byte(scp, CHECK_CONDITION << 1); + set_status_byte(scp, + SAM_STAT_CHECK_CONDITION); } } break; @@ -2395,7 +2396,7 @@ megaraid_mbox_dpc(unsigned long devp) */ if (scp->cmnd[0] == TEST_UNIT_READY) { set_scsi_result(scp, 0, DID_ERROR, 0, - RESERVATION_CONFLICT << 1); + SAM_STAT_RESERVATION_CONFLICT); } else /* @@ -2406,7 +2407,7 @@ megaraid_mbox_dpc(unsigned long devp) scp->cmnd[0] == RELEASE)) { set_scsi_result(scp, 0, DID_ERROR, 0, - RESERVATION_CONFLICT << 1); + SAM_STAT_RESERVATION_CONFLICT); } else { set_scsi_result(scp, 0, DID_BAD_TARGET, 0,