All of lore.kernel.org
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Hannes Reinecke <hare@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 12/24] scsi: introduce scsi_build_sense()
Date: Tue, 22 Oct 2019 10:31:37 +1100 (AEDT)	[thread overview]
Message-ID: <alpine.LNX.2.21.1910221026330.14@nippy.intranet> (raw)
In-Reply-To: <20191021095322.137969-13-hare@suse.de>


On Mon, 21 Oct 2019, Hannes Reinecke wrote:

> Introduce scsi_build_sense() as a wrapper around
> scsi_build_sense_buffer() to format the buffer and set
> the correct SCSI status.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/libata-scsi.c             |  7 ++--
>  drivers/s390/scsi/zfcp_scsi.c         |  5 +--
>  drivers/scsi/3w-xxxx.c                |  3 +-
>  drivers/scsi/libiscsi.c               |  5 +--
>  drivers/scsi/lpfc/lpfc_scsi.c         | 30 ++++-------------
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c  |  5 +--
>  drivers/scsi/mvumi.c                  |  5 +--
>  drivers/scsi/myrb.c                   | 61 ++++++++---------------------------
>  drivers/scsi/myrs.c                   |  9 ++----
>  drivers/scsi/ps3rom.c                 |  3 +-
>  drivers/scsi/qla2xxx/qla_isr.c        | 15 ++-------
>  drivers/scsi/scsi_debug.c             | 11 +++----
>  drivers/scsi/scsi_lib.c               | 18 +++++++++++
>  drivers/scsi/smartpqi/smartpqi_init.c |  3 +-
>  drivers/scsi/stex.c                   |  5 +--
>  include/scsi/scsi_cmnd.h              |  3 ++
>  16 files changed, 60 insertions(+), 128 deletions(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index b197d2fbe3f8..0fd3cb8e4e49 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -342,9 +342,7 @@ void ata_scsi_set_sense(struct ata_device *dev, struct scsi_cmnd *cmd,
>  	if (!cmd)
>  		return;
>  
> -	cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
> -
> -	scsi_build_sense_buffer(d_sense, cmd->sense_buffer, sk, asc, ascq);
> +	scsi_build_sense(cmd, d_sense, sk, asc, ascq);
>  }
>  
>  void ata_scsi_set_sense_information(struct ata_device *dev,
> @@ -1092,8 +1090,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
>  		 * ATA PASS-THROUGH INFORMATION AVAILABLE
>  		 * Always in descriptor format sense.
>  		 */
> -		scsi_build_sense_buffer(1, cmd->sense_buffer,
> -					RECOVERED_ERROR, 0, 0x1D);
> +		scsi_build_sense(cmd, 1, RECOVERED_ERROR, 0, 0x1D);
>  	}
>  
>  	if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
> diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
> index e9ded2befa0d..da52d7649f4d 100644
> --- a/drivers/s390/scsi/zfcp_scsi.c
> +++ b/drivers/s390/scsi/zfcp_scsi.c
> @@ -834,10 +834,7 @@ void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
>   */
>  void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, int ascq)
>  {
> -	scsi_build_sense_buffer(1, scmd->sense_buffer,
> -				ILLEGAL_REQUEST, 0x10, ascq);
> -	set_driver_byte(scmd, DRIVER_SENSE);
> -	scmd->result |= SAM_STAT_CHECK_CONDITION;
> +	scsi_build_sense(scmd, 1, ILLEGAL_REQUEST, 0x10, ascq);
>  	set_host_byte(scmd, DID_SOFT_ERROR);
>  }
>  
> diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
> index 79eca8f1fd05..381723634c13 100644
> --- a/drivers/scsi/3w-xxxx.c
> +++ b/drivers/scsi/3w-xxxx.c
> @@ -1981,8 +1981,7 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
>  			printk(KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n", tw_dev->host->host_no, *command);
>  			tw_dev->state[request_id] = TW_S_COMPLETED;
>  			tw_state_request_finish(tw_dev, request_id);
> -			SCpnt->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
> -			scsi_build_sense_buffer(1, SCpnt->sense_buffer, ILLEGAL_REQUEST, 0x20, 0);
> +			scsi_build_sense(SCpnt, 1, ILLEGAL_REQUEST, 0x20, 0);
>  			done(SCpnt);
>  			retval = 0;
>  	}
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index ebd47c0cf9e9..9c85d7902faa 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -813,10 +813,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
>  
>  		ascq = session->tt->check_protection(task, &sector);
>  		if (ascq) {
> -			sc->result = DRIVER_SENSE << 24 |
> -				     SAM_STAT_CHECK_CONDITION;
> -			scsi_build_sense_buffer(1, sc->sense_buffer,
> -						ILLEGAL_REQUEST, 0x10, ascq);
> +			scsi_build_sense(sc, 1, ILLEGAL_REQUEST, 0x10, ascq);
>  			scsi_set_sense_information(sc->sense_buffer,
>  						   SCSI_SENSE_BUFFERSIZE,
>  						   sector);
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index f06f63e58596..aa8431fe9c1f 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -2843,10 +2843,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
>  	}
>  out:
>  	if (err_type == BGS_GUARD_ERR_MASK) {
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -					0x10, 0x1);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x1);

set_host_byte(cmd, DID_ABORT);

>  		phba->bg_guard_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
>  				"9069 BLKGRD: LBA %lx grd_tag error %x != %x\n",
> @@ -2854,10 +2851,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
>  				sum, guard_tag);
>  
>  	} else if (err_type == BGS_REFTAG_ERR_MASK) {
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -					0x10, 0x3);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x3);
>  

Same.

>  		phba->bg_reftag_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
> @@ -2866,10 +2860,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
>  				ref_tag, start_ref_tag);
>  
>  	} else if (err_type == BGS_APPTAG_ERR_MASK) {
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -					0x10, 0x2);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x2);
>  

Same. 

>  		phba->bg_apptag_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
> @@ -2930,10 +2921,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
>  	if (lpfc_bgs_get_guard_err(bgstat)) {
>  		ret = 1;
>  
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -				0x10, 0x1);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x1);

Same.

>  		phba->bg_guard_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
>  				"9055 BLKGRD: Guard Tag error in cmd"
> @@ -2946,10 +2934,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
>  	if (lpfc_bgs_get_reftag_err(bgstat)) {
>  		ret = 1;
>  
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -				0x10, 0x3);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x3);
>  

Same.

>  		phba->bg_reftag_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
> @@ -2963,10 +2948,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
>  	if (lpfc_bgs_get_apptag_err(bgstat)) {
>  		ret = 1;
>  
> -		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
> -				0x10, 0x2);
> -		cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
> -			      SAM_STAT_CHECK_CONDITION;
> +		scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x2);
>  

Same.

>  		phba->bg_apptag_err_cnt++;
>  		lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 3f0797e6f941..802b0d39bdf3 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -4619,10 +4619,7 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status)
>  		ascq = 0x00;
>  		break;
>  	}
> -	scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x10,
> -	    ascq);
> -	scmd->result = DRIVER_SENSE << 24 | (DID_ABORT << 16) |
> -	    SAM_STAT_CHECK_CONDITION;
> +	scsi_build_sense(scmd, 0, ILLEGAL_REQUEST, 0x10, ascq);

Same.

-- 

  reply	other threads:[~2019-10-21 23:31 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  9:52 [PATCH RFC 00/24] scsi: Revamp result values Hannes Reinecke
2019-10-21  9:52 ` [PATCH 01/24] aic7xxx,aic79xxx: remove driver-defined SAM status definitions Hannes Reinecke
2019-10-21  9:53 ` [PATCH 02/24] bfa: drop driver-defined SCSI status codes Hannes Reinecke
2019-10-21  9:53 ` [PATCH 03/24] wd33c93: use SCSI status Hannes Reinecke
2019-10-21 18:41   ` kbuild test robot
2019-10-21 18:41     ` kbuild test robot
2019-10-21 23:16   ` Finn Thain
2019-10-22  5:59     ` Hannes Reinecke
2019-10-21  9:53 ` [PATCH 04/24] acornscsi: use standard defines Hannes Reinecke
2019-10-21  9:53 ` [PATCH 05/24] scsi: use standard SAM status codes Hannes Reinecke
2019-10-21 23:17   ` Finn Thain
2019-10-22  6:00     ` Hannes Reinecke
2019-10-21  9:53 ` [PATCH 06/24] scsi: change status_byte() to return the standard SCSI status Hannes Reinecke
2019-10-22 12:35   ` Steffen Maier
2019-10-21  9:53 ` [PATCH 07/24] target_core: Fixup target_complete_cmd() usage Hannes Reinecke
2019-10-21  9:53 ` [PATCH 08/24] sg: use SAM status definitions and avoid using masked_status Hannes Reinecke
2019-10-21  9:53 ` [PATCH 09/24] scsi: Kill obsolete linux-specific status codes Hannes Reinecke
2019-10-21 18:12   ` kbuild test robot
2019-10-21 18:12     ` kbuild test robot
2019-10-21 18:56   ` kbuild test robot
2019-10-21 18:56     ` kbuild test robot
2019-10-21  9:53 ` [PATCH 10/24] scsi: introduce set_status_byte() Hannes Reinecke
2019-10-21 22:12   ` Finn Thain
2019-10-22  5:56     ` Hannes Reinecke
2019-10-21  9:53 ` [PATCH 11/24] advansys: kill driver_defined status byte accessors Hannes Reinecke
2019-10-21 16:37   ` Bart Van Assche
2019-10-22  6:25     ` Hannes Reinecke
2019-10-21  9:53 ` [PATCH 12/24] scsi: introduce scsi_build_sense() Hannes Reinecke
2019-10-21 23:31   ` Finn Thain [this message]
2019-10-22  6:02     ` Hannes Reinecke
2019-10-22 12:21   ` Steffen Maier
2019-10-21  9:53 ` [PATCH 13/24] scsi: Kill DRIVER_SENSE Hannes Reinecke
2019-10-21 23:44   ` Finn Thain
2019-10-22  6:10     ` Hannes Reinecke
2021-06-04  6:40   ` Jiri Slaby
2021-06-07 12:21     ` Hannes Reinecke
2021-06-07 12:30       ` Martin K. Petersen
2021-06-07 13:02         ` Hannes Reinecke
2021-06-10 10:52           ` Jiri Slaby
2021-06-10 14:01             ` Hannes Reinecke
2021-06-11  4:50               ` Jiri Slaby
2021-06-11  7:38                 ` Hannes Reinecke
2021-06-14  6:29                   ` Jiri Slaby
2021-06-14  7:20                   ` Jiri Slaby
2019-10-21  9:53 ` [PATCH 14/24] scsi: Kill DRIVER_HARD Hannes Reinecke
2019-10-21  9:53 ` [PATCH 15/24] scsi_error: use DID_TIME_OUT instead of DRIVER_TIMEOUT Hannes Reinecke
2019-10-21  9:53 ` [PATCH 16/24] scsi: Kill DRIVER_TIMEOUT Hannes Reinecke
2019-10-21  9:53 ` [PATCH 17/24] scsi: do not use DRIVER_INVALID Hannes Reinecke
2019-10-21  9:53 ` [PATCH 18/24] st: return error code in st_scsi_execute() Hannes Reinecke
2019-10-21 16:41   ` Bart Van Assche
2019-10-22  6:28     ` Hannes Reinecke
2019-10-22 14:54       ` Bart Van Assche
2019-10-21  9:53 ` [PATCH 19/24] scsi_ioctl: return error code when blk_map_user() fails Hannes Reinecke
2019-10-21 16:44   ` Bart Van Assche
2019-10-22  6:32     ` Hannes Reinecke
2019-10-21  9:53 ` [PATCH 20/24] scsi_dh_alua: do not interpret DRIVER_ERROR Hannes Reinecke
2019-10-21  9:53 ` [PATCH 21/24] xen-scsiback: stop using DRIVER_ERROR Hannes Reinecke
2019-10-21  9:53 ` [PATCH 22/24] scsi: " Hannes Reinecke
2019-10-21  9:53 ` [PATCH 23/24] scsi: Kill DRIVER_MEDIA, DRIVER_SOFT, and DRIVER_BUSY Hannes Reinecke
2019-10-21  9:53 ` [PATCH 24/24] scsi: Drop now obsolete driver_byte definitions Hannes Reinecke
2019-10-21 18:32 ` [PATCH RFC 00/24] scsi: Revamp result values Douglas Gilbert
2019-10-21 23:20   ` Finn Thain
2019-10-22  6:24   ` Hannes Reinecke
2019-10-31 11:04 [PATCHv2 00/24] Revamp SCSI " Hannes Reinecke
2019-10-31 11:04 ` [PATCH 12/24] scsi: introduce scsi_build_sense() Hannes Reinecke
2019-11-01 16:35   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.21.1910221026330.14@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.