diff mbox series

[10/16] qla2xxx: Fix device reconnect in loop topology

Message ID 20211224070712.17905-11-njavali@marvell.com
State Superseded
Headers show
Series qla2xxx misc bug fixes and features | expand

Commit Message

Nilesh Javali Dec. 24, 2021, 7:07 a.m. UTC
From: Arun Easi <aeasi@marvell.com>

A device logout in loop topology initiates a device connection teardown
which looses the FW device handle. In loop topo, the device handle is not
regrabbed leading to device login failures and eventually to loss of the
device. Fix this by taking the main login path that does it.

Cc: stable@vger.kernel.org
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 15 +++++++++++++++
 drivers/scsi/qla2xxx/qla_os.c   |  5 +++++
 2 files changed, 20 insertions(+)

Comments

Himanshu Madhani Jan. 3, 2022, 12:46 a.m. UTC | #1
> On Dec 23, 2021, at 11:07 PM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Arun Easi <aeasi@marvell.com>
> 
> A device logout in loop topology initiates a device connection teardown
> which looses the FW device handle. In loop topo, the device handle is not
> regrabbed leading to device login failures and eventually to loss of the
> device. Fix this by taking the main login path that does it.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_init.c | 15 +++++++++++++++
> drivers/scsi/qla2xxx/qla_os.c   |  5 +++++
> 2 files changed, 20 insertions(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index ac25d2bfa90b..24322eb01571 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -974,6 +974,9 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
> 				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
> 			}
> 			break;
> +		case ISP_CFG_NL:
> +			qla24xx_fcport_handle_login(vha, fcport);
> +			break;
> 		default:
> 			break;
> 		}
> @@ -1563,6 +1566,11 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport)
> 	u8 login = 0;
> 	int rc;
> 
> +	ql_dbg(ql_dbg_disc, vha, 0x307b,
> +	    "%s %8phC DS %d LS %d lid %d retries=%d\n",
> +	    __func__, fcport->port_name, fcport->disc_state,
> +	    fcport->fw_login_state, fcport->loop_id, fcport->login_retry);
> +
> 	if (qla_tgt_mode_enabled(vha))
> 		return;
> 
> @@ -5604,6 +5612,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
> 			memcpy(fcport->node_name, new_fcport->node_name,
> 			    WWN_SIZE);
> 			fcport->scan_state = QLA_FCPORT_FOUND;
> +			if (fcport->login_retry == 0) {
> +				fcport->login_retry = vha->hw->login_retry_count;
> +				ql_dbg(ql_dbg_disc, vha, 0x2135,
> +				    "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n",
> +				    fcport->port_name, fcport->loop_id,
> +				    fcport->login_retry);
> +			}
> 			found++;
> 			break;
> 		}
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 7d5159306112..88bff825aa5e 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -5540,6 +5540,11 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
> 					memset(&ea, 0, sizeof(ea));
> 					ea.fcport = fcport;
> 					qla24xx_handle_relogin_event(vha, &ea);
> +				} else if (vha->hw->current_topology ==
> +					 ISP_CFG_NL &&
> +					IS_QLA2XXX_MIDTYPE(vha->hw)) {
> +					(void)qla24xx_fcport_handle_login(vha,
> +									fcport);
> 				} else if (vha->hw->current_topology ==
> 				    ISP_CFG_NL) {
> 					fcport->login_retry--;
> -- 
> 2.23.1
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ac25d2bfa90b..24322eb01571 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -974,6 +974,9 @@  static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
 				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
 			}
 			break;
+		case ISP_CFG_NL:
+			qla24xx_fcport_handle_login(vha, fcport);
+			break;
 		default:
 			break;
 		}
@@ -1563,6 +1566,11 @@  static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 	u8 login = 0;
 	int rc;
 
+	ql_dbg(ql_dbg_disc, vha, 0x307b,
+	    "%s %8phC DS %d LS %d lid %d retries=%d\n",
+	    __func__, fcport->port_name, fcport->disc_state,
+	    fcport->fw_login_state, fcport->loop_id, fcport->login_retry);
+
 	if (qla_tgt_mode_enabled(vha))
 		return;
 
@@ -5604,6 +5612,13 @@  qla2x00_configure_local_loop(scsi_qla_host_t *vha)
 			memcpy(fcport->node_name, new_fcport->node_name,
 			    WWN_SIZE);
 			fcport->scan_state = QLA_FCPORT_FOUND;
+			if (fcport->login_retry == 0) {
+				fcport->login_retry = vha->hw->login_retry_count;
+				ql_dbg(ql_dbg_disc, vha, 0x2135,
+				    "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n",
+				    fcport->port_name, fcport->loop_id,
+				    fcport->login_retry);
+			}
 			found++;
 			break;
 		}
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 7d5159306112..88bff825aa5e 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -5540,6 +5540,11 @@  void qla2x00_relogin(struct scsi_qla_host *vha)
 					memset(&ea, 0, sizeof(ea));
 					ea.fcport = fcport;
 					qla24xx_handle_relogin_event(vha, &ea);
+				} else if (vha->hw->current_topology ==
+					 ISP_CFG_NL &&
+					IS_QLA2XXX_MIDTYPE(vha->hw)) {
+					(void)qla24xx_fcport_handle_login(vha,
+									fcport);
 				} else if (vha->hw->current_topology ==
 				    ISP_CFG_NL) {
 					fcport->login_retry--;