All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework
@ 2021-08-19  9:19 Hannes Reinecke
  2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Hannes Reinecke @ 2021-08-19  9:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, Nilesh Javali, linux-scsi,
	Hannes Reinecke

Hi all,

with the SCSI EH rework the scsi_cmnd argument for the SCSI EH
callbacks is going away, so we need to fixup the drivers to work
without it.

This patchset modifies the qla2xxx driver to not rely on a
specific command for the SCSI EH callbacks.

As usual, comments and reviews are welcome.

Hannes Reinecke (3):
  qla2xxx: Do not call fc_block_scsi_eh() during bus reset
  qla2xxx: Open-code qla2xxx_eh_target_reset()
  qla2xxx: Open-code qla2xxx_eh_device_reset()

 drivers/scsi/qla2xxx/qla_os.c | 116 ++++++++++++++++++++++------------
 1 file changed, 74 insertions(+), 42 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
  2021-08-19  9:19 [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Hannes Reinecke
@ 2021-08-19  9:19 ` Hannes Reinecke
  2021-08-20  5:15   ` [EXT] " Nilesh Javali
  2021-08-24  3:06   ` Martin K. Petersen
  2021-08-19  9:19 ` [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset() Hannes Reinecke
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Hannes Reinecke @ 2021-08-19  9:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, Nilesh Javali, linux-scsi,
	Hannes Reinecke

When calling bus reset the driver will be doing a full SAN resync
anyway, so there is no need to wait for any pending RSCNs; they'll
be re-issued during resync anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 868037c7d608..54254bd3a7d7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1499,7 +1499,6 @@ static int
 qla2xxx_eh_bus_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;
 	int ret = FAILED;
 	unsigned int id;
 	uint64_t lun;
@@ -1515,15 +1514,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
 	id = cmd->device->id;
 	lun = cmd->device->lun;
 
-	if (!fcport) {
-		return ret;
-	}
-
-	ret = fc_block_scsi_eh(cmd);
-	if (ret != 0)
-		return ret;
-	ret = FAILED;
-
 	if (qla2x00_chip_is_down(vha))
 		return ret;
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset()
  2021-08-19  9:19 [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Hannes Reinecke
  2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
@ 2021-08-19  9:19 ` Hannes Reinecke
  2021-08-20  5:16   ` [EXT] " Nilesh Javali
  2021-08-19  9:19 ` [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() Hannes Reinecke
  2021-08-28  2:32 ` [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Martin K. Petersen
  3 siblings, 1 reply; 9+ messages in thread
From: Hannes Reinecke @ 2021-08-19  9:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, Nilesh Javali, linux-scsi,
	Hannes Reinecke

Device reset and target reset will be using different calling sequences,
so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_target_reset().
No functional changes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 56 +++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 54254bd3a7d7..7786af46224a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1466,8 +1466,12 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
 static int
 qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
 {
-	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
+	struct scsi_device *sdev = cmd->device;
+	struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
+	scsi_qla_host_t *vha = shost_priv(rport_to_shost(rport));
 	struct qla_hw_data *ha = vha->hw;
+	fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
+	int err;
 
 	if (qla2x00_isp_reg_stat(ha)) {
 		ql_log(ql_log_info, vha, 0x803f,
@@ -1476,8 +1480,54 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
 		return FAILED;
 	}
 
-	return __qla2xxx_eh_generic_reset("TARGET", WAIT_TARGET, cmd,
-	    ha->isp_ops->target_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,
+	    "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no,
+	    sdev->id, 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->target_reset(fcport, 0, 0) != QLA_SUCCESS) {
+		ql_log(ql_log_warn, vha, 0x800c,
+		    "target_reset failed for cmd=%p.\n", cmd);
+		goto eh_reset_failed;
+	}
+	err = 3;
+	if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id,
+	    0, WAIT_TARGET) != 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,
+	    "TARGET RESET SUCCEEDED nexus:%ld:%d cmd=%p.\n",
+	    vha->host_no, sdev->id, cmd);
+
+	return SUCCESS;
+
+eh_reset_failed:
+	ql_log(ql_log_info, vha, 0x800f,
+	    "TARGET RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n",
+	    reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun,
+	    cmd);
+	vha->reset_cmd_err_cnt++;
+	return FAILED;
 }
 
 /**************************************************************************
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()
  2021-08-19  9:19 [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Hannes Reinecke
  2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
  2021-08-19  9:19 ` [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset() Hannes Reinecke
@ 2021-08-19  9:19 ` Hannes Reinecke
  2021-08-20  5:16   ` [EXT] " Nilesh Javali
  2021-08-28  2:32 ` [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Martin K. Petersen
  3 siblings, 1 reply; 9+ messages in thread
From: Hannes Reinecke @ 2021-08-19  9:19 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, Nilesh Javali, linux-scsi,
	Hannes Reinecke

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@suse.de>
Cc: Nilesh Javali <njavali@marvell.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [EXT] [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
  2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
@ 2021-08-20  5:15   ` Nilesh Javali
  2021-08-24  3:06   ` Martin K. Petersen
  1 sibling, 0 replies; 9+ messages in thread
From: Nilesh Javali @ 2021-08-20  5:15 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi

Hannes,

> -----Original Message-----
> From: Hannes Reinecke <hare@suse.de>
> Sent: Thursday, August 19, 2021 2:49 PM
> To: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>; James Bottomley
> <james.bottomley@hansenpartnership.com>; Nilesh Javali
> <njavali@marvell.com>; linux-scsi@vger.kernel.org; Hannes Reinecke
> <hare@suse.de>
> Subject: [EXT] [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus
> reset
> 
> External Email
> 
> ----------------------------------------------------------------------
> When calling bus reset the driver will be doing a full SAN resync
> anyway, so there is no need to wait for any pending RSCNs; they'll
> be re-issued during resync anyway.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Cc: Nilesh Javali <njavali@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 868037c7d608..54254bd3a7d7 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1499,7 +1499,6 @@ static int
>  qla2xxx_eh_bus_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;
>  	int ret = FAILED;
>  	unsigned int id;
>  	uint64_t lun;
> @@ -1515,15 +1514,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
>  	id = cmd->device->id;
>  	lun = cmd->device->lun;
> 
> -	if (!fcport) {
> -		return ret;
> -	}
> -
> -	ret = fc_block_scsi_eh(cmd);
> -	if (ret != 0)
> -		return ret;
> -	ret = FAILED;
> -
>  	if (qla2x00_chip_is_down(vha))
>  		return ret;
> 
> --
> 2.29.2

Thanks for the patches.
Reviewed-by: Nilesh Javali <njavali@marvell.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [EXT] [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset()
  2021-08-19  9:19 ` [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset() Hannes Reinecke
@ 2021-08-20  5:16   ` Nilesh Javali
  0 siblings, 0 replies; 9+ messages in thread
From: Nilesh Javali @ 2021-08-20  5:16 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi



> -----Original Message-----
> From: Hannes Reinecke <hare@suse.de>
> Sent: Thursday, August 19, 2021 2:49 PM
> To: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>; James Bottomley
> <james.bottomley@hansenpartnership.com>; Nilesh Javali
> <njavali@marvell.com>; linux-scsi@vger.kernel.org; Hannes Reinecke
> <hare@suse.de>
> Subject: [EXT] [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset()
> 
> External Email
> 
> ----------------------------------------------------------------------
> Device reset and target reset will be using different calling sequences,
> so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_target_reset().
> No functional changes.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Cc: Nilesh Javali <njavali@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 56 +++++++++++++++++++++++++++++++++--
>  1 file changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 54254bd3a7d7..7786af46224a 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1466,8 +1466,12 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
>  static int
>  qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
>  {
> -	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
> +	struct scsi_device *sdev = cmd->device;
> +	struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
> +	scsi_qla_host_t *vha = shost_priv(rport_to_shost(rport));
>  	struct qla_hw_data *ha = vha->hw;
> +	fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
> +	int err;
> 
>  	if (qla2x00_isp_reg_stat(ha)) {
>  		ql_log(ql_log_info, vha, 0x803f,
> @@ -1476,8 +1480,54 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
>  		return FAILED;
>  	}
> 
> -	return __qla2xxx_eh_generic_reset("TARGET", WAIT_TARGET, cmd,
> -	    ha->isp_ops->target_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,
> +	    "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no,
> +	    sdev->id, 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->target_reset(fcport, 0, 0) != QLA_SUCCESS) {
> +		ql_log(ql_log_warn, vha, 0x800c,
> +		    "target_reset failed for cmd=%p.\n", cmd);
> +		goto eh_reset_failed;
> +	}
> +	err = 3;
> +	if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id,
> +	    0, WAIT_TARGET) != 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,
> +	    "TARGET RESET SUCCEEDED nexus:%ld:%d cmd=%p.\n",
> +	    vha->host_no, sdev->id, cmd);
> +
> +	return SUCCESS;
> +
> +eh_reset_failed:
> +	ql_log(ql_log_info, vha, 0x800f,
> +	    "TARGET RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n",
> +	    reset_errors[err], vha->host_no, cmd->device->id, cmd->device-
> >lun,
> +	    cmd);
> +	vha->reset_cmd_err_cnt++;
> +	return FAILED;
>  }
> 
> 
> /***************************************************************
> ***********
> --
> 2.29.2

Reviewed-by: Nilesh Javali <njavali@marvell.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [EXT] [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()
  2021-08-19  9:19 ` [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() Hannes Reinecke
@ 2021-08-20  5:16   ` Nilesh Javali
  0 siblings, 0 replies; 9+ messages in thread
From: Nilesh Javali @ 2021-08-20  5:16 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi



> -----Original Message-----
> From: Hannes Reinecke <hare@suse.de>
> Sent: Thursday, August 19, 2021 2:49 PM
> To: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>; James Bottomley
> <james.bottomley@hansenpartnership.com>; Nilesh Javali
> <njavali@marvell.com>; linux-scsi@vger.kernel.org; Hannes Reinecke
> <hare@suse.de>
> 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@suse.de>
> Cc: Nilesh Javali <njavali@marvell.com>
> ---
>  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@marvell.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
  2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
  2021-08-20  5:15   ` [EXT] " Nilesh Javali
@ 2021-08-24  3:06   ` Martin K. Petersen
  1 sibling, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2021-08-24  3:06 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	Nilesh Javali, linux-scsi


Hannes,

> When calling bus reset the driver will be doing a full SAN resync
> anyway, so there is no need to wait for any pending RSCNs; they'll be
> re-issued during resync anyway.

Applied to 5.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework
  2021-08-19  9:19 [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Hannes Reinecke
                   ` (2 preceding siblings ...)
  2021-08-19  9:19 ` [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() Hannes Reinecke
@ 2021-08-28  2:32 ` Martin K. Petersen
  3 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2021-08-28  2:32 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K . Petersen, Nilesh Javali, linux-scsi, James Bottomley,
	Christoph Hellwig

On Thu, 19 Aug 2021 11:19:10 +0200, Hannes Reinecke wrote:

> with the SCSI EH rework the scsi_cmnd argument for the SCSI EH
> callbacks is going away, so we need to fixup the drivers to work
> without it.
> 
> This patchset modifies the qla2xxx driver to not rely on a
> specific command for the SCSI EH callbacks.
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
      https://git.kernel.org/mkp/scsi/c/c74ce061f898
[2/3] qla2xxx: Open-code qla2xxx_eh_target_reset()
      https://git.kernel.org/mkp/scsi/c/e56b2234ab64
[3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()
      https://git.kernel.org/mkp/scsi/c/cbe1f0d70072

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-28  2:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  9:19 [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Hannes Reinecke
2021-08-19  9:19 ` [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Hannes Reinecke
2021-08-20  5:15   ` [EXT] " Nilesh Javali
2021-08-24  3:06   ` Martin K. Petersen
2021-08-19  9:19 ` [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset() Hannes Reinecke
2021-08-20  5:16   ` [EXT] " Nilesh Javali
2021-08-19  9:19 ` [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() Hannes Reinecke
2021-08-20  5:16   ` [EXT] " Nilesh Javali
2021-08-28  2:32 ` [PATCH 0/3] qla2xxx: Fixes for SCSI EH rework Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.