diff mbox series

[04/15] qla2xxx: tear down session if FW say its down

Message ID 20201201082730.24158-5-njavali@marvell.com (mailing list archive)
State Superseded
Headers show
Series qla2xxx bug fixes | expand

Commit Message

Nilesh Javali Dec. 1, 2020, 8:27 a.m. UTC
From: Quinn Tran <qutran@marvell.com>

The completion status 0x28 (ppc = be = 0x2800) below indicate session
is not there, trigger session deletion.

qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67b completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).
qla2xxx [000b:04:00.1]-800c:8: do_reset failed for cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-800f:8: DEVICE RESET FAILED: Task management failed nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:52 cmd=c000001432d0c200.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67c completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_isr.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

Comments

Himanshu Madhani Dec. 1, 2020, 3:48 p.m. UTC | #1
> On Dec 1, 2020, at 2:27 AM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Quinn Tran <qutran@marvell.com>
> 
> The completion status 0x28 (ppc = be = 0x2800) below indicate session
> is not there, trigger session deletion.
> 
> qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:51 cmd=c000001432d0f600.
> qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67b completion status(2800).
> qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).
> qla2xxx [000b:04:00.1]-800c:8: do_reset failed for cmd=c000001432d0f600.
> qla2xxx [000b:04:00.1]-800f:8: DEVICE RESET FAILED: Task management failed nexus=8:1:51 cmd=c000001432d0f600.
> qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:52 cmd=c000001432d0c200.
> qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67c completion status(2800).
> qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).
> 
> Signed-off-by: Quinn Tran <qutran@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_isr.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index 77dd7630c3f8..f9142dbec112 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -2226,11 +2226,13 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
> 	srb_t *sp;
> 	struct srb_iocb *iocb;
> 	struct sts_entry_24xx *sts = (struct sts_entry_24xx *)tsk;
> +	u16 comp_status;
> 
> 	sp = qla2x00_get_sp_from_handle(vha, func, req, tsk);
> 	if (!sp)
> 		return;
> 
> +	comp_status = le16_to_cpu(sts->comp_status);
> 	iocb = &sp->u.iocb_cmd;
> 	type = sp->name;
> 	fcport = sp->fcport;
> @@ -2244,7 +2246,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
> 	} else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) {
> 		ql_log(ql_log_warn, fcport->vha, 0x5039,
> 		    "Async-%s error - hdl=%x completion status(%x).\n",
> -		    type, sp->handle, sts->comp_status);
> +		    type, sp->handle, comp_status);
> 		iocb->u.tmf.data = QLA_FUNCTION_FAILED;
> 	} else if ((le16_to_cpu(sts->scsi_status) &
> 	    SS_RESPONSE_INFO_LEN_VALID)) {
> @@ -2260,6 +2262,30 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
> 		}
> 	}
> 
> +	switch (comp_status) {
> +	case CS_PORT_LOGGED_OUT:
> +	case CS_PORT_CONFIG_CHG:
> +	case CS_PORT_BUSY:
> +	case CS_INCOMPLETE:
> +	case CS_PORT_UNAVAILABLE:
> +	case CS_TIMEOUT:
> +	case CS_RESET:
> +		if (atomic_read(&fcport->state) == FCS_ONLINE) {
> +			ql_dbg(ql_dbg_disc, fcport->vha, 0x3021,
> +			       "-Port to be marked lost on fcport=%02x%02x%02x, current port state= %s comp_status %x.\n",
> +			       fcport->d_id.b.domain, fcport->d_id.b.area,
> +			       fcport->d_id.b.al_pa,
> +			       port_state_str[FCS_ONLINE],
> +			       comp_status);
> +
> +			qlt_schedule_sess_for_deletion(fcport);
> +		}
> +		break;
> +
> +	default:
> +		break;
> +	}
> +
> 	if (iocb->u.tmf.data != QLA_SUCCESS)
> 		ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, sp->vha, 0x5055,
> 		    sts, sizeof(*sts));
> -- 
> 2.19.0.rc0
> 

Looks Good.

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

--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 77dd7630c3f8..f9142dbec112 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2226,11 +2226,13 @@  qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
 	srb_t *sp;
 	struct srb_iocb *iocb;
 	struct sts_entry_24xx *sts = (struct sts_entry_24xx *)tsk;
+	u16 comp_status;
 
 	sp = qla2x00_get_sp_from_handle(vha, func, req, tsk);
 	if (!sp)
 		return;
 
+	comp_status = le16_to_cpu(sts->comp_status);
 	iocb = &sp->u.iocb_cmd;
 	type = sp->name;
 	fcport = sp->fcport;
@@ -2244,7 +2246,7 @@  qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
 	} else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) {
 		ql_log(ql_log_warn, fcport->vha, 0x5039,
 		    "Async-%s error - hdl=%x completion status(%x).\n",
-		    type, sp->handle, sts->comp_status);
+		    type, sp->handle, comp_status);
 		iocb->u.tmf.data = QLA_FUNCTION_FAILED;
 	} else if ((le16_to_cpu(sts->scsi_status) &
 	    SS_RESPONSE_INFO_LEN_VALID)) {
@@ -2260,6 +2262,30 @@  qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
 		}
 	}
 
+	switch (comp_status) {
+	case CS_PORT_LOGGED_OUT:
+	case CS_PORT_CONFIG_CHG:
+	case CS_PORT_BUSY:
+	case CS_INCOMPLETE:
+	case CS_PORT_UNAVAILABLE:
+	case CS_TIMEOUT:
+	case CS_RESET:
+		if (atomic_read(&fcport->state) == FCS_ONLINE) {
+			ql_dbg(ql_dbg_disc, fcport->vha, 0x3021,
+			       "-Port to be marked lost on fcport=%02x%02x%02x, current port state= %s comp_status %x.\n",
+			       fcport->d_id.b.domain, fcport->d_id.b.area,
+			       fcport->d_id.b.al_pa,
+			       port_state_str[FCS_ONLINE],
+			       comp_status);
+
+			qlt_schedule_sess_for_deletion(fcport);
+		}
+		break;
+
+	default:
+		break;
+	}
+
 	if (iocb->u.tmf.data != QLA_SUCCESS)
 		ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, sp->vha, 0x5055,
 		    sts, sizeof(*sts));