From: Steffen Maier <maier@linux.ibm.com>
To: Hannes Reinecke <hare@suse.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
linux-scsi@vger.kernel.org, Benjamin Block <bblock@linux.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: [PATCH 12/24] scsi: introduce scsi_build_sense()
Date: Tue, 22 Oct 2019 14:21:12 +0200 [thread overview]
Message-ID: <4097c14b-4b28-f7ee-595c-cb338b878d27@linux.ibm.com> (raw)
In-Reply-To: <20191021095322.137969-13-hare@suse.de>
On 10/21/19 11:53 AM, 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/s390/scsi/zfcp_scsi.c | 5 +--
> 16 files changed, 60 insertions(+), 128 deletions(-)
> 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);
> }
>
looks like a non-functional change for zfcp, so for this part:
Acked-by: Steffen Maier <maier@linux.ibm.com> # for zfcp
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index a0db8d8766a8..2babf6df8066 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -3117,3 +3117,21 @@ int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id)
> return group_id;
> }
> EXPORT_SYMBOL(scsi_vpd_tpg_id);
> +
> +/**
> + * scsi_build_sense - build sense data for a command
minor: I suppose kdoc&sphnix parse and render it correctly? Because
Documentation/doc-guide/kernel-doc.rst says the format for function kdoc has
"()" as function name suffix:
+ * scsi_build_sense() - build sense data for a command
> + * @scmd: scsi command for which the sense should be formatted
> + * @desc: Sense format (non-zero == descriptor format,
> + * 0 == fixed format)
Looks like this has already been like that. Not sure if this patch set touches
every user of scsi_build_sense{_buffer}(). It would be nice to have meaningful
identifiers for values passed to @desc, e.g. something like the following
instead of "magic" zero and non-zero:
enum scsi_sense_format {
SCSI_SENSE_FIXED = 0,
SCSI_SENSE_DESCRIPTOR
};
> + * @key: Sense key
> + * @asc: Additional sense code
> + * @ascq: Additional sense code qualifier
> + *
> + **/
minor:
+ */
[no double star at kdoc end?]
> +void scsi_build_sense(struct scsi_cmnd *scmd, int desc, u8 key, u8 asc, u8 ascq)
> +{
> + scsi_build_sense_buffer(desc, scmd->sense_buffer, key, asc, ascq);
> + scmd->result = (DRIVER_SENSE << 24) | (DID_OK << 16) |
> + SAM_STAT_CHECK_CONDITION;
While this is scsi_lib and thus "internal" helper code, I wonder if this should
nonetheless use the helper functions to access and build scmd->result in order
to have the error-prone bit shifts in only one central place?:
scmd->result = SAM_STAT_CHECK_CONDITION;
set_driver_byte(scmd, DRIVER_SENSE);
set_host_byte(scmd, DID_OK);
> +}
> +EXPORT_SYMBOL_GPL(scsi_build_sense);
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index 6932d91472d5..9b9ca629097d 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -338,4 +338,7 @@ static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
> return xfer_len;
> }
>
> +extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc,
> + u8 key, u8 asc, u8 ascq);
> +
> #endif /* _SCSI_SCSI_CMND_H */
>
--
Mit freundlichen Gruessen / Kind regards
Steffen Maier
Linux on IBM Z Development
https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
next prev parent reply other threads:[~2019-10-22 12:21 UTC|newest]
Thread overview: 62+ 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 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: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
2019-10-22 6:02 ` Hannes Reinecke
2019-10-22 12:21 ` Steffen Maier [this message]
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
-- strict thread matches above, loose matches on Subject: below --
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=4097c14b-4b28-f7ee-595c-cb338b878d27@linux.ibm.com \
--to=maier@linux.ibm.com \
--cc=bblock@linux.ibm.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jthumshirn@suse.de \
--cc=linux-s390@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).