Commit 3a7b4579 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen

scsi: ses: Have midlayer retry scsi_execute_cmd() errors

This has ses have the SCSI midlayer retry scsi_execute_cmd() errors instead
of driving them itself.
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20240123002220.129141-17-michael.christie@oracle.comAcked-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0f11328f
...@@ -87,19 +87,32 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, ...@@ -87,19 +87,32 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code,
0 0
}; };
unsigned char recv_page_code; unsigned char recv_page_code;
unsigned int retries = SES_RETRIES; struct scsi_failure failure_defs[] = {
struct scsi_sense_hdr sshdr; {
.sense = UNIT_ATTENTION,
.asc = 0x29,
.ascq = SCMD_FAILURE_ASCQ_ANY,
.allowed = SES_RETRIES,
.result = SAM_STAT_CHECK_CONDITION,
},
{
.sense = NOT_READY,
.asc = SCMD_FAILURE_ASC_ANY,
.ascq = SCMD_FAILURE_ASCQ_ANY,
.allowed = SES_RETRIES,
.result = SAM_STAT_CHECK_CONDITION,
},
{}
};
struct scsi_failures failures = {
.failure_definitions = failure_defs,
};
const struct scsi_exec_args exec_args = { const struct scsi_exec_args exec_args = {
.sshdr = &sshdr, .failures = &failures,
}; };
do { ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen,
ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, SES_TIMEOUT, 1, &exec_args);
SES_TIMEOUT, 1, &exec_args);
} while (ret > 0 && --retries && scsi_sense_valid(&sshdr) &&
(sshdr.sense_key == NOT_READY ||
(sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29)));
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
...@@ -131,19 +144,32 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, ...@@ -131,19 +144,32 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code,
bufflen & 0xff, bufflen & 0xff,
0 0
}; };
struct scsi_sense_hdr sshdr; struct scsi_failure failure_defs[] = {
unsigned int retries = SES_RETRIES; {
.sense = UNIT_ATTENTION,
.asc = 0x29,
.ascq = SCMD_FAILURE_ASCQ_ANY,
.allowed = SES_RETRIES,
.result = SAM_STAT_CHECK_CONDITION,
},
{
.sense = NOT_READY,
.asc = SCMD_FAILURE_ASC_ANY,
.ascq = SCMD_FAILURE_ASCQ_ANY,
.allowed = SES_RETRIES,
.result = SAM_STAT_CHECK_CONDITION,
},
{}
};
struct scsi_failures failures = {
.failure_definitions = failure_defs,
};
const struct scsi_exec_args exec_args = { const struct scsi_exec_args exec_args = {
.sshdr = &sshdr, .failures = &failures,
}; };
do { result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, bufflen,
result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, SES_TIMEOUT, 1, &exec_args);
bufflen, SES_TIMEOUT, 1, &exec_args);
} while (result > 0 && --retries && scsi_sense_valid(&sshdr) &&
(sshdr.sense_key == NOT_READY ||
(sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29)));
if (result) if (result)
sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n",
result); result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment