RE: [EXT] [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Hannes Reinecke <hare@xxxxxxx>
> Sent: Thursday, August 19, 2021 2:49 PM
> To: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>; James Bottomley
> <james.bottomley@xxxxxxxxxxxxxxxxxxxxx>; Nilesh Javali
> <njavali@xxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx; Hannes Reinecke
> <hare@xxxxxxx>
> Subject: [EXT] [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()
> 
> External Email
> 
> ----------------------------------------------------------------------
> 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.
> 
> Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
> Cc: Nilesh Javali <njavali@xxxxxxxxxxx>
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 54 +++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 7786af46224a..ea804dc69b6f 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1388,18 +1388,27 @@ static char *reset_errors[] = {
>  };
> 
>  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))
> +qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
>  {
> -	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
> -	fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
> +	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,
> +		    "PCI/Register disconnect, exiting.\n");
> +		qla_pci_set_eeh_busy(vha);
> +		return FAILED;
> +	}
> +
>  	if (!fcport) {
>  		return FAILED;
>  	}
> 
> -	err = fc_block_scsi_eh(cmd);
> +	err = fc_block_rport(rport);
>  	if (err != 0)
>  		return err;
> 
> @@ -1407,8 +1416,8 @@ __qla2xxx_eh_generic_reset(char *name, enum
> nexus_wait_type type,
>  		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);
> +	    "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) {
> @@ -1417,52 +1426,35 @@ __qla2xxx_eh_generic_reset(char *name, enum
> nexus_wait_type type,
>  		goto eh_reset_failed;
>  	}
>  	err = 2;
> -	if (do_reset(fcport, cmd->device->lun, 1)
> +	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, cmd->device->id,
> -	    cmd->device->lun, type) != QLA_SUCCESS) {
> +	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,
> -	    "%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name,
> -	    vha->host_no, cmd->device->id, cmd->device->lun, cmd);
> +	    "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,
> -	    "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name,
> -	    reset_errors[err], vha->host_no, cmd->device->id, cmd->device-
> >lun,
> +	    "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
> -qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
> -{
> -	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
> -	struct qla_hw_data *ha = vha->hw;
> -
> -	if (qla2x00_isp_reg_stat(ha)) {
> -		ql_log(ql_log_info, vha, 0x803e,
> -		    "PCI/Register disconnect, exiting.\n");
> -		qla_pci_set_eeh_busy(vha);
> -		return FAILED;
> -	}
> -
> -	return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN, cmd,
> -	    ha->isp_ops->lun_reset);
> -}
> -
>  static int
>  qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
>  {
> --
> 2.29.2

Reviewed-by: Nilesh Javali <njavali@xxxxxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux