scsi: s390: Use combined sense codes

Use the 16-bit sense codes and replace all hard-coded additional sense
codes and additional sense code qualifiers with the enum values defined in
include/scsi/scsi_sense.h. This helps with code clarity as the sense codes
being processed are easier to test and self-documented.

No functional change intended.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Link: https://patch.msgid.link/20260908090308.1085097-39-dlemoal@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
Damien Le Moal 2026-09-08 18:03:06 +09:00 committed by Martin K. Petersen (Oracle)
parent c44f095a9d
commit 3f37a1a804
3 changed files with 10 additions and 7 deletions

View File

@ -176,7 +176,7 @@ extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *);
extern void zfcp_scsi_schedule_rport_block(struct zfcp_port *);
extern void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *);
extern void zfcp_scsi_set_prot(struct zfcp_adapter *);
extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, int);
extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, u16);
extern void zfcp_scsi_shost_update_config_data(
struct zfcp_adapter *const adapter,
const struct fsf_qtcb_bottom_config *const bottom,

View File

@ -2485,13 +2485,16 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)
set_host_byte(scpnt, DID_ERROR);
goto skip_fsfstatus;
case FSF_BLOCK_GUARD_CHECK_FAILURE:
zfcp_scsi_dif_sense_error(scpnt, 0x1);
zfcp_scsi_dif_sense_error(scpnt,
LOGICAL_BLOCK_GUARD_CHECK_FAILED);
goto skip_fsfstatus;
case FSF_APP_TAG_CHECK_FAILURE:
zfcp_scsi_dif_sense_error(scpnt, 0x2);
zfcp_scsi_dif_sense_error(scpnt,
LOGICAL_BLOCK_APPLICATION_TAG_CHECK_FAILED);
goto skip_fsfstatus;
case FSF_REF_TAG_CHECK_FAILURE:
zfcp_scsi_dif_sense_error(scpnt, 0x3);
zfcp_scsi_dif_sense_error(scpnt,
LOGICAL_BLOCK_REFERENCE_TAG_CHECK_FAILED);
goto skip_fsfstatus;
}
BUILD_BUG_ON(sizeof(struct fcp_resp_with_ext) > FSF_FCP_RSP_SIZE);

View File

@ -849,14 +849,14 @@ void zfcp_scsi_set_prot(struct zfcp_adapter *adapter)
/**
* zfcp_scsi_dif_sense_error - Report DIF/DIX error as driver sense error
* @scmd: The SCSI command to report the error for
* @ascq: The ASCQ to put in the sense buffer
* @sense_code: The combined ASC and ASCQ to put in the sense buffer
*
* See the error handling in sd_done for the sense codes used here.
* Set DID_SOFT_ERROR to retry the request, if possible.
*/
void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, int ascq)
void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, u16 sense_code)
{
scsi_build_sense(scmd, 1, ILLEGAL_REQUEST, 0x10, ascq);
scsi_set_sense(scmd, 1, ILLEGAL_REQUEST, sense_code);
set_host_byte(scmd, DID_SOFT_ERROR);
}