mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
scsi: qla2xxx: Open-code qla2xxx_eh_device_reset()
Device reset and target reset will be using different calling sequences, so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_device_reset(), and remove the now obsolete function __qla2xxx_eh_generic_reset(). No functional changes. Link: https://lore.kernel.org/r/20210819091913.94436-4-hare@suse.de Cc: Nilesh Javali <njavali@marvell.com> Reviewed-by: Nilesh Javali <njavali@marvell.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
e56b2234ab
commit
cbe1f0d700
@ -1388,70 +1388,15 @@ static char *reset_errors[] = {
|
||||
"Waiting for command completions",
|
||||
};
|
||||
|
||||
static int
|
||||
__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
|
||||
struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, uint64_t, int))
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
|
||||
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
|
||||
int err;
|
||||
|
||||
if (!fcport) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
err = fc_block_scsi_eh(cmd);
|
||||
if (err != 0)
|
||||
return err;
|
||||
|
||||
if (fcport->deleted)
|
||||
return SUCCESS;
|
||||
|
||||
ql_log(ql_log_info, vha, 0x8009,
|
||||
"%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no,
|
||||
cmd->device->id, cmd->device->lun, cmd);
|
||||
|
||||
err = 0;
|
||||
if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800a,
|
||||
"Wait for hba online failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
err = 2;
|
||||
if (do_reset(fcport, cmd->device->lun, 1)
|
||||
!= QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800c,
|
||||
"do_reset failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
err = 3;
|
||||
if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id,
|
||||
cmd->device->lun, type) != QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800d,
|
||||
"wait for pending cmds failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
|
||||
ql_log(ql_log_info, vha, 0x800e,
|
||||
"%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name,
|
||||
vha->host_no, cmd->device->id, cmd->device->lun, cmd);
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
eh_reset_failed:
|
||||
ql_log(ql_log_info, vha, 0x800f,
|
||||
"%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name,
|
||||
reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun,
|
||||
cmd);
|
||||
vha->reset_cmd_err_cnt++;
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
static int
|
||||
qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
|
||||
struct scsi_device *sdev = cmd->device;
|
||||
scsi_qla_host_t *vha = shost_priv(sdev->host);
|
||||
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
|
||||
fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
int err;
|
||||
|
||||
if (qla2x00_isp_reg_stat(ha)) {
|
||||
ql_log(ql_log_info, vha, 0x803e,
|
||||
@ -1460,8 +1405,55 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN, cmd,
|
||||
ha->isp_ops->lun_reset);
|
||||
if (!fcport) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
err = fc_block_rport(rport);
|
||||
if (err != 0)
|
||||
return err;
|
||||
|
||||
if (fcport->deleted)
|
||||
return SUCCESS;
|
||||
|
||||
ql_log(ql_log_info, vha, 0x8009,
|
||||
"DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no,
|
||||
sdev->id, sdev->lun, cmd);
|
||||
|
||||
err = 0;
|
||||
if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800a,
|
||||
"Wait for hba online failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
err = 2;
|
||||
if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1)
|
||||
!= QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800c,
|
||||
"do_reset failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
err = 3;
|
||||
if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id,
|
||||
sdev->lun, WAIT_LUN) != QLA_SUCCESS) {
|
||||
ql_log(ql_log_warn, vha, 0x800d,
|
||||
"wait for pending cmds failed for cmd=%p.\n", cmd);
|
||||
goto eh_reset_failed;
|
||||
}
|
||||
|
||||
ql_log(ql_log_info, vha, 0x800e,
|
||||
"DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n",
|
||||
vha->host_no, sdev->id, sdev->lun, cmd);
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
eh_reset_failed:
|
||||
ql_log(ql_log_info, vha, 0x800f,
|
||||
"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n",
|
||||
reset_errors[err], vha->host_no, sdev->id, sdev->lun,
|
||||
cmd);
|
||||
vha->reset_cmd_err_cnt++;
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user